#help-development
1 messages · Page 2236 of 1
its not location dependent
@EventHandler
public void onPortalBreak(BlockPhysicsEvent e) {
if (e.getChangedType().getId() == 90) {
e.setCancelled(true);
}
}
}```
Oh u cancel for all portals and only one gets placed
What mc version are u developing for?
1.8.8
cringe
not as cringe as having shit performance
skull
💀
☠️
That makes sense😂
Thanks man
how do i place an end portal frame below the two portal blocks
seems to not work
Does anyone know how can i set a prefix beside the player name above his 3d character?
no but the displayname only sets the thing for the chat right?
Player#setDisplayName(String name) changes above head name
oh wait it does?
yeah im pretty sure
sorry I didnt knew that, cause i cant see my name in perspective.. lmao sorry
thank you for letting me know
Hi! Does anybody know how to shade your API into your Plugin using Maven? Thanks!
oh can I get a bit more hints 🙏
oh
oh
oh
How can i remove this from an itemstack?
i tried removing lore but that didn't work
maybe add itemflags or smth
bro i tried this one, it didnt work for me ;-;
//\```
ItemFlag#HIDE_ATTRIBUTES
crap pinged the wrong person
ItemFlag#HIDE_ATTRIBUTES
also it wont appear for survival mode players
that shit is only for creative menu
like so?
no my code is literally the same as the above tutorial, but the tutorial is very vague as it plans to cover the api in a single thread
if u dont wanna deal with discord formatting write it on notepad and screenshot it
``` works too
its ok
anyways
im trying to make ship helm but onto ActionBar
does anybody know to shade custom apis in your plugin using maven?
this
thx
how do i give players a potion effect on respawn?
add the dependency
PlayerRespawnEvent
wait a tick, then give it to them
weird
wait a tick
i waited an entire second
okay i will try it
thats 20 ticks
did you make sure that the potion effect time was in ticks too
💀
you probably tried to add a 5 tick effect thinking it was 5 seconds lol
Very common issue
i know how ticks work
ok huh it's maxvalue lol
1 second = 20 ticks
no wait one tick instead of 20
alr
no need to wait a whole second
Any way to make ActionBar msg bigger?
barrely visible in the img
precautions my guy
true
texture pac
turn your GUI scale up
without having to force ppl to scale up gui
well gotta implement it into my texture pack i recon
i think its only possible using a texture pack
uh, how do i do it without making my api public / uploading it?
How can I prevent mobs from moving through a nether portal?
There is a EntityPortalEnterEvent: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityPortalEnterEvent.html
declaration: package: org.bukkit.event.entity, class: EntityPortalEnterEvent
You can check the entity and if its a mob cancel the event
declaration: package: org.bukkit.event.entity, class: EntityPortalEvent
think the second one fits your needs more
google maven
google it
not google maven
imagine google made a build tool
thx
also have same issue with this
I fixed that
How
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
just wondering, is using Consumers or CompleteableFutures better for callbacks?
i would assume if im only calling it once that completeablefuture would be best
Future or CompletableFuture
Why is it that persistendatastorage getting a key doesn't work when it's referenced for another plugin? how can i make this work?
plugin A:
NamespacedKey nk = new NamespacedKey(plugin, "cointype");
itemMeta.getPersistentDataContainer().set(nk, PersistentDataType.STRING, "coin");
Plugin B:
NamespacedKey key = new NamespacedKey(EscLockupCells.get_instance(), "cointype");
return pdc.getOrDefault(key, PersistentDataType.STRING, "not coin");
how do i change a players message with the message event (bungee)
I mean CompletableFutures are what you call computation builders
Consumer can do that as well with Consume::andThen but they’re just more inflexible, for instance when it comes to error handling and continuation
Also CFs do implement both CompletionStage (computation builder part) and Future (the future part)
Lmao shity maven, im telling him to use a library that is installed on local repo and he is searching for it on remote repo. What i can do?
How can I create a placeholder in my plugin which can be used by a scoreboard plugin so I can show playerdata?
You can ask on their server
The plugin have his own discord for that type of things
placeholderapi's server?
Yeah their have a discord
ah lemme try find it
You actually don't need to, the API is well documented and easy to jse
Use*
Yeah
There you have an example
i've looked at the docs, and it only shows it for when an event happens
i need it as a general placeholder
for placeholders, none
@ivory sleet can you help me?
Allright i will spoof you a code from my pl
alright ty
Alright, I'll have another read again
Yeah but i will send the code
ty
public class CoinsExpansion extends PlaceholderExpansion {
private CoinsPlugin plugin;
public CoinsExpansion(CoinsPlugin plugin) {
this.plugin = plugin;
}
@Override
public String getIdentifier() {
return "acoins";
}
@Override
public String getAuthor() {
return "Alexito2060";
}
@Override
public String getVersion() {
return "1.0";
}
@Override
public boolean persist() {
return true;
}
@Override
public boolean register() { return super.register(); }
@Override
public String onRequest(OfflinePlayer player, @NotNull String identifier) {
switch (identifier){
case "coins":
return String.valueOf(this.plugin.getApi().getCoins((Player)player));
}
return null;
}
}```
and then on main class:
new CoinsExpansion(this).register();
In your case you should replace the CoinsPlugin with what ever you want to pass into CoinsExpansion
@quaint mantle if you have any dought just tag me
public class OrionGoldExpansion extends PlaceholderExpansion {
@Override
public @NotNull String getIdentifier() {
return "oriongold";
}
@Override
public @NotNull String getAuthor() {
return "Stress";
}
@Override
public @NotNull String getVersion() {
return OrionGold.getInstance().getDescription().getVersion();
}
@Override
public String onRequest(OfflinePlayer player, String params) {
final User user = OrionGold.getInstance().getDatabaseManager().getUser(player.getUniqueId());
if (params.equalsIgnoreCase("balance_formatted")) {
return Common.format(user.getGold());
}
if (params.equalsIgnoreCase("balance")) {
return String.valueOf(user.getGold());
}
return null;
}
}
im static abusing but thats what ive got atm
anyone know what happened to EntityPlayer#activeContainer in 1.18.2?
Dont use if, use switch
aight
Have you initailized thru main class with new OrionGoldExpansion().register(); ?
not yet no
Allright
So after you change the if to switch, do that code onEnable()
done all that
bet
In teory it should be working
If doesnt work try adding this lines on the expansion class
@Override
public boolean persist() { return true; }
@Override
public boolean register() { return super.register(); }
Also try doing: /papi list
If the expansion was loaded should appear on the list
allr
Your welcome
Did you finally add this?
didnt need it
Hello, how can I get a custom head decoration for my plugin ?
What do you mean ?
You mean custom head texture ?
Yes, like a money bag for example
Google your question before asking it:
https://www.google.com/
I know how can I get a player's skull but I really don't know how can i get a decoration. I searched on google but it speaks only about player's skull
But okay thanks for your help
Well "decoration" is basically a skin on a player's skull
You even have plenty of plugin to do that
Such as head database
But I need a decoration skull for my plugin. I would like to use the skull into a gui
Have you ever searched on google ?
Took me 0.1sec
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Yes, I searched on Google, but thank you, I think I didn't write properly my research. Thank you, but can you be less agressive. I did all my researches on Google and when I really don't find, I go on spigot discord, but that's really rare.
If you look my activity on this discord's server, you will see that is not all days that I go on this discord to have help.
Yeah I'm sorry to be that rude but it's kinda boring of repeating myself all the day long. Moreover it trains you to optimize your search: it's sometimes good to be stuck and rethink all what you've done.
I hope it will help you for the future.
Yeah, I saw your GitHub i'm also french so je pense qu'on pourrait parler français, but I understood what you want to say. I will try to optimize my researched for the future. Thank you 🙂
Quick question about reflection and nms. I'm trying to expose some methods as I'm doing a bit of messing around. I'm quite curious how it works with remapped. Would I have to decompile the server jar and look for names in there or am I able to use the remapped names. The latter I don't think would work do to the names merely being remapped
if you need the obfuscated ones for example .c.d is it possible to find a source with those I can't find them
Also curious. I think if the remapper is smart enough it can actually remap reflections.
hmm I'll test it out hopefully otherwise this will be a pain
share then pls
ive got more of a java question
ask it
so i have many many singletons in my plugin
bad design
show what you mean
for example event listeners
why
wut?
doesnt matter
it doesn't make sense at all
meh
ok point is, I have code similar to this for every singleton
public class NearbyPlayerComfortability implements LoopingTask<SuperiorHorse> {
private static NearbyPlayerComfortability instance;
public static NearbyPlayerComfortability getInstance() {
if (instance == null) {
instance = new NearbyPlayerComfortability();
}
return instance;
}
is it possible to turn this into a class and extend it (or implement an interface)
they effectively are singletons. Doesnt mean they have to be used in a singleton pattern
I have some manager classes that are listeners to clean up stuff on leave and do stuff on join
some of my singletons are event listeners and something called "LoopingTask"s which is my own interface, so I need to grab the same instance for both parts of the program that accesses each part
ugh
I dont make them into singletons but i do pass them to other classes
You should def not pass listeners around ever
the problem is that I'm pretty much copy pasting this code a lot, is it possible to turn this into an interface
Why not?
Because this violates basically half of the clean code principles
Scoreboard Questions
its like basic coding prinicples
The most important ones are the SOLID principles
google them
is it possible to do something along the lines of this
public class Singleton<T> {
private static T instance;
public static T getInstance() {
if (instance == null) {
instance = new T();
}
return instance;
}
}
(i know this looks terrible- it doesn't even compile, it's more pseudocode)
I mean, static stuff is not inherited
^
I mean, but isn't that what you want ?
just wondering if its possible to turn this getInstance method into an interface that I can implement wherever I want
no
If you want to not worry about your instance management then you should try a dependency injection framework like guice
so i must copy paste this everywhere?
Well preferably singletons are pretty rare
if everything is a singleton, just make stuff static
i have many different event listeners, and I have other parts of my program that needs to access these listeners
Well yea, use DI
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
wait, stuff needs access TO your listeners ?
like i said
yes

bad design
wiat hold up I got that backwards too
look look
your listeners shall not provide data
^
some of my classes implement Listener and a bunch of my own interfaces
why
because each class handles one feature
like?
LOL
im gonna see some real hardcoded shit in a second wont i
"my classes implement Listener and a bunch of my own interface" -> "each class handles one feature"
Thanks for telling me abt that
🤔
one file for managing the "Trustworthyness" stat, one file for managing players adjusting horse speed, etc
its hard to explain lmao
show ur damn code
it has like 50 files how am i suppoed to do that
ok
here is an unfinished "feature" file
this is for managing when a player right clicks a stick while sitting on a horse
it'll adjust the horses speed
and display the speed on the action bar
you could have an instance of your SIngleton and then have something like getInstance(T.class) lol
but I wonder what the purpose of this would be
so that i dont have to copy paste code everywhere
doesnt show much
shouldn't all the data collection be handled internally inside of the event I don't get why you would want to collect data from it
where your code is bad
not trying to collect data from it
for example in the code I sent, it also implements LoopingTask<Player>
which basically adds the runLoopingTask(Player) and getIntervalTicks method, so that an external task handler can call the runLoopingTask method every certain amount of ticks (specified by the getIntervalticks method)
INSERT INTO player_lives (UUID, Lives) VALUES (" + "'" + uuid + "'" + lives + ");");
can anyone see anything wrong with this? as i get error
thats confusing to look at
lol
@ornate patio show where ur code is bad
How could I store a string variable in a door? The door has to store a certain ID
where is my code bad lmao
ok here i'll show u something
the code in runLoopingTask is also unfinished
customblockdata
library
wait you can store data inside blocks
its a lib
hell yeah
you could do something like this
public abstract class Singleton {
private static final Map<Class<? extends Singleton>, Singleton> instances = new HashMap<>();
public static <T extends Singleton> T getInstance(Class<T> clazz) {
return (T) instances.get(clazz);
}
public Singleton() {
instances.put(getClass(), this);
}
}
and then just do ```java
Singleton.getInstance(YourSingletonClazz.class);
but it still requires you to create every instance once
it does not remap reflections had it print all the field names for the Container Class and got this in return. I'm curious if anyone here knows how to get the code and return types of these fields in a nice way It'd be a pain to just brute force it all with data collection from running reflection
ah thanks
do you hopefully understand my file structure
is there a way to make a honey block have the same knockback to a player as a slime block when pushed by a piston?
Hey, has anyone gotten EntityPortalExitEvent to work? It doesn't trigger at all for me if I try to push mobs through a portal
No comma
Also use preparedstatements
Also is this data accessed while the player is offline?
You can use pdc if it's not
for a really dirty solution, you could also make all your singleton classes have a no args constructor and make the getInstance method look like this:
public static <T extends Singleton> T getInstance(Class<T> clazz) {
return (T) instances.computeIfAbsent(clazz, (Function<? super Class<? extends Singleton>, ? extends Singleton>) clazz1 -> {
try {
return clazz1.getConstructor().newInstance();
} catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
throw new RuntimeException(e);
}
});
}
Then it doesn't require you to manually create every instance once. A better solution would be to define a functional interface to create an instance of your Singleton subclasses though
I still think that this is not a good idea btw
i feel like this is all really overkill ^
yeah i was planning to turn it into an interface
what
yeah it's a shitty idea and not worth it
but yeah, it would work fine though
https://paste.md-5.net/olusawezat.java
i just wish event listeners could be static
they can
also
. . .
but y
you're overcomplicating everything
yeah you need an instance of the listener anyway, to register it
thats my point
.
so its not possible
well the actual listener method can be static
im trying to make it as comprehensible as possible
anyone know any good server development servers? to collab/hire/help and get help
im more of a perfectionist
it just doesn't add anything useful
this singleton shite is not comprehensible
its just useless
YES I DO
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
where is the benefit in not creating an instance?
^ you end up creating one anyways
what would be an alternative to this then
im trying to keep each feature in its own class
Imajin and mfalex he is looking like me when i dont understand something
just
fricking
do it normally
i think i get overly obsessed over file structure lmfao
whats so hard abouyt that
i don't understand why needing an instance of your class limits you in any way
you can still use different classes for different things
?
people are telling me that my event listeners shouldnt be singletons
well you definitely shouldnt instantiate any of your listener classes more than once
they do NOT have to be singleton patterns
they should have ONE instance to be REGISTERED
then discarded
thrown away
no longer needed
You misinterpreted what I said I thought you meant your event methods were static and I just simply remarked that was useless
what if i put each feature in its own folder
and have a Listener, LoopingTask, and whatever else is needed in each folder
seperate files for each part
show your project tree
well its still WIP its kinda messy rn
its kinda long
cant fit the whole thing in one ss
doesnt look that bad
yall think this is good?
my brain hurts right now ill get back to this later
but lmk what yall think
you just didn't try hard enough to fit it into one screenshot lol
here's the full thing lol
I see PDC, I upvote
i use PDC everywhere
I use PDC to store terabytes of backups of my server inside the player's mainhand item on another server
super
I use my pdc to store players credit card information they used on the store to their Player Object
I also store addresses and other information I might need to access there
why not directly storing the player in the player?
player.getPersistentDataContainer().set(new NamespacedKey(this,"player"),DataType.PLAYER,player);
👀 What if you were to store a player in the player before you stored it in the player
hm
then you need another player
does anyone know when AdvancementInfo was added?
roughly
erm I mean AdvancedmentDisplay
Is there a way to get the location of an armor stands head?
there's getEyeLocation()
but not sure if that returns something useful if the head has a weird angle or sth
let me test it rq
I used that library you said and it works but the problem is it only stores the data in the bottom half of the door
are you talking about my lib CustomBlockData?
he is
I never thought of thinking of this, ty
yes
well a door is 2 blocks high. If you wanna get the data and you only have the upper block, simply get the data from the lower block?
If you have a door, you can get the blockstate and cast it to door. Then check if its the upper or lower half. if it's the upper, just get the data fro mthe lower one instead
okay i'll try that, thanks!
np
oh wait
the method is in Bisected
and it's called getHalf
it returns Bisected.Half.TOP or Bisected.Half.BOTTOM
basically just sth like this. Always gets the block's data, unless it's the "upper version" of a 2 high block - then it get's the data of the lower half
public static PersistentDataContainer getCustomData(Block block) {
if(block.getState() instanceof Bisected) {
Bisected.Half half = ((Bisected)block.getState()).getHalf();
if(half == Bisected.Half.TOP) return new CustomBlockData(block.getRelative(BlockFace.DOWN), this);
}
return new CustomBlockData(block,this);
}
whats the best way to make createItem / ItemBuilder methods
I would create a factory acting as a command object which creates the stack, whilst surely builders might be convenient ItemStack, and ItemMeta are both mutable so there's actually no real need for a builder/creator
Does anyone know how I can have text appear just above the hotbar?
Player::spigot
Player.Spigot::sendMessage and pass the type ChatMessageType.ACTION_BAR
Thanks I'll try that
what do you mean factory acting as a command..?
@FunctionalInterface interface ItemStackSupplier {
ItemStack getItemStack();
}
class DirtItemStackSupplier implements ItemStackSupplier {
@Override ItemStack getItemStack() {
var stack = new ItemStack(DIRT);
var meta = stack.getItemMeta();
meta.setDisplayName("Epic DIRT");
stack.setItemMeta(meta);
return stack;
}
}
//or just altho less reusable
private ItemStack createDirtStack() {
var stack = new ItemStack(DIRT);
var meta = stack.getItemMeta();
meta.setDisplayName("Epic DIRT");
stack.setItemMeta(meta);
return stack;
}
its a factory
however, if one of your modules depend on itemstacks you could easily depend on the ItemStackSupplier as a command object
yeah I used to do something similar but it just takes up so much space in the class
thats why I though maybe createItem was better and if so..
myeah, depends on what you define as better obviously
Of course but just a method which makes it simpler to create items change etc
but if you want as little code as possible, having many utilities and helpers might be the solution then
maybe its just me
yeah
well when you have an extracted method for the purpose of creating a stack you do at least make your code follow function abstraction hierarchy which is polite to the reader
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
So I have this getStringList which makes the lore for the item and could be changed in config.. However I cant use ChatColor.translateblabla('&', "") or replaceAll("&", "§");
you have to translate Each entry in the returned List
just map it with a stream
List<String> lore = getConfig().getStringList("lore")
.stream()
.map(line -> ChatColor.translateAlternateColorCodes('&',line))
.toList();
what method threw this?
your world's build height is set to 0-256
shouldnt be lol
how do i get it to wait for the Result
CraftChunk#getBock passes the NMS word's build height to the vaidate method
ive gone into spectator past -64
in the world
ew who didnt use import
if it says "must be between 0 and 256", then that's what the build height is set to for that world
helpful exception
neither 0 nor 256 is hardcoded in CraftChunk
thats the only line lol no stacktrace
.
what's line 71?
does not work..
deleting and regenerating the world didnt work, is it in server.properties or something
?
?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.
I am not sure tbh lol
oh i can use world.getMaxHeight and world.getMinHeight
yeah sure
s=s.replace("{lives}", Integer.toString(rs.getInt("L")));
You need to access the resultset through a cursor. Something like
while(rs.next()) {
String something = rs.getString("name");
}
will if work?
.getConfig().getStringList("items.teleportbow.lore").stream().map(line -> ChatColor.translateAlternateColorCodes('&,' line)).toList(); gives red under toList();
you cannot get anything from the resultset if you don't "move the cursor forward" t oat least the first result
Usage of API documented 16
then use a collector on the stream instead of toList
instead of toList(), use the generic list collector .collect(Collectors.toList())
toList() is java 16+
thank you that works very nice!
what is the best way of making all blocks of a specific type do something every tick (without searching the entire world for it)
have a set or list of all blocks where this block type is. add them in ChunkLoadEvent, remove them in ChunkUnloadEvent, and also add / remove them on blockplace / blockbreak
ok
should i store the location?
well in my case, the block type is generated by a different event than blockplace
does blockbreakevent trigger from decay?
no, there's BlockFadeEvent etc
one second, I can show you a list of all events that can result in a block disappearing
yeah
https://github.com/JEFF-Media-GbR/CustomBlockData/blob/master/src/main/java/com/jeff_media/customblockdata/events/CustomBlockDataEvent.java
https://github.com/JEFF-Media-GbR/CustomBlockData/blob/master/src/main/java/com/jeff_media/customblockdata/BlockDataListener.java
this should cover ALL cases where blocks somehow disappear / change into another block
In CB, we often don't have a choice. In this case, net.minecraft.server.world.level.Block is already imported so we can't import org.bukkit.block.Block
but yeah you're probably just running that code on a world that doesn't have a minimum coordinate of 0. That's why a method to get the minimum height was added (and you seem to now be using)
How do you reasonably do reflection with nms?
did the authentication servers just go down?
i still have internet, just says its unreachable
or did i just get banned
lol
xD
thats a nasty spike that just appeared in downdetector
that's why you should never quit the game lol
thats why i ususally use /reload confirm
wow i cant spell
ik
turn on offline mode, or turn off online mode? that is the question
very philosophical and stuff
Hmmm
chunks stay loaded
probably a hosting or routing issue
Core Backbone announced maintainence for exactly this time
so guess it was that
wait im stupid
it said 8 o clock UTC + 2:00
I read it as UTC 2:00
which would have been 10 minutes ago
?paste
i'm currently trying to get rid of NMS code wherever possible. Does anyone know if there's meanwhile a solution get the namespacedkey for a biome without NMS? Currently doing it like this https://paste.md-5.net/ebigejodot.java
that won't work for me
I need this to work with biome added by data pack
and the bukkit Biome is an enum
why does it look like that
so no way that this will work for custom biomes
thats terrifying
yeahh
resource pack lmao
anyways how do i force the horse into the pose
Could be the pose field on the Entity Metadata packet
huh
Very carefully
Sec. I'll peek at internal horse classes. I don't think that's something you can do with API atm
well i do have easy access to NMS
i've already set all that up
You can do EntityAbstractHorse#makeMad(), but that will play the sound as well
There is #stand() which is without the sound but it's private
But yeah, that's the method you want probably
i could use reflection for that if i wanted to
but yeah thanks
sure that'd be nice
There are probably some more API methods we can add in for horses
I might make a jira pull request to add navigation methods that just wrap NavigationAbstract
It's a common reason to use NMS
What its Jira?
Hey I'm trying to use the "libraries" setting in plugin.yml to add a dependency (stefvanschie's inventory framework) without shading it in.
plugin.yml:
libraries:
- "com.github.stefvanschie.inventoryframework:IF:0.10.6"
build.gradle:
compileOnly 'com.github.stefvanschie.inventoryframework:IF:0.10.6'
However, at runtime I get the error:
java.lang.IllegalArgumentException: class com.github.stefvanschie.inventoryframework.gui.type.util.Gui is not provided by class org.bukkit.plugin.java.PluginClassLoader
I'm not shading in the dependency using shadowJar as it says online I don't need to do that. Any thoughts as I'm a bit unsure of how the libraries feature works as there's not much documentation on it.
I have a feeling the library has to be in maven central.
And what about maven trying to find a local dependency on a remote repo?
?
you don't have it in your local repository if maven complains that it cannot find it remotely
For some reason its looking for my library module on remote maven
it's not in your local repository then. Or you fucked up your local repository path
?paste a new/clean server latest.log startuip. We want to see where it attempted to download teh library
I dont know how i check if intellij has the repository path?
Run this:
mvn dependency:get -Dartifact=com.jeff_media:MorePersistentDataTypes:2.3.1 -o
ofc replace the artifact string
if it says BUILD SUCCESS, its in your local repo
if not, it isnt
Lmao
alright doing it now
Shity maven shity life 😠
Not working
Not even detecting mvn command on terminal
But if do it via interface it works!!!
thats happened to me many times
restart IDE (if its integrated terminal) or restart terminal itself
if it didnt work just restart your pc it actually works for some reason
I dont know what the fuck happen because its a multi-module but when im compiling the shit looks for the module on maven remote repo
😡
I will invalidate cache
I'm using gradle tho why would this do anything:
Does anyone have the villager's AI when finding a workstation
it can navigate around obstacles pretty quickly
I need to copy paste that AI into my horse
and also be able to check if the block is reachable
Your server is downloading the library. are you sure your project is using the same version as you put in your plugin.yml?
pretty sure that message was for verano not you
Your error is being thrown here AutoTuneShopFormat.java:42
first and foremost
use implementation for libraries that you shade (not compileOnly)
which +(you'll need shadowJar to shade and relocate)
so here, IF dependency should be implementation
all I'm doing here is this
ChestGui gui = new ChestGui(6, "Shop");
its because it's not loaded in the classpath for some reason
If I use implementation surely theres no point using the libraries feature
wut
because the file size will be the same
you need to use shadowJar as well
but implementation is for runtime+compile time dependencies
aka libraries
he's using plugin.yml -libraries feature to download and load teh dependency on the server
I'm not shading it in because I have this in my plugin.yml:
libraries:
- "com.github.stefvanschie.inventoryframework:IF:0.10.6"
yes but there's issues with that
if some other plugin also uses that dependency you might end up with linkage issues
hence, shading + relocating would be much safer
I thought that was teh whole point of the libraries feature so plugins could have independant classloaders?
yes, you can make it work by using a hacky workaround tho idk if spigot did that
(ik paper did it)
yeah I thought you were supposed to use the library feature on shared librarys
Idk
let me test with spigot damn I thought I was using it im using paper let me check
Thats what its design was for
Definitely test on Spigot though.
hmm the dependencies' classloader is actually a child of the plugin class loader if I read that correctly
thats odd
Yes, from my understanding its plugin specific
Main of course 😛
ah nvm
im just built different then
PluginNamePlugin
Class<?> result = loader.getClassByName(name, resolve, description);
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java#122
Honestly, its PluginName
it doesnt prioritize
hold up
was this sarcasm
Class<?> result = loader.getClassByName(name, resolve, description);
it should be
(name, resolve, description, this)
why
Main is for applications. Plugins are extensions
@coral valve in case you use spigot, that is where the issue origins from I believe ^
oh k
tho I think on paper it might be fixed?
unsure
anyway shading + relocating is what I'd prefer regardless :3
yes
i'm assuming relocating is when you change the path of the library?
relocating refers to when you change the package qualified name during compilation
for instance
com.conclure.www
to
org.spigot.shaded.conclure
got it
where all classes from com.conclure.www will be relocacted to the latter
thanks
and this also means all other classes that import classes from com.conclure.www will be updated with the correct qualified name for each class they depend on
yee
Okay, I'll probably just shade it in. Is this an issue with spigot then. Well it happens on both spigot and paper. Is there anything I can do to get around the issue for my plugin or no.
yeah both spigot and paper
can you do sth like
sout(com.github.stefvanschie.inventoryframework.gui.type.util.Gui.class)
just to see
i used paper first and it broke
Where would I put this
onEnable
Alright I got this
@Override
public void onEnable() {
instance = this; System.out.println(com.github.stefvanschie.inventoryframework.gui.type.util.Gui.class);
System.out.println(AutoTune.class.getClassLoader());
...
}
I'll compile now and run
try to sout the com.github.stefvanschie.inventoryframework.gui.type.util.Gui.class.getClassLoader() maybe?
alright ill do that too
I see
then its IF's issue
@NotNull
public static JavaPlugin getProvidingPlugin(@NotNull Class<?> clazz) {
Validate.notNull(clazz, "Null class cannot have a plugin");
final ClassLoader cl = clazz.getClassLoader();
if (!(cl instanceof PluginClassLoader)) {
throw new IllegalArgumentException(clazz + " is not provided by " + PluginClassLoader.class);
}
JavaPlugin plugin = ((PluginClassLoader) cl).plugin;
if (plugin == null) {
throw new IllegalStateException("Cannot get plugin for " + clazz + " from a static initializer");
}
return plugin;
}
they use this
** if (!(cl instanceof PluginClassLoader)) {**
might wanna create an issue on jira for this actually
oh okay damn
Didnt convert the if classloader to string but
[14:47:58 INFO]: class com.github.stefvanschie.inventoryframework.gui.type.util.Gui
[14:47:58 INFO]: PluginClassLoader{plugin=Auto-Tune v0.13.2, pluginEnabled=true, url=plugins\Auto-Tune-0.13.1.jar}
[14:47:58 INFO]: java.net.URLClassLoader@6851978e
If you still want to see
thats on paper though
yes but paper hasnt fixed it either
create it on Spigot and it will also go into paper
okay
yeah
I have another question related to the libraries setting
I'm using mapDB as a dependency and its working really well. The only thing is the file size is like 12MB which is v big. If I try to use the libraries feature on spigot it loads mapDB's dependencies for every version like this:
https://paste.md-5.net/copiqedobe.md
I dont really need it because I'm just shading it in atm but not really sure why its doing that.
Unprotesting if you want I can report the issue for you, or well if you wanna report yourself :3
no you can I'm quite busy atm
👍
bump
let me know when you've created that issue and if you know anything about #help-development message
What methods do you usually create when you are doing a menu api? And what methods for a paginated menu?
get/setPage(), next/previousPage(), first/lastPage(), getPages()
Because im overthinking a lot what mehotds to include
Idk why it take too much for just thinking what shit methods writing
doesnt happen to you?
Also what's better comparing Inventory object or using holder?
Atm the im comparing full object
So in fact InventoryHolder is not use anymore
inventoryholder should not be used because it is not intended for API usage
Wtf is an InventoryHolder never touched it
if you were to read any of the screenshots i sent above
something that holds inventories
like a chest
I figured lmao I just realized how stupid my concept was
or furnace
^ You can instanceof check a BlockState to see if it's any type of InventoryHolder if you want
But a chest isnt an inventory?
why the fuck you type so fast
me?
choco
no choco

he even did this thing
choco types like a mad man
a very mad one
yeah

If i find choco on street i dont think it and i start running
* @param instance the instance to inject into
* @param configuration the class to retrieve the values from
* @param translateStrings if true, all strings will be color translated
* @param copyDefaults if a field is missing, the field's current value will be copied
* @param <T> the type of the instance
* @throws IllegalAccessException if an unauthorized access is attempted
* @throws IllegalArgumentException if the config is not compatible with the given instance
* @see ChatUtil#translate(String)
* @see KebabCaseConverter#fromCamelCase(String)
*/
@Unsafe(
{
"Uses reflection.",
"If a SecurityManager is in effect, this is likely to error."
}
)
public static <T extends ReflectiveConfig> void getAndInject(
@NotNull T instance, @NotNull ConfigurationSection configuration,
boolean translateStrings, boolean copyDefaults
) throws IllegalAccessException {
my docs >
would be cooler if you put some whitespace between your @'s >:/
what is a securitymanager?
I mean, yeah. It's purpose is to better enforce encapsulation, but yeah
Lmao im going to start coding again my menu api
me redoing my menu api for the fifth time until I stop going mad
simply bad coders
true
true
I'm a beginner
how
your codes pretty nice
lmao okay
imajin
What
It's probably all in Rust
i have a lot of open source projects
i mean if you really wanted to cant you just disable the security manager?
how did you know
Oh shity rust
Rust is goated shut up
goated?
mejor que todo
Oh
you have such a way with words ❤️
better what all?
better than all
wtf is the contract annotation
that makes sense
explain
its like a
contract
you give me null, i give you null
you put in good word i make worth while, understand?
@Contract("_ -> this")
vs
@Contract("-> this")
_ means any parameter
ah k
so whatever you pass, you will receive this
Oh hly sh** InventoryDraEvent doesnt have an slot getter :mad:
is it just a mark up
yeah
ahh k
public void runLater(Runnable runnable, long delay) {
timer.schedule(new TimerTask() {
@Override
public void run() {
runnable.run();
}
}, delay);
}
should i use a timer or the scheduler here?
it's to run an async task later
acc i think i'll stick with the timer since i want it to be independent of bungee/spigot
@worldly ingot rate the code
not as shit as when i told you blocks could be null
Imajin do you know much about reflection with nms
😭 pain my pain continues
What diff between NMS and Packets?
what u need
I need to know how to reflect with remapped or if there is an easy way to get access to the method names I need when they are re-obfuscated
nms is the underlying server code whereas packets are just data that is sent/received from the client
NMS contains packets
I know what are packets i just didnt understand what was NMS
no shit 🤯
^^ that site has the remapped and obfuscated names
the actual server code
thaks
Because spigot works calling obfuscated methods from minecraft-server right?
u need to use it when doing reflection since the methods are dynamically loaded
it doenst only call, spigot modifies the server code
?stash
Oh ok
it also contains all the api
and spigot patches etc
generally its just a stash of the code 👀
what means "stash"?
how should ips be logged in a database?
It doesnt get translated
I save ips as List<String> on mongo
what abt sql
Synonyms that are closely related: Cache, stock, store
oh ok
mongo is easy cuz i can store it as a list
you should use relation
ok ty
you ill have to do smth like this:
ips-table:
- id => AUTO_INCREMENT
- userId
- ip
When i saw that for doing simply things in SQL i need to do so much shit
I changed to mongo
this was what i had in mind already
thx
why does the ips table need an id?
i was thinking a users table
ID | UUID | NAME
and then ips table
ID| IP
so you will endupt with this:
Users table
| userID | uuid | name |
| 1 | uuid | name |
| 2 | uuid | name |
IPS
| id | userID | ip |
| 1 | 1 | ip |
| 2 | 1 | ip |
| 3 | 2 | ip |
| 4 | 2 | ip |
but why does ips need an id column?
No need for an ID at all. I see no rason for two tables
because you can:
ips => "SELECT * FROM ips WHERE id=SELECT * FROM users WHERE uuid=user uuid"
UUID is already a Unique key
What about saving multiple ips?
oh I see, you could have multiple IP's from teh same UUID
ID foreign key
So like this:
Users table:
- uuid (Primary key)
- id (Foreign key)
Ips table:
- id
- ip
Im not sure if called foreign key
I never learned tables links at all
https://www.diagrams.net/ - Its really useful
naming conventions go brrr
Yeja
Minion that for the ips?
https://dbdiagram.io/ - I think this is better than the other one
Bukkit.broadcastMessage("" + uuid);
Player player = Bukkit.getPlayer(uuid);
Bukkit.broadcastMessage("playername: " + player.getName());```why it do that tho?
why?
why the heck split ":"?
HMN
hmn
what is line 62
Bukkit.broadcastMessage("playername: " + player.getName());
player is null
Send full command
cuz they're not online OR the uuid is wrong
only if it is a valid ONLINE player
i am online yes
or maybe
other person
If you are getting a uuid not connected you must use OfflinePlayer
And for online players just use Player
Do:
OfflinePlayer target = Bukkit.getOfflinePlayer(UUID.fromString("string of uuid"));
@humble tulip could fix what you need?
?
The relation
oh i'll figure it out
i remember learning about relations in ms access
Can i see sql?
everytime i try to rebuild my plugin artifact and load it up in cmd prompt it says there arent any plugins
send your latest.log
?paste
And is your jar in the plugins folder
Eh now it won't even run. Whatever, it's late, gn