#development
1 messages · Page 72 of 1
I found the issue, apparently ProtocolLib isnt updated for 1.20.4
I got the latest dev build and it works fine
ah yes, the fabled not using the dev build issue because plib decided that it wont update on spigot u till the bext version exist, so it doesnt update to 1.20.4 on the spigot page till 1.20.5 comes out such fun
it isnt even updated for 1.20
ah it doesnt update till the next major version
I merged 2 git branches recently and think I've broke something. I get this now, any idea why? I'm 100% sure I have the class in the project.
00:50:08] [Server thread/ERROR]: Could not load 'plugins\Helix-2.2.2.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.sniskus.helix.Helix'
My project is just compiling to 3KB now 💀. It's usually 1.5MB
maven? gradle? show pom.xml/build.gradle(.kts) and what file you're using
For some reason something with the project went wrong ig? I managed to fix it by pulling the data to a new project and just replacing the old one with the new idk.
Any Linux ( using CachyOS, a Arch fork) nerds here? Need some help with Graphics Drivers
Yet another question lol. Why do these not get replaced?
public static final String USER = "%%__USER__%%";
public static final String RESOURCE = "%%__RESOURCE__%%";
public static final String NONCE = "%%__NONCE__%%";
They still appear as %%__USER__%% etc
uhh
did you upload those as a premium spigot plugin?
Indeed
hm
I just get this in my console Licensed to %%__USER__%%. It is set with String#formatted if that would make a difference, which I doubt but still idk.
You have to be a buyer for it to work. If you download your own plugin it will not get parsed. smh
Well that solves that
Thanks lol
Bukkit.broadcastMessage(players.toString()+"hi");
players.remove(victim);
Bukkit.broadcastMessage(String.valueOf(victim));
Bukkit.broadcastMessage(players.toString()+"serf");```
Why doesn't the victim get removed?
Everything other than the first line doesn't even run
but if I remove the 2nd line the other lines are fine
Any errors? I assume so. Also, what is players? A list?
No errors I could see but I forgot to check console
That’s the code
Since I can’t send files here
And any errors? There should be. Code can’t just stop executing itself without reason
Not home rn when I get back I’ll check console
How does Spigot parse commands? To me, it seems that it splits at spaces and ignores any empty values. So something like command.split("\\s+"); and ignoring the first element if it is empty. Am I right here? I couldn't find the code for this.
https://pastes.dev/S8YBGmpBXL any of this helps?
Yeah. Thanks.
on interact event listener -> check if its the specific block/npc/whatever -> send message
no thanks needed
If you're looking for plugins and not making one yourself, see #general-plugins and #1007620980627230730
no
The link does not work for me lol, happy you solved it at least
Anyone know why my IDE says EntityMountEvent is a thing but when loaded into paper it says it doesnt exist? My versions match.
doesn't sound like versions actually match
I googled it, ig its cause I am importing spigot yet running on a paper server
and paper has a different event
so yeah...
literally just ```java
@EventListener
public void onMount(EntityMountEvent event) {}
what's the fully qualified name of the event?
and what's the exception?
and what's the build you're running?
bruh
Hi everyone! I once again had an issue with gradle related to using paper-api while compiling for java 8. Setting the toolchain to java 8 results in this annoying message:
Now ofc I tried to set the toolchain to 17 but set source and target to java 8, which doesn't work, because the toolchain sets the -release flag.
i dont think u can use j8 target/source since paper 1.17 or something
HOWEVER, I noticed that I am lucky, as my project is written entirely in kotlin, and I was able to convince gradle to ignore its stupid limitations on using different source/target and actual JDK, as it seems. I have set my build.gradle up like this:
tasks.withType<JavaCompile> {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(17))
})
}
tasks.withType<KotlinCompile>().configureEach {
this.jvmTargetValidationMode = JvmTargetValidationMode.IGNORE
}
the toolchain for kotlin is set to 8 though
and it seems to be working???
so now I obviously wonder how one can achieve that if one wouldn't happen to be using kotlin
because this thing is supposed to run on 1.16.5 as well for all those lazy people 🥲
why is it using 1.20 dependency then 🤨
well I need 1.19.4 API when the server is running 1.19.4+
or whenever display entities were added
oh
if it's running 1.16.5 I will never encounter display entities so it's no problem
(at least I don't have to deal with 1.8)
No discords fixed lol, its still broken. Delete the space between the // and the word mc if u want to see it
(Using TriumphGui) is there any way to update an item when it's clicked on? This is my current code lol
I want to update placeholders on the item, which isn't an issue but not sure how it should be done here
ItemBuilder.from(item).build() on the updateItem, you want to update just the itemstack
And that doesnt override the event?
Ah nice, thanks!
So that's the only difference between setItem and updateItem?
That it doesnt override the event?
setItem takes only a gui item and only updates when you call update to update the entire gui
While updateItem immediately updates an item or the item's itemstack
wait so if I get the item I want to update and it has a placeholder in the lore (PAPI for instance), when I do this it will update it or...?
It'll update the item with the new ItemStack you give it, nothing more to it
oh ok
Ah I see, what exactly does update on the gui actually do though? It can’t update placeholders etc without having the original item stack
it updates any slots if the return of GuiItem::getItemStack has changed since the last update
and you can always look at the source code
https://github.com/TriumphTeam/triumph-gui/blob/master/core/src/main/java/dev/triumphteam/gui/guis/BaseGui.java#L452
and it calls Player::updateInventory for all viewers but idk what that does
Hello everyone! Currently, I am looking for a developer who would be interested and available to write a plugin for us. In essence, it shouldn't be too difficult as it only involves the following: A chest (added through ItemsAdder) that can be randomly found every 4000 blocks in a specific world. These chests spawn randomly on the ground and visually stand out due to the pre-existing texture that we have and will be added thrue Itemsadder as well. When opened, an inventory should appear containing three types of rewards. In the second row of the 27 slots, a specific item (ItemsAdder) should be found at positions [3] (so 12), [5] (so 14), and [7] (so 16) Slot, always the same. The first contains an item from AdvancedEnchantments (only place the item inside, the rest is handled by other plugins). The second adds experience points to the player from Alonsolevels when clicked (via command solution), and the third is a command run from the plugin named "coins" (/coins drop @nearplayer 100). After everything has been clicked, the chest should automatically disappear immediately.
Would love to hear from a Dev! I will pay for it as well, if its working correctly! Thanks! ❤️ (I dont know where to ask, so if you know a place, please let me know!)
#1191515716608868402 or #1191515713022738634 are your best bet
Thanks!
hi. there is a library called SlimJar which loads external libraries in runtime. I would like to know how can I implement this into my program and make it work?
I've tried using it, but It's little bit confusing for me, so help would be appreciated!
@SneakyThrows
public static void main(String[] args) {
val libsPath = new File(".", "libraries");
if (!libsPath.exists()) if (!libsPath.mkdir()) {
log.error("[ERROR] Failed to create libraries folder.");
return;
}
val url = new URI(SimpleMirrorSelector.ALT_CENTRAL_URL).toURL();
ApplicationBuilder.appending("MyApplication")
.downloadDirectoryPath(libsPath.toPath())
.mirrorSelector((a, b) -> a)
.internalRepositories(Collections.singleton(new Repository(url)))
.build();
// ...
}
Stacktrace: https://pastes.dev/XvlMoolHHY
Ohhh yeah thanks!
hello, do you know how to make deluxe menu remove a non-vanilla item from a players inventory?
Remove the try catch altogether
It errors and I was testing why it errors but it's not displaying the debug output.
Can you send the error?
When I get back on PC.
It's IllegalArgumentException: wrong amount of arguments
Stems from the invoke method from reflect. But I don't understand why the line that causes the error, when enclosed in a try catch, doesn't invoke the catch portion.
Can you send the whole error
When I get back on PC.
Nah changed "causes the method" to "causes the error"
I'm trying to get the error to happen now. Like I said though its rare so I have to keep restarting the server until it occurs.
Slimjar has been pretty much abandoned iirc but spigot has added a libraries feature and you probably have fork slimjar (or use an existing fork if one exists)
If you're on 1.17 or above tho I'd use spigot libraries
do you know any library similar to this?
If only the authors would revive the lib 😔

wdym
Just joking because it was a friend and I who made it
Yesm, but we haven't had time to update it
🤦 Multi methods with the same name CraftChatMessage.fromStringOrNull(String) & CraftChatMessage.fromStringOrNull(String, boolean)
wow... that's so nice
so you definitely know how can I use it right?

My classic “idk how!”
Your plugin / expansion shade PlaceholderAPI. Here's how to fix that:
- For Maven, set
<scope>toprovided - For Gradle, use
compileOnlyinstead ofimplementation
I'm trying to figure this spigot library loader out. This is my plugins.yml. Though despite that the console appears to be importing the correct dependencies it is not working correctly. My Reflections code has just stopped working? It can create an instance without problem but it does not find classes as it used to, I'm using Reflections#getSubTypesOf(Class).
Previously it found a bunch of classes, now 0
I didn’t know that spigot had a library loader omg, that’s really cool
It's legit just this @rugged bane lol. Put the dependencies under libraries and it imports them
Wow, thanks - I’ll check this out - does it pull them from maven then?
Yup. groupId:artifactId:version
https://www.spigotmc.org/threads/spigot-bungeecord-1-17-1-17-1.510208/#post-4184317 wow just saw this
Thank you, so cool to have this
It's great. My plugin was like 7MB before lol. Just import everything with this now and it shrunk to like 700KB xd
Omg 😂 my jar is around 3mb at the moment, it would massively reduce mine.
probably because the classes are loaded by different classloaders and getting subtypes of a class is generally just an ugly hack that shouldn't be used at all
It worked fine before using the libraries for some reason? I had them shaded in the .jar then. Also, how do you do it otherwise? I have like 300+ subtypes of a class that I need to load.
yeah when shaded it's loaded by the same classloader
spigot libraries have like a thing where plugins that depend on your plugin can use your libraries or smth
which might be why it has a diff classloader
but i know nothing about classloaders
some kind of registering all those classes at compile time is the only sane thing to do
also 300+ subtypes of a class 💀
Shouldn't ClasspathHelper#forPackage(String, ClassLoader) solve that?
probably, but it's still an ugly hack
It doesn't tho 💀
good
I have this TypeRegistry#register(Class), and all the 300 classes in a bunch of sub packages. I currently just get them with reflection and forEach them on plugin load. How do you mean I should do it otherwise?
dw abt it lol. I have good reasons
🔫 wat
heard of many people thinking they have "good reasons"
use e.g. an annotation processor in combination with a service loader or something like that
or generate code that registers them
so many options
Ok, well I a script engine with a bunch of different components. This one is super simple just to prove a point, but most are way more complex. How would I do it if not one per file? It'd be impossible to manage otherwise.
Aight, I'll look into some alternatives ig. Thank yu
I mean if you already have an annotation on all of those types, that should be pretty simple
I do. Just don't know a better way than doing reflections via sub types or annotation lol
just use an annotation processor to generate a source file that registers all of the classes, and call that generated file from one point in your plugin
to generate code you can use something like spoon or javapoet
That seems like a hassle compared to ```java
Reflections reflections = new Reflections(this);
reflections.getSubTypes("com.sniskus.helix", ComponentType.class).forEach(TypeRegistry::register);
Btw. Is my reason for 300 classes good enough lol?
it's not even basic java reflections, it requires scanning the jar file I guess
I don't know enough about what you're doing, but if it's something complex, there might not be a really better way
I did a wrapper class for Reflections since I found it easier and it allowed me to do more niche methods, like this. So it applies the ClassLoader automatically etc., idk it seemed easier.
Yeah I haven't been able to come up with one at least. It something akin to how SkriptLang or Mythic does it. So you need one file per type.
Is there a method to collect an entities equipment to be used in the PacketPlayOutEntityEquipment packet?
I see getItemBySlot() but its individual items.
The packet requires List<Pair<EnumItemSlot, ItemStack>> Just hoping I don't have to build the list myself.
if you need all slots, loop over the enum's values
but, there is API for that, just sayin
Player.sendEquipmentChange I believe
This channel is for development support not config help as per the channel topic
Suggest checking out #general-plugins or #1007620980627230730
ok ty
I have the following HTML template (with TailwindCSS):
<body class="min-h-screen min-w-full flex flex-col">
<header></header>
<main class="flex-1 grid grid-cols-3">
<section class="col-span-1 max-h-screen min-h-[40rem] overflow-y-scroll overscroll-auto">Projects</section>
<section class="col-span-2 max-h-screen min-h-[40rem]">Projects Overview</section>
</main>
<footer></footer>
</body>
What I want to achieve is make the sections have a height of 40rem but if the height of the screen is higher, make it take up the entire space remaining. The problem with max-h-screen is that I have a header and a footer that it doesn't account for so the page ends up taking more than the screen.
(don't mind the data 😄. it is generated using a faker library)
EDIT: After many retries with ChatGPT, I've found a solution that in my tests seems to work:
<body class="h-screen w-full flex flex-col">
<header></header>
<main class="flex-1 grid grid-cols-3">
<section class="col-span-1 max-h-screen overflow-y-scroll overscroll-auto"><div class="h-[40rem] flex-grow">Projects</div></section>
<section class="col-span-2 max-h-screen"><div class="h-[40rem] flex-grow">Projects Overview</div></section>
</main>
<footer></footer>
</body>
Do I understand all the changes and why they were made? Absolutely NOT! Do I have the patience to try and figure it out? Absolutely NOT! But at least it works :))
so, the server code for the lore for attack-damage and speed is here
yet when I modify the base value of the attribute, the lore wont change
any ideas?
checked via /attribute command, it is applied correctly.
You probably have to add a new attribute instead of modifying the exiting ones
the attack speed, well, works
if base is modified
but not attack damage
mc spaghetti code strikes again
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/attribute/Attribute.html#GENERIC_ATTACK_DAMAGE
If that's the same attribute, here it says "attack damage of an entity"
declaration: package: org.bukkit.attribute, enum: Attribute
well, attack speed says that too
/attribute M0dii minecraft:generic.attack_speed base set 0
but it does modify the lore
Interesting
Very confused why GSON can't serialize this correctly GSON.toJson(plot.getSettings())
public Map<SettingIdentifier, PlotSetting> getSettings() {
return settings;
}
SettingIdentifier: https://paste.helpch.at/ikucisugin.kotlin
PlotSetting: https://paste.helpch.at/jevuciqisu.typescript
Output: https://paste.helpch.at/nidefifiqu.json
Error: Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 2 column 4 path $.
I mean that's most likely not what you want the serialization format to look like
gson doesn't know how to serialize it for you, it just tries its best
in that case, that means calling toString on the keys
https://stackoverflow.com/a/68031003 see the comment too
you probably want to seralize a list of entries
that's probably a better idea, yeah, it will probably look like this I think
[
{
"key": { SettingIdentifier object },
"value": { PlotSetting object }
}
]```
Ah yeah that's probably a better idea
Can I just call plot.getSettings().entrySet() u think?
Try and see
It just serializes them as empty sadly
just write a custom type adapter I guess
This actually worked, without using entries at all, thanks!
what does the output look like?
Interesting
Wait I'm actually kinda dumb tho lol
Or idk
PlotSetting has an instance of SettingIdentifier, which is also the key
So it's kinda stored twice
yeah I was about to say xD
Should I make it a set instead? The issue is just it will be slower to make lookups
I would make it smth like Map<MemberType, Set<SettingType>> and keep in the set only the settings they have access to
one problem at a time 😆
Try to use adventure if you can, bungee chat api is shit
If you must use it ... try &xFFF000 or &x&F&F&F&0&0&0
what is adventure?
the thing is, it works normally when used as sendMessage() etc, but when adding that exact code to a variable, the whole plugin crashes
basically the standard nowadays
where you go on a magical journey to fight the almighty boss dragon
no way I'd have to go outside to do that
😂
I'll keep it in mind. However since I'm doing packet based entities I would need api methods for all the needed packets (Spawn, Destroy, EntityData, Teleport, Armor, Move etc...). Otherwise its just easier to construct the packets myself.
I want to create a function like this: foo -> foo.bar(baz.get());. However I don't want it to call baz.get() when I create it. Is this possible somehow? I only want to call it when the function itself is ran.
Bruh I'm dumb
it won't get called when the function is created
I realised 💀 I thought it did since I thought the only time the baz.get() would crash is if it is called when created. Turns out my code sucks and it crashes when the function is ran lmao
What's the easiest way to add a cooldown for a command? Or what would you guys recommend? Is there some kind of map or class made for it already? Or should I just add some Map<UUID, int> with the value as time remaining
That will do the job
It will indeed, but would be nice if I didn't have to manually handle a runnable for it
you can avoid a runnable and just store the timestamp of when it was last run
and then if another attempt is made, just check then if it is allowed based on the previous timestamp
this way you can avoid constantly deleting old entries from the map
Very true, is comparing time stamp faster or slower than using a runnable u think?
i think the performance impact will probably be negligible either way
True but still
but if anything comparing the timestamp is probably better tbh
well, when they execute the command you still need to check if they are on cooldown or not
Just trying to optimize performance wherever I can
if you really insist to delete expired cooldowns, you can try to use a Cache from guava
like this is literally a single math operation, not exactly cpu intensive
I could actually have the Map<UUID, Timestamp> where the time will be for example 1 minute in the future, for faster checks
I think? lol
if you want you can do that sure
again i think at this rate it's really not going to make any difference
just do the thing that seems the least complicated / confusing to you
Someone else made some calculations a while ago and like 1M doubles are a few mb or something
Yeah ik, but I hate using code that can be optimized even if the difference is negligible
you better start hand writing bytecode then
gotta get every last bit of performance amirite
don't optimise prematurely 
<UUID, Instant> and use Instant.now() or <UUID, Long> and use System.currentTimeMillis()
Instant is nice because of all the utility methods it has
i usually system.currentTimeMilis but idk the tradeoffs of it vs instant
I usually store the expiration time and I just do if currentms < expiration then still on cooldown
isBefore, isAfter, atZone, minus, plus, Duration.between, etc
I'll use this resetCooldowns.put(player.getUniqueId(), Instant.now().plus(1, ChronoUnit.MINUTES));
And then check isAfter() before running the command
looks good
Uh, shouldn't you be storing Instant.now() then checking later? With that you're storing the time they ran the command plus 1 minute
So one minute after they ran it
yeah he's doing what gaby is talkin about
ig the command has an 1m cooldown
storing the expiry time
i do agree that storing the current time is a bit more convenient / understandable though, at least imo
true that
especially if you want to juggle multiple abilities on the same global cooldown or something
usually people store the time the X was used
yeah
How would I check the amount of time between two Instants? There's compareTo but that won't really help I think?
But yeah storing the time when it was executed might make more sense
It will be slower though, because I have to add 1 minute every time the command is called to check, instead of just isAfter, but yeah kinda no difference
matt mentioned Duration.between
ofc
hi, im trying to adjust Statistic#TIME_SINCE_REST for players so that phantoms cant spawn
whats the best way/duration to check & update? unfortunately PlayerStatisticIncrementEvent doesnt fire for it as its too frequent
or, would just staying with my current method be better/more cost efficient:
@EventHandler
public void onCreatureSpawn(@NotNull CreatureSpawnEvent event) {
final Entity entity = event.getEntity();
// Check if Phantom
if (entity.getType() == EntityType.PHANTOM
// Check if natural spawn
&& event.getSpawnReason() == CreatureSpawnEvent.SpawnReason.NATURAL
// Check if any nearby players have phantoms disabled TODO: Find a better way to do this
&& entity.getNearbyEntities(10, 35, 10).stream().anyMatch(nearby -> nearby instanceof Player && new EntityData(plugin, nearby).has(PersonalPhantoms.KEY))) event.setCancelled(true);
}
```*`new EntityData(plugin, nearby).has(PersonalPhantoms.KEY)` checks if player contains a specific PDS key, however in the future its going to be using SQL*
What is wrong with paper-plugin.yml. I can't register command for some reason
Btw srnyx there is a gamerule to disable phantoms at all if thats what you want to do
Also https://jd.papermc.io/paper/1.13/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.html this seems like a more suitable event for you 
im making it per-player; https://modrinth.com/plugin/personal-phantoms
thats paper only tho right?
Yeah, but at least you have a more direct approach for paper xD
true
do u know of a good example of a plugin that supports spigot but uses paper methods?
if (server is running paper) register paper listener
else register spigot listener
TRUE
There is PaperLib, made by the paper team, if you need stuff like async teleports. They have a method to check if the server is running paper, which just checks if the PaperConfig class exists 
👍 ty
lmao this is not it 💀 https://paperlib.app/en/
An open-source and simple academic paper management tool.
yeye ty
Regarding your question, I would set TIME_SINCE_REST to 0 on join and when they activate the option (if that's possible) and then set it to 0 every x minutes or so
, that might not even be needed if you can do it the first two times
itd be needed cause it only takes 1 irl hour before they start spawning
Ahh, yeah, for some reason I was thinking about 3 irl days, not in game days
lmao
By doing that you dont event need to use the paper event
for the "every x minutes or so", id just have 1 runnable that checks every online player right? or would 1 runnable per player be better
You know how often needs to be set to 0
Is just a method that loops over all online players and sets a statistic to 0
well itd have to check if player has phantoms disabled first
alr cause my other idea was to just have a runnable if the player has phantoms disabled
On the loop you can do all the checks you need
Most likely
yeah you dont need a runnable for each player lol
at some point that would make it worse than having a single one
Wait what streams are slower than normal for each etc?
How come?
even if they were literally just an object wrapper around a loop there's still the overhead of creating that object
except thats not what they are because you also need the parallelism and laziness semantics
typically the JIT will have a harder time optimizing streams than optimizing loops
and for small amounts of data it's usually not a big enough difference to matter
^^ this too
Alright so it's still good to use lol
I just think it looks nicer and is easier to use
yeah i mean
my philosophy is usually just use whatever is easiest/most readable and then optimise later if necessary
i say "my philosophy" as if that's super unique lol, that's how most software development works lol
I see, but in the case of minecraft plugins, isn't performance almost always the most important thing?
If you loop over a list with 100 elements, you won't even see the difference 
yes and no
0.05s or 0.06s (made up numbers) is the same thing
i would still say good design is more important
because good design also makes optimising easier
premature optimization is the root of all evil
true...
Ah yeah makes sense
I think I focus a lot on optimizing too much lol
do any streams get turned into for loops by the compiler? Like simple ones collection.stream().anyMatch(x -> x > y)
unlikely
well
definitely not AOT
javac does basically no optimisations
except extremely stuff like constant folding
the JIT might be able to do something like this but im not qualified to give an answer on that
the problem is that the stream api is pretty heavy in terms of types and methods, so to really reduce it to a loop would require much inlining and type analysis first
fair enough, I was just curious what sort of optimization is done for streams 
and it also depends on the stream source
yeah even with seemingly simple stuff like this there's a lot of assumptions
unless you were to hardcode some rewrite rules for the stream api in particular
I see
Got a very simple question that I should probably know the answer to lol
InteractableItem finalTemplate = enchantTemplate;
if(!(enchant instanceof ProccEnchant)) {
List<Component> newLore = new ArrayList<>(enchantTemplate.getLore());
newLore.removeIf(c -> MiniMessage.miniMessage().serialize(c).contains("chance"));
finalTemplate.setLore(newLore);
}
return finalTemplate;
Does this also change the lore in the enchantTemplate instance? Or is finalTemplate made as a copy of enchantTemplate? Because that's what I want to do
both variables reference the same object
So I need to make some InteractableItem.copyOf() method right?
It was immutable before, but ran into issues with the constructors lol
i have only seen like 10 for loops at my work codebase of like 100k+ lines of code
though we mostly handle 1000s of data
Yeah this fixed it
public static InteractableItem copyOf(InteractableItem other) {
List<String> lore = other.getLore().stream().map(line -> MiniMessage.miniMessage().serialize(line)).toList();
return new InteractableItem(other.getMaterial(), other.getName(), lore, other.getLocation());
}
based
return a.stream()
.map()
.blah()
...
is way cleaner than
var list = new ArrayList<>();
for (x : otherList) {
...
}
return list;
you are lying
i am lion
🦅
Crazy
java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.expansion.PlaceholderExpansion.getPlaceholderAPI()" is null
Your plugin / expansion shade PlaceholderAPI. Here's how to fix that:
- For Maven, set
<scope>toprovided - For Gradle, use
compileOnlyinstead ofimplementation
hello, would someone please send me a basic menu? to the deluxe menu
no
Anyone know what the best way is to cancel fireball interaction? Tried EntityDamageByEntityEvent and it doesnt work
ProjectileLaunchEvent or PlayerInteractEvent
tried ProjectileLaunchEvent, it completely disables the spawning of the fireball which isnt what i want and Interact events dont work either because fireballs are deflected by attacking, not right clicking with them
oh you mean that kind of interaction
playerinteractevent also supports left click though
but
theres like playerinteractatentityevent or smth
how am i going to detect if the player has interacted with a fireball with just the click actions
https://i.gyazo.com/751391e26c70e568aad5cc1a40aa2c94.png PlayerInteractEvent
ItemStack#getType == Fireball
im trying to stop fireball deflecting, that wouldnt work because its an entity
and not an itemstack
oh then
its either PlayerInteractAtEntityEvent checking entitytype or potentially entitydamagebyentityevent
dont think there are such methods
look at this screenshot
entitydamagebyentityevent doesnt work either ive tried
event.getRightClicked().getType()
fireballs are not deflected with right click...
that method is only in the PlayerInteractEvent
and no it wont work
getAction is just to get the action of what the players doing, like left click right click etc
but you cant get any entities from that
lol
I dont know, i have the event cancelled but the fireball is still deflected
@dusty frost @rugged bane any of yall have used nginx for laravel?
I'm trying to serve my page from a different route but it doesn't seem to work.
What I want to achieve is:
My project dir is, ex. /var/www/html/myproject and build dir is /var/www/html/myproject/public.
I have a subdomain mysub.domain.com.
I want to serve that project from:
mysub.domain.com/myproject
and all the other routes to be handled mysub.domain.com/myproject/home, etc.
Been fiddling around with apache, got tired, tried with nginx, no luck.
Mainly getting FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream - File not found, 500 or 403's lol
Laravel doesn’t like sub folder routing
Uh, honestly I just usually use a Docker container running php-fpm and then I just reverse proxy it with Nginx.
Then that way it's invisible to Larvel that it's in a subfolder, besides the root url being prefixed or whatever
and + nginx isn't so directly tied into your app, it is just doing its job as a general reverse proxy
# sub_directory
location ^~ /sub_directory {
alias /var/www/choppies/sub_directory/public;
try_files $uri $uri/ @sub_directory;
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_param SCRIPT_FILENAME /var/www/choppies/sub_directory/public/index.php;
}
}
location @sub_directory {
rewrite /sub_directory/(.*)$ /sub_directory/index.php?/$1 last;
}
# end sub_directory```
This looks like your best bet if you want to use fastcgi and nginx directly
obvs change the file locations and everything
yeah I have noticed lol
uh idk, I dont feel like playing with docker, but seems like that will be my best bet
this is pain
yeah I think I tried something like this
fastcgi_param SCRIPT_FILENAME /var/www/choppies/sub_directory/public/index.php; this line is probably the most important to you
if you're getting "Primary script unknown" and everything
does /path and the directory name have to match?
I mean it seems to kinda work, but
lovely
Completely new to kotlin, what happens if the null safe call is used ?. and the object is null?
Is the method just not called?
yep
Like
if(object != null) {
object.callMethod()
}
if you do val thing = otherThing?.someProp?.someStuff
thing is null when otherThing, someProp or someStuff is null, without throwing any NPEs
Yeah makes sense, thanks!
np
That's actually a nice feature
Wait so Kotlin doesn't have NPEs at all?
Looks like it can't compile instead of just giving a warning
if you do otherThing!.someProp it throws one
or some similar syntax
Ahhh I see
you're doing that with methods or
Isn't this isOnline call a bit redundant? recipient is just an OfflinePlayer
if(recipient.isOnline) {
recipient.player?.sendMessage(
But if this is called on an offline player, isn't it just null? recipient.player
should be
There are a few cases when they can happen Java-style but otherwise they’re delegated entirely to compile time
you can have a npe while using !! or lateinits
but if you manage it properly its compile time
That's actually nice to have, do you use kotlin mainly?
Or idk, it kinda makes it more difficult to debug imo
I see, nice
check stuff like .let etc
for example
val obj: Object?
obj?.let {
it.foo()
}
Not really sure what that would do? If obj is null it runs foo?
the opposite. if obj is not null, it will do everything between {}
and you can get the non null obj as it
That example isn't very good because it'd be the same as obj?.foo()
let would be more useful for things like
obj?.let {
println(it)
}
Basically print if not null
obj?.let(::println) 😌
How so? If something is nullable and you don't handle it you'll have an error right there without needing to boot up the application to test
How?
Probably like 50/50 but I don’t do a lot of either anymore
Lateinits don't throw npe iirc
ya they throw another exception but its functionally the same
Yes, with a message that is a lot easier to debug (for me)
ya, agreed just wanted to point that its effectively a npe (and most likely a code smell)
anyone worked with folia schedulers? if yes can i get a dm? dont want to spam here
This channel's entire point is to talk about that sorta stuff
alright: im making a small wrapper for the folia schedulers so i can use suspend functions
looking through couple libs people made i saw "force waking" of schedulers on enable
are they not enabled by then? or is it just redundant
Doesn't PaperLib support this?
im assuming the region ticking is not started by then or something, but testing is a bit inconclusive
FoliaLib*
suspend fun foo() {
runTask {
// this is now global scheduler
runTask(location) {
// this is now region scheduler
}
}
}
im doing something like this currently to make it a bit easier for myself, didnt find anything similiar
found https://github.com/Shynixn/MCCoroutine/blob/master/mccoroutine-folia-api/src/main/java/com/github/shynixn/mccoroutine/folia/SuspendingJavaPlugin.kt, they hijack the server heartbeat on line 35 to force awake the schedulers hence my confusion
hey can someone ping me with an answer, why would a skeletons helmet randomly break
is it sunlight ?
Yes, sunlight decays skeleton helmets. Once it breaks it’ll start taking fire damage
ok, in 1.8.8 i can't set the armour to unbreakable so i set it to 32000 but even that wouldn't stop the helmet from popping
any advice
Use an update made in the last 10 years lol. I have no idea the capabilities of the API 10 years ago
except that you can
get the meta, set unbreakable flag
its meta.spigot().setUnbreakable() afaik
on 1.8
really! omg your amazinggggg
Is it possible to make player see like that (red lines at bottom and top) with or without server resource pack? https://imgur.com/a/fo4efzE
red?
dont give this guy drivers license
What do you guys think? A punishment plugin should listen to chat event with LOWEST/LOW priority in order to cancel the message as soon as it's sent before other plugins can listen to it, right? Or it's correct that it uses HIGHEST? I mean, otherwise all plugins listening to NORMAL or even HIGH will ignore "muted" players, what do you think?
highest is the way to go, punishment plugin gets the last word on what gets through that way
What about chat games, if they listen to NORMAL priority to act, how would muted players be handled if you dont want them to participate?
you could listen to both lowest and highest then
lowest to cancel early for other plugins
and highest to make sure it stays cancelled
in case another plugin is breaking convention and ignores cancelled/uncancels
what about plugins that "cancel" chat event to send json formatted chat
if already cancelled and they are not listening to cancelled events
lowest covers it already
i mean, for plain chat plugins, they just setFormat and setMessage
^
what about the plugins that cancel the event and send a json/minimessage message to add hover to chat
their events wont fire if you cancel on lowest
unless they are listening to cancelled events
in which case why
i know, but even if they "cancel" the muted player message
the plugin that cancel the event and sends the message would still send the json message
you are the one cancelling
not them
lowest hits - event is cancelled - json plugin is listening on normal - skips json plugin
they would have to be ignoring cancelled
lowest fires first, highest last
so if your plugin listens to lowest and cancels a message
anything after that is not "ignoreCancelled = true" will not see the event firing
yes, you didnt get my question
if that plugin listens on normal prio
which they should be
that plugins listener shouldn't even trigger at that point
cancelling on lowest will cover your case
since you came first and cancelled the event
if you wanna be uber safe, cancel the message packet
and no event will fire
but honestly its overkill
libertybans and advancedbans cancel muted players messages with HIGHEST
but my chat plugin (listening to NORMAL), ofccourse cancel the event too, but to send the formatted messages to all recipents
since muted player message is "cancelled" in HIGHEST, and my plugin listen to NORMAL, my messages will alwasy be sent, even when player is muted
so the question is, what should be done?
- Change my priority to MONITOR so the ban plugin cancels it first and then i check if cancelled or not
- i have no clue
order of fire is
MONITOR = fires last
and should not be used to mutate the event
ah, now i get it you are making the chat plugin
and not the ban plugin
- Change my priority to MONITOR so the ban plugin cancels it first and then i check if cancelled or not
this is the only way in that case
but its quite bad practice
as your plugin will mess with anything that actually monitors the event
thats what i meant
Lowest would be seen first.

i dont think there is an order to which plugin fires first
while they are the same prio
If it's same priority, it's based by dependencies then ABC order.
funny enough i think thats the cleanest solution
starting my plugin name with AAAAAAAAAAAAAAA to ensure priority

nono they need their plugin to run last, so ZZZZZZZZZZZZ
damn
not enough A's what if someone uses with more A's
had to make sure i didnt get got by barry
Do you want it ran last or first? If you depend it will run after the dependencies.
last
chat moderation plugins using HIGHEST for some reason so chat plugin doesn't know if it's cancelled or not unless it uses MONITOR
soft-depending to edge cases probably the "good practice"
I mean I think there is "loadafter" option but if other plugins use it too, it's the same issue.
or just go monitor and not care
soft-depend: ["AdvancedBans","LibertyBans","LiteBans","UltraPunishments","Essentials","¿CMI?","SomeRandomMutePlugin"]
my favourite ban plugin
do they all listen to HIGHEST? 💀
i hate essentials code
well
why is it always highest 🥲
i feel like mute plugins should use like LOWEST
wrap it again to show dominance
or LOW or NORMAL or HIGH
My question is
as a fun silly thing, almost every popular spigot plugin is made not very well
shouldn't they cancel muted players in LOWEST or LOW?
luckperms 😌
maybe i'm wrong, but at least LOW, shouldnt it be the case?
lucko is the exception
i feel low is good no?
to be honest spigot's event priority system is the stupidest thing ever
why is it reversed 🧍
eh
i wouldn't say it's reversed
maybe ambiguously named
its reversed
debatable
if you task something as the highest priority task, that should come first, no ?
hahaha
debatableeee
nono they mean the ban plugins
dox the developers, send pizzas to their house telling them to switch the event priorities
wonder why 
:-)
Essentials is a mess, so i wouldnt change it
essentials has kind of meme commands
LibertyBans and AdvancedBans are open source
i feel doing highest as well as low/lowest kinda makes sense with how messy some plugins handle events
kinda like a sanity check
to see if any un-cancelled the message
i think we should go back in time and spigot event system
minigames plugins also modify chat
time to find more soft depends then
imo HIGHEST doesnt make too much sense
spigot should just add SUPER_HIGHEST
ez
pr spigot now
SUPER_SUPER_HIGHEST
i can see Essentials dev using Integer.MAX_VALUE

it definitely would
🔓 New fear unlocked.
i guess i'll just make it configurable
i dislike essentials but i dont like cmi any better
at least essentials rarely gets in the way
So I use this to convert a string back to UUID. Ex; The string provided https://api.mojang.com/users/profiles/minecraft/Notch ```java
StringBuilder sb = new StringBuilder(s);
sb.insert(8, "-");
sb.insert(14, "-");
sb.insert(19, "-");
sb.insert(24, "-");
it doesn't delete anything
Doing some more debugging one sec.
Parse the upper and lower 16 chars using Long.parseLong with radix 16, use those longs to construct a UUID object 
The good thing is you can test that independently from minecraft pretty easy
Yeap my bad wasn't deleting. Must have misread it every time lol.
8,13,18,23 is what I changed them to.
actually that's a good idea lol
something something https://dkomanov.medium.com/micro-optimization-for-uuid-fromstring-in-7-steps-277c9c72e982
I spent some time on optimizing UUID.fromString function and I want to share my experience about it. TL;DR — we will improve it’s…
luckily that's not the current implementation anymore
I wonder how often do people parse UUIDs from strings for this to become a big issue?
I mean that blogpost is kinda bleh, they write
Nevertheless, I believe that in such important frameworks (like JDK) everything should be optimized.
in their conclusion which just shows that they don't understand much about optimization
Only if I could react with a GigaChad 😭
I'm too scared to ask what is the right way to create a database entry using player's uuid as key
Binary
Just store the bytes directly instead of storing the hex representation as a string
:)
:)
Is it okay to use Aikar flags on a bedwars setup? will they make any change to the rendering and such?
they are fine
Invalid maximum heap size: -Xmx4G
The specified size exceeds the maximum representable size.
I have 16gb
PAUSE```
stop using 32 bit java
Is it possible to override a worldguard flag with my own? I've made a custom TREE_FARM flag which should allow players to break certain blocks (wood and leaves). But since the parent region (global) has block-break: DENY it doesn't actually allow the block to break. Do I have to prevent the cancelling of the event somehow or something?
Remove block-break and handle it on your own 
Based
I found a workaround by disabling particle effects
hey guys is there a way to install papi extensions from a plugin i am working on. i have added papi to maven and i also use it in my plugin already for chat placeholders and other stuff
how fix it
A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
What is "it"?
<version>VERSION</version>
VERSION is not a valid version, you need to enter a valid version in the version attribute
Quick question, what world does $newEditSessionBuilder().getWorld() return? Cause I am trying to paste a schematic using (FA)WE and yeah, there are several worlds and none is specified in the code below:
WorldEdit worldEdit = WorldEdit.getInstance();
try (EditSession editSession = worldEdit.newEditSession(worldEdit.newEditSessionBuilder().getWorld())) {
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(loc.x(), loc.y(), loc.z()))
.ignoreAirBlocks(true)
.build();
Operations.complete(operation);
}
null most likely
so how would I get the instance of the world I want to paste the schematic?
worldedit docs suck
lol
yes
Is just smth like BukkitUtil.wrap(World)
BukkitWorld w = new BukkitWorld(loc.getWorld());
you should use BukkitAdapter instead
oh ok
Yeah, it was BukkitAdapter not Util
Is it possible to make a sequence of placeholders with PAPI? I myself use %ph1(%ph2(%ph3(whatever)%)%)% etc. for my own plugins and want to know if something similar is possible in PAPI?
I know there are {bracket} placeholders but is it possible to go "deeper" than that?
just write a method that checks for such sequence and parses them down up, providing each result to upper one
There's this "utils" expansion that allows infinite nested placeholders
I'd have to %ph1_ph2_ph3_whatever% but that's kinda hard to read. Can't really think of another way though. With the other one you could do like %math_round(2 + %math_rand(0, 100)% * 100)% but now you can't really? Since you can't have additional % in the placeholder I need another char to match, like []. That'd make something like %math_solve_2+[math_rand(0, 100)]*100% but that's wonky imo.
Ahh I see, that's useful. Thank you
for math I suggest to use a lib tbh, I use EvalEx in one of my projects and it works fine
Well...before I knew about that I made my own 💀. I found one good but that costed money so I made my own. Also mine is more niched to my needs so I'll just stick to it lol.
They are not super different for number and boolean evaluations
What costs money? lol
The one I found before was this one https://www.mathparsers.com/math-parser-for-java/.
But that requires a license so I made my own. For what I do I prefer mine though, it does what I need better 🤷♂️
hey guys, im spawning alot of entities and im setting their meta data, but for some WEIRD ODD REASON, after a while they lose their meta data
any clue why ?
chunks they spawn in are loaded
any other plugins?
he used to be in this server btw
(kinda replying to gaby with him mentioning libs)
That's fricking blazing fast, like 50-100% faster than mine, which is like 3x faster than EvalEx. It's missing some niched stuff I need, which I could fix but meh I'll stick with mine in case I need to do some changes 🤷♂️ It's fricking fast tho
Forking is always an option for this. And if the performance is better and you actually need it, this might be a pretty good solution.
It looks like it has most basic math functions (sin, cos, etc.), variables, rounding, what else do you need?
I've heard of sin and cos but what is this "etc" function you're talking about?
end of thinking
lmao
smh Emily 
I saw it has a lot of functions but I wasn't sure about all of them
pretty much everything that java Math has
Any suggestions on backwards material support?
I originaly went the XMaterial route with my own spin and made a enum class of materials changed throughout the versions.
In another plugin I just wrote down materials and durability of the blocks I needed.
I would really prefer not to write down all legacy materials.
whats this ?
error
Javascript expansion error to be specific
Show the full code, my guess is that you want to use args[1] and not args1
Is it possible to somehow hide entities for specific players? I know about entity destroy packets but I want to show them again later. Can you do some entity render distance update or smth to refresh them?
I see
lol
barry is racist
I can tell
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#hideEntity(org.bukkit.plugin.Plugin,org.bukkit.entity.Entity)
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#showEntity(org.bukkit.plugin.Plugin,org.bukkit.entity.Entity)
declaration: package: org.bukkit.entity, interface: Player
also Entity.setVisibleByDefault could be helpful depending on your situation
Yup, thank you! I can’t read it appears lmao
Hello. I am looking for a library or just a repository of html elements written with tailwindcss that I can just copy and paste. I don't want anything that libraries like rippleui or prelineui offer where they give you custom classes to use.
Oh. Finally found a nice one: https://mambaui.com/
no, its args[1]
function handleGradient(type, args1, args2, args3) {
if (type.toUpperCase() === "HEX" || type.toUpperCase() === "RGB" || type.toUpperCase() === "DECIMAL") {
let hex1 = args1;
let hex2 = args2;
let lengthAndPosition = args3;
let length = lengthAndPosition.split(":")[0];
let position = lengthAndPosition.split(":")[1];
let r1 = parseInt(hex1.slice(1, 3), 16);
let g1 = parseInt(hex1.slice(3, 5), 16);
let b1 = parseInt(hex1.slice(5, 7), 16);
let r2 = parseInt(hex2.slice(1, 3), 16);
let g2 = parseInt(hex2.slice(3, 5), 16);
let b2 = parseInt(hex2.slice(5, 7), 16);
let RGB, HEX, DECIMAL;
if (position >= 2) position++;
for (let i = 0; i < position; i++) {
let ratio = i / length;
let r = Math.round(r1 + ratio * (r2 - r1));
let g = Math.round(g1 + ratio * (g2 - g1));
let b = Math.round(b1 + ratio * (b2 - b1));
RGB = r + ", " + g + ", " + b;
HEX = "#" + ((1 << 24) | (r << 16) | (g << 8) | b).toString(16).slice(1);
DECIMAL = (r * 65536) + (g * 256) + b;
}
switch (type.toUpperCase()) {
case "HEX":
return HEX.toUpperCase();
case "RGB":
return RGB;
case "DECIMAL":
return DECIMAL;
}
}
}
handleGradient(args[0], args[1], args[2], args[3]);
Hello folks,
I got my hands on an older plugin and was asked to maintain it or at least get it up to date.
My experience with plugins for MC is not the best out there.
The plugin initially used a ScheduledExecutorService() and now intellij is having issues with the imported java.util.concurrent.TimeUnit with java 21.0.2. It was not working with 17.x as well.
Is there another scheduled Thread that might be more common to use (and works) without the imported non-working TimeUnit?
Thx in advance
Idk did you try looking what params does it sccept lol
It needs a value from the TimeUnit-enum
that just sounds like your intellij setup is wrong
don't know how you managed to do that but you can try doing a cache invalidation
TimeUnit has been a thing for 20 years
Try to use a js syntax validator, idk
Can someone help me with this?
private static String getFormattedDate(long unixTime) {
Date date = new Date(unixTime * 1000L);
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd. - HH:mm", new Locale("hu", "HU"));
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Budapest"));
return sdf.format(date);
}
It doesn't return the correct timestamp
Last time I had to work with time zones I've used ZonedDateTime
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
Send the timestamp
Formatted Date in Hungary (Europe/Budapest): 2024-02-04 18:42:33 chatgpt code, works fine for me
import java.util.Date;
import java.text.SimpleDateFormat;
import java.util.TimeZone;
import java.util.Locale;
public class DateFormatting {
public static void main(String[] args) {
long milliseconds = 1707068553979L;
// Creating a Date object using milliseconds
Date date = new Date(milliseconds);
// Setting the time zone to Europe/Budapest
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new Locale("hu", "HU"));
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Budapest"));
// Formatting the date
String formattedDate = sdf.format(date);
// Printing the formatted date
System.out.println("Formatted Date in Hungary (Europe/Budapest): " + formattedDate);
}
}
Yes. But it doesn't on minecraft tho :/
Yeah yk what?
I noticed something you didn't do
but i did
You didn't multiply it so lemme give that a try
you multiply by 1000?
Yes yes
yeah
Well for that you need to divide
You divide by 1000 for ms to s, but Date uses ms
Man i was multiplying everywhere
Happens to the best of us
I wonder what the year is
, it can not be off by only 3 months
Year 56064 LOL
then another thing. How can i select something just by their month? so only those things appear which happened in this month.. Here is my code
private List<String> getPunishments(String punishmentType, String playerName) throws SQLException {
List<String> punishments = new ArrayList<>();
String table = "litebans_" + punishmentType + 's';
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE banned_by_name = ?");
statement.setString(1, playerName);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
String uuid = resultSet.getString("uuid");
String reason = resultSet.getString("reason");
String formattedReason = (reason != null) ? reason : "Indoktalan";
long unixTime = resultSet.getLong("time");
String formattedDate = getFormattedDate(unixTime);
String playerNameFromUUID = getPlayerName(uuid);
String punishmentEntry = "§8• §b" + playerNameFromUUID + " §8← §fIndok: §3" + formattedReason + " §8- §7§o" + formattedDate;
punishments.add(punishmentEntry);
}
resultSet.close();
statement.close();
return punishments;
}
the tables are litebans_kicks/bans/mutes and the time is stored in the same way. Unix timestamp in the time column
I mean i only wan't to display those that happened in the same month as the commands has been ran in
SO people say you should use the range instead of calculating the month for 100s of records
SELECT *
FROM litebans_kick
WHERE MONTH(timestamp_column) = MONTH(CURRENT_TIMESTAMP)
That's probably better yeah. Just calculate start and end of months in java and check if column time is between those times you've calculated
Can you do that for me? I am kind of a beginner in this
With a java Calendar and a date format of dd-MM-yy it is very easy.
- Get calendar and set date to start of the month
- Save the value in variable for lower bound
- Set the date to the last day of the month
- Save the value in variable for upper bound
Calendar.getInstance() has the current date and time, you only need to set the day to 1 and last day (iirc there is a method that sets the day, 31 for jan, 28/29 for feb, etc.)
I don't know if let is supported in the javascript expansion
I suggest you use var instead
don't remember what engine it uses nowadays
connection.prepareStatement("SELECT * FROM " + table + " WHERE banned_by_name = ? AND MONTH(FROM_UNIXTIME(time)) = MONTH(CURRENT_TIMESTAMP)");
It ain't workin 😭
Can someone help me with this?
send error
the table:
CREATE TABLE `litebans_kicks` (
`id` bigint(20) UNSIGNED NOT NULL,
`uuid` varchar(36) CHARACTER SET ascii DEFAULT NULL,
`ip` varchar(45) CHARACTER SET ascii DEFAULT NULL,
`reason` varchar(2048) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`banned_by_uuid` varchar(36) COLLATE utf8mb4_unicode_ci NOT NULL,
`banned_by_name` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`time` bigint(20) NOT NULL,
`until` bigint(20) NOT NULL,
`template` tinyint(3) UNSIGNED NOT NULL DEFAULT 255,
`server_scope` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`server_origin` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`silent` bit(1) NOT NULL,
`ipban` bit(1) NOT NULL,
`ipban_wildcard` bit(1) NOT NULL DEFAULT b'0',
`active` bit(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
INSERT INTO `litebans_kicks` (`id`, `uuid`, `ip`, `reason`, `banned_by_uuid`, `banned_by_name`, `time`, `until`, `template`, `server_scope`, `server_origin`, `silent`, `ipban`, `ipban_wildcard`, `active`) VALUES
(2, '42c031cc-9c0f-3785-837b-6c335176cf8f', '84.0.222.151', NULL, '42c031cc-9c0f-3785-837b-6c335176cf8f', 'barnixf', 1707068553979, 0, 255, '*', 'KitPvP', b'0', b'0', b'0', b'1'),
(4, '58fcd405-ac1e-3248-bcc5-a32f7efda198', '37.234.245.89', NULL, '42c031cc-9c0f-3785-837b-6c335176cf8f', 'barnixf', 1707070718189, 0, 255, '*', 'Lobby', b'0', b'0', b'0', b'1'),
(5, '59afb809-61f2-3663-be7e-6d6e81fd4752', '185.217.75.2', NULL, '9d6fd970-eaf2-3204-a748-55fe98b8b5f8', 'Barlangok', 1707078698154, 0, 255, '*', 'Lobby', b'0', b'0', b'0', b'1');
send code and then we can see what is error :))))
the code:
private List<String> getPunishments(String punishmentType, String playerName) throws SQLException {
List<String> punishments = new ArrayList<>();
String table = "litebans_" + punishmentType + 's';
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + table + " WHERE banned_by_name = ? AND MONTH(FROM_UNIXTIME(time)) = MONTH(CURRENT_TIMESTAMP) AND YEAR(FROM_UNIXTIME(time)) = YEAR(CURRENT_TIMESTAMP)");
statement.setString(1, playerName);
ResultSet resultSet = statement.executeQuery();
while (resultSet.next()) {
String uuid = resultSet.getString("uuid");
String reason = resultSet.getString("reason");
String formattedReason = (reason != null) ? reason : "Indoktalan";
long unixTime = resultSet.getLong("time");
String formattedDate = getFormattedDate(unixTime);
String playerNameFromUUID = getPlayerName(uuid);
String punishmentEntry = "§8• §d" + playerNameFromUUID + " §8← §fIndok: §5" + formattedReason + " §8- §7§o" + formattedDate;
punishments.add(punishmentEntry);
}
resultSet.close();
statement.close();
return punishments;
}
It doesn't return anynthing?
That is correct
db empty
send the line where you are calling #getPunishments();
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
It worked with this code
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
what happens when you send the command
what you see in chat
or maybe error in console?
2m
https://imgur.com/VR6VoRI
Only the requested punishment type's count by the user
username has overall 2x kick type of punishments executed
maybe try System.out.print()
where it outputs the data
it is good to do that for debugging purposes
yeah
pls results
it helps for me, you and mby others that may have the same problem
you know, helps gain more knowledge
yeah i know 1 sec
btw is there a way to save the plugin into a direct sftp folder?
is this the correct way
because it outputs nothing aswell
I get this, any idea why? Caused by: java.lang.RuntimeException: Error resolving libraries. This is the import it is complaining about com.github.Redempt:Crunch:2.0.3. Here are the relevant pom segments: ```
</repositories>
<repository>
<id>redempt.dev</id>
<url>https://redempt.dev</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Redempt</groupId>
<artifactId>Crunch</artifactId>
<version>2.0.3</version>
</dependency>
</dependencies>
Ping if you respond pls :>
try removing the https
edit: whyd i say this
All of these work tho
oh ok nvm them
Yeah no diff
idk why i said remove https
huh
my right hand was not in the right spot 🥲
I see lol
i meant to say that it should've worked with jitpack as well
whats the full error?
Frick
🥲
Aight shading ig
yepp
i dont think its a big lib though (31kb 😌)
(also for future reference plz post full stacktrace, as Could not find artifact com.github.Redempt:Crunch:jar:2.0.3 in central (https://repo.maven.apache.org/maven2) shows it's looking in central)
Yeah mb, thought it was some formatting or smth I did wrong idk? I'll post full next time :)
Btw my jar legit did not increase in size like at all lol
Hey I am trying to make a deluxemenu where the player has to hold a certain item to make it apply a modeldata.
This is what I created, but it currently only checks if the leather helmet is anywhere in the inventory. It has to be checking if its in the hand yes or no. Otherwise they can apply the modeldata to any other item, aslong as they have a leather helmet in their inventory.
material: LEATHER_HELMET model_data: 10001 slot: 13 update: true hide_enchantments: true hide_attributes: true display_name: '&dValentine Helmet' lore: - '&8Armorskin selecor' - '' - '&7Equip this skin to your tool by' - '&7holding the tool in your hand.' - '' - '&fApplicable Armor:' - ' &8▪ &7Leather' - '' - '&e➥ Left-Click to equip' click_commands: - "[givepermission] toolskins.admin" - "[player] setmodeldata 10001" - "[takepermission] toolskins.admin" click_requirement: requirements: points: type: has permission permission: toolskins.valentine.helmet deny_commands: - "[message] &b&lToolSkins &8&l→ &cYou do not own this skin!" item: type: has item material: "LEATHER_HELMET" deny_commands: - "[message] &b&lToolSkins &8&l→ &cwrong item!"````
That's more #general-plugins ig?
Hmm I tought it was development sorry
No this is more like actual coding :>
Like plugin development
Not server development
software development 
final Query<String> createColumn = plugin.dataManager.session
.createNativeQuery("ALTER TABLE " + table + " ADD COLUMN IF NOT EXISTS :key TEXT")
.setParameter("key", key);
ERROR: syntax error at or near "$1"
Position: 59
`createColumn.getQueryString().replace(":key", key)` outputs `ALTER TABLE annoyingapi_entities ADD COLUMN IF NOT EXISTS last_join TEXT` (position 59 is `last_join`)
where is it getting the `$1`? using hibernate
probably how it does parameters
so what can i do? 😭
it probably isn't something that is parameterizable?
like, if you're doing an insert or an update or a select then sure, you'd parameterize the values, but not the column names
its just a regular string
doesnt parameterizing prevent sql injection?
i mean, why on earth would your column names be configurable like that
parametization is used for values
a table or column name is not something that you can parameterize
https://stackoverflow.com/a/17510111
If you really want to have such a dynamic query, use the Criteria API, or some other way of dynamically creating a query.
https://docs.jboss.org/hibernate/orm/6.4/userguide/html_single/Hibernate_User_Guide.html#criteria i don't know how to use hibernate so good luck 
this is for my api, and im not sure if i or others will make the key a player input in some scenarios, so its better to be safe
since everything is dynamic (based on inputs), i cant use the object oriented part of hibernate (basically the entire point of it but oh well), so i cant use the criteria api
making an api around an api around an api sounds like you're doing something very wrong
just use hibernate directly, you will get the best experience out of it
especially if you use it properly
i just want to be able to say "heres a uuid, a key, and a value, now store it", and theres also all the server owner configuration i wanna have. so i think its better to basically have that all hidden/common behind my api/library/framework instead of having to remake such an integrated system for all ~15 of my plugins (pain to convert as well)
should i just ditch hibernate if im only using native SQL queries?
hibernate is what you use as an orm for you to have sql well integrated in your java codebase
you are basically skipping the good and useful parts of it entirely
yeah thats what i assumed, ill try without hibernate 😩
it worked :D
at least with my one test with postgresql
now i gotta find a way to somehow solve this 🙃 https://srnyx.is-from.space/explorer_UJTsRBQMBI.png
Are those 27KB or MB?
27 thousand kB
27K KB
A Mega amount of bytes
Okay that's a tad big
What is the 1.8.9 dependency for papermc?
There is no time to wait! Ask your question @polar crystal!
There is no 1.8.9 server
Only client
This is not discord support
?not-discord
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
ok
@stuck canopy https://papermc.io/downloads/all u can find it there (1.8.8) but 1.8 is a bit stinky
@stuck canopy maven dependency should still be online - look in paper 1.8 branch
On github
Alright, thanks
Currently editing a kotlin plugin (I have kinda no kotlin experience), is it possible to access the crate instance another way?
class Crate() {
val crate = this
private val blah = whatever.blah {
// This is in another class
crate.doSomething
}
}
this@Crate
i think
val crate = this is cursed 💀
or just regular doSomething
I just thought of using an instance like in java lol
Ah yeah that looks right
I am looking for someone in US (anywhere). I have a job for you. If you help me, I will pay you $1000.
It's very easy one. You just only spend 1-2 hours. Please feel free to contact me for the details
Sounds to good to be true, but #1202497504655188028 is the right channel buddy
Hi all, anyone know why IJ complains that this suppression is redundant?
even though getItemInMainHand is @ NotNull, I've seen some weird forks (I think it was some spigot/forge hybrid or sth) that does return null anyway, so I definitely want to have my val item be an ItemStack? and not an ItemStack
might be bugged lol, ig you can suppress all but...
anyways, if you don't want any warnings, you can also make a function like ```kt
fun <T> T?.toNullable(): T? = this // lol
3 options 😃
oh also
fun requireItemInHand(player: Player): ItemStack = player.inventory.itemInMainHand.takeIf { item ->
item?.type?.isAir == false
} ?: throw CommandResult.MUST_HOLD_ITEM_IN_HAND.asException()
``` 😌
¯_(ツ)_/¯
readability isn't always better when it's shorter, but i like shortening things lol
huh well I thought I could just suppress it with @ Suppress somehow 🥲
nvm found an easy solution
fun requireItemInHand(player: Player): ItemStack {
val item = player.inventory.itemInMainHand
@Suppress("UNNECESSARY_SAFE_CALL")
if(item?.type?.isAir == true) {
throw CommandResult.MUST_HOLD_ITEM_IN_HAND.asException()
}
return item
}
oh no wait that doesn't work lol
wait did you just make up that suppression message 🥲
i just realized
that's a pretty specific suppression
A. not coding. B. Probs the server is down or smth?
Is it possible to automatically create an event listener like this with the help of a super class. I don't want to have to manually create one per subclass as all of them call a single static method. I assume you can do it with byte buddy or smth?
public abstract class Foo<E extends Event> {
@EventHandler
public void onEvent(E event) {
}
}
public class Bar extends Foo<PlayerJumpEvent> {
// V - Has this by default inherited by Foo - V
@EventHandler
public void onEvent(PlayerJumpEvent event) {
}
}
server has allergies try again in the fall
might be possible but would it be easier for you to just make an event listener for Event and call the static method once there? assuming you want it to run for any and all events
Not really, the static method accepts any event but it is unnecessary to listen for them if unused. Also I didn't think you could listen for abstract events?
o youre right actually, i guess you cant just listen to Event 😔
Otherwise I would've lol. It's unnecessary but there is like 0 performance diff.
I've tried doing it with bytebuddy but it just does not work. I've managed to create the method but I can't for the life of me redirect it
wdym "automatically create an event listener with the help of a super class"
Is listener registration the problem here? If you dont want to register a new listener for each class, you could have a single listener than then calls a certain method of this Foo class
E.g. Foo#onJump
Though if you want a single method in the foo class, instead of onJump, onBlockBreak, onClick etc. you could have an onEvent(Event) and subscribe to certain events using a system similar to Protocollib's PacketAddaper
Yo uhm, using ProtocolLib right now, and I can't figure out which Packet the System Chat Packet is, in the sense that I tried PacketType.Play.Server.CHAT and PacketType.Play.Client.CHAT and none of them are the ones I want... This is purely player chat.
To be specific, I wanna listen to the packet 0x69
try packetevents
I am asking about ProtocolLib, not Packetevents though lol, I would use it but several plugins rely on ProtocolLib, so why bother having 2 Protocol plugins lmao
It was horribly written lol, I didn't know how to word it better xd. I've gotten help and solved it elsewhere, but if you want to know what I meant I'll try and explain better. I have a super class Foo with the generic <E extends Event>. For each subclass of Foo I want to create an event listener and since I have about 150 subclasses I didn't feel like doing it manually for each subclass. Instead I wanted to generate a method with bytebuddy or whatever to create the method for me and register them "automatically" (trash choice of word ik). Though I got told that I can use PluginManager#registerEvent(Class, Listener, EventPriority, EventExecutor, Plugin); for that.
fixed this but now, this is a bit funny, mini sample of the error below, but basically it appears that the messages being sent have no content?! Which makes no sense since messages are being sent by the plugin and received by me.... tried getting both chat components and strings of the packet, both empty... so I am quite confused on tf is happening
[18:33:39 ERROR]: Parameters:
net.minecraft.network.protocol.game.ClientboundSystemChatPacket@45ef365d[
content=<null>
b=false
]
seems it might be using adventure components
might help
system chat packet is only composed of a vanilla Component and a boolean (whether it should be shown in chat or action bar)
neither spigot nor paper modify the packet structure
assuming latest, of course :^)
oh shit forgot to say I already had solved this
xd
now I am struggling with getting the scoreboard lines lmao
[DirectoryProviderSource]: Error loading plugin: Directory 'plugins/Treefell-1.0-SNAPSHOT.jar' failed to load!
anyone know why this is happening? Also is it okay to be using jdk 21 for 1.20.1 or does it have to be jdk 17
mind showijng the full error?
cus thats just not helpful
So, I have a plugin were users can modify objects in a GUI. I want this plugin to hook to a SQL db though I've come across a problem. I don't know how to save them properly. Currently users have to press Save to save the objects, but if they exit out by mistake the changes wont save. Also if they don't click save and exit out without knowing that clicking save is mandatory they will lose all their work. I don't know how to combat this. I could just have the servers save everything automatically but then how would they know which version to pick? Another method I tried is flagging the objects, and every 15mins the server saves it, but if the users is still editing it at that time the flag will get removed and all work they do after the save won't apply? There is no good way of telling if they are in fact editing it or not.






'ing in the first 10 minutes
