#development
1 messages · Page 65 of 1
i use it like this
thats fine
if you were to do public class YourClass implements RecipeChoice thats not allowed, but just using it like you showed that is allowed
Hello everyone i get this error on my plugin java.lang.NoClassDefFoundError: net/dv8tion/jda/api/JDABuilder . That looks like a dependency problem but i've also <dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>5.0.0-alpha.22</version>
</dependency> as a dependency. How can i fix it
Any one need to make his own logo then dm me i can design logo what type of logo you want send me blue print i made that type of logo
Dm. Me if any one wanta
no
Uhm quick question about redis, if I wanna use it as a cache, the "map" or whatever you call it, it's global right? so all connections have the same map?
yes
what are alternatives that can be used for something like this?
?
for "cache" storage, since all connections use the same map, what's the best way to "separate" them or "filter" them? Would adding a prefix before each key work for instance? IE. X-Key1, X-Key2 and Y-Key1
yes
The question is, is that the best way of doing it?
I'm not aware of any alternatives
multiple servers ig
though there's also a category:subcategory:item practice
SET category:subcategory1:item1 value1
SET category:subcategory1:item2 value2
SET category:subcategory2:item3 value3
why would u need it to be global and distinct
Somebody is getting this wild error is one of my plugins, seems like the method to spawn entities is just.. gone? huh? Purpur moment?
https://pastebin.com/0GG5P8Ya
skill issue 
have confirmed this is at least a purpur issue, trying to find what the actual patch is because it was fixed between the latest 1.20.1 purpur version and the current 1.20.2 version at some point
..this is also an issue with the latest 1.20.1 paper build
paper how could you do this to me
oh god
if only there was some proper way for plugin/server versioning, something like, an api-version that was actually useful
well I need the latest API so looks like I'm doing a terrible cast here to the old consumer as a fix
you need 1.20.2?
I guess technically not but I'm definitely going to need 1.21.0
damn you living in the future or what
pretty much, yeah. just going to have to deal with fixing this again in the future I guess
i'm not sure that's gonna work
I'm not sure either, I'm just reverting back to building against 1.20.1 for now
okie dokie they simply broke backwards compatibility, not the first time I guess
i mean
maybe at some point but for now just depending on 1.20.1 works I guess
newer plugins were never guaranteed to work on older versions tho
The 1.20.1 depend did fix it, thank you for the insight
gg
how tf do you solve the Unsupported class file major version 65 error in gradle? Legit tried every single thing I could find and none worked lmao
Wrong java version?
already tried switching it like 5 times
Does your IDE offer any quick fixes?
nothing
wait
bruh
just restarted it and deleted .idea
and it appears to work now
but... Could not resolve: io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT lmao
what's actually wrong bruh
I am like, 99.9% sure it's right
specify the java.toolchain in your gradle build script to java 17+
don't run gradle with java 21
lol
I am in 17
speaking about not finding paper
like 100% sure repo and dependency is right
so no idea what's happening
even with toolchain
Isn't "1.20.2" R2?
Yeah IDK then. Did you say its fixed now though?
share build script?
If Java version is too low it'll say cannot resolve
it works now?_
unsure what I even did lmao
it just works now?
clicked like, 5 times to rebuild
and at the fifth time it worked
?
lmao
Anyone know why ACF would give this error when stopping the server? https://paste.helpch.at/ecoqalaqiv.php
Yes I know I shouldn't use 1.12.2, but ACF should still work?
What would be the best way to save an item with all nbt tags? I mean is there any way to get item as json or byte array etc?
Has anyone listener the Quests event? I can't capture the "QuesterPreStartQuestEvent" no matter what.
I start my server, and I set a breakpoint in the Quests source code. I can confirm that Quests successfully executed this line of code.
final QuesterPreStartQuestEvent preEvent = new QuesterPreStartQuestEvent(this, quest);
plugin.getServer().getPluginManager().callEvent(preEvent);
But my code is not reflecting.
@EventHandler
public void questTake(QuesterPreStartQuestEvent event) {
IQuest quest = event.getQuest();
String description = quest.getDescription();
String name = quest.getName();
log.info("questTake, {0}, {1}", name, description);
}
@EventHandler
public void dropItem(PlayerDropItemEvent event) {
log.info(event.getItemDrop().name().toString());
}
I can make sure my listener is registered properly because "dropItem" works fine
🥹
there are some libraries that do that, otherwise Base64 is always an option. Paper has some methods that help with this too
What are those paper methods? Or are they in ItemMeta class?
serializeAsBytes and deserializeBytes
if I am not mistaken
then you can use that for base64
Thanks
np
This is probably very simple but can someone tell me why this doesn't copy the jar to the destination?
register<Copy>("copyVald") {
dependsOn(shadowJar)
try {
if (project.findProperty("destination") != null) {
from(layout.buildDirectory.file("build/libs/" + "${project.name}-${project.version}.jar"))
into(file(project.findProperty("destination").toString()))
logger.log(LogLevel.ERROR,
"build/libs/" + "${project.name}-${project.version}.jar"
)
}
} catch (_: MissingPropertyException) {}
}
The log is called
At correct path btw
Put the from file into a variable and print if it exists and the absolute path
Same with the into
How do I check if file exists in kotlin?
I assume this is how it would be saved into a variable?
val fromFile = layout.buildDirectory.file("build/libs/" + "${project.name}-${project.version}.jar")
val toDir = file(project.findProperty("destination").toString())
from(fromFile)
into(toDir)
I can call .exists() on toDir, but not fromFile, should probably just call File(whatever) first
Does the ide tell you what class from File is?
Oh, only toDir exists
val fromFile = file(layout.buildDirectory.file("build/libs/" + "${project.name}-${project.version}.jar"))
val toDir = file(project.findProperty("destination").toString())
logger.log(LogLevel.WARN, "TEST")
if(fromFile.exists()) {
logger.log(LogLevel.WARN, "fromFile: " + fromFile.absolutePath)
}
if(toDir.exists()) {
logger.log(LogLevel.WARN, "toDir: " + toDir.absolutePath)
}
Hmm
Does the absolute path print valid?
Only the toDir.exists() returns true, and prints the correct path
So something is wrong with fromFile
Nope, not in console if thats what you mean?
Nvm it does now
Only for the fromFile though
But it works
So ty
Yeah I think IJ highlights the file if it exists so it's useful for debugging typos and stuff
Only for files within the project though it seems
what's recommended to replace bukkit scheduler's timer? I know about swing's Timer, but is that the ideal one? Is there any better alternative? What are the differences? (preferably async)
ScheduledExecutorService
Ty
Can you look for a developer here for an assignment?
you can use #1158296183303843890 or #1158296181005365248
how do i ban a player? The player to ban is called "victim", I have tried to use victim.ban() but idk how to do it, can someone help pls
/ban victim
Bukkit.getPlayerExact("Victim").ban()
by called i mean the variable is called victim
but thanks
what do you mean by /ban victim?
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#ban(java.lang.String,java.time.Duration,java.lang.String,boolean)
This link will show you what parameters you need
thanks
what would I put for source?
hmmm
is it the player that banned them?
yep, just checked
it's the player that banned them, and it can be null if there was no player that banned them specifically
not sure what it's used for though 🤔
k thanks
How can I use relational placeholders in my plugin? For example I want to use %rel_factionsuuid_relation% placeholder
https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI
then instead of setPlaceholders(OfflinePlayer, String) use setRelationalPlacheholders(Player, Player, String)
thanks
I've been using this:
Bukkit.getPlayerExact(String.valueOf(victim)).ban("L", (Date) null, null, true);
to ban players, although when it is time to execute it, it doesn't work, any reason why? It doesn't give any errors, and it ignores the event.setCancelled(true) and let's me take it and move it around
don't use string valueof and getplayerexact
that's likely not what you want
if i dont use string valueof it just gives me the error "expected string given player"
what is victim?
what variable type is it?
Player
are you sure the code is running?
try putting like a print statement
System.out.println("banned " + victim.getName());
victim.ban(...);
for example
alr
yeah before it was giving me some sort of error but now it's not
reason is what will show up when they attempt to rejoin or the message on man, date is when the ban will expire, can be null for perm ban, source can be null or you can put your plugin name if you wish so if some other plugin checks the source itll display your plugin name
it can be null
so ban(null,null,null) is valid, will ban for default reason of ban hammer has spoken (i think), forever and no specific source
source is probs for something like plugin string name, player name of who banned them, etc
Hi folks,
I'm trying to learn solidity, so I would appreciate it if you could send me a video on building a solidity environment.
so i have a public list (public ArrayList<Player> list_of_flying_players = new ArrayList<>();), how can I use it in a different file?
it's currently in the file called "mzxfly" but I want to check it in the file "menuSystem"
nvm
public ArrayList<Foo> bar = new ArrayList<>(); 😩😩😩
Liskov crying rn
@icy shadow tell em
um actually thats not what the liskov substitution principle means
that's a remnant of the sxtanna days, all of us were deceived
LSP just means "objects of a superclass should be replaceable with objects of its subclasses without breaking the application"
i dont think its actually related to just replacing arraylist of list in this case
it's more about just if you replace it with List you can guarantee that the rest of your code will only use methods from the List class
so it's easier to use the same methods between different types of Lists
LSP just means, if i have a func(List<T> l) and func uses function X on List, all List subtypes should abide to the contract of X and work without func "knowing"
basically, it's just interfaces and contracts
Yeah it’s more of an “axiom” than a design principle
It’s just how “lawful” code should work
I mean it's still related but isn't the definition (which I found out today 😃, although I've never really looked into the principles stuff)
not really no
it’s not like using List for local variables is actually better
It makes zero difference
apart from slightly more brittle refactoring
:(
lol brister idiot
hey
does someone know ifjava PotionEffect(PotionEffectType type, int duration, int amplifier)
the duration is in ticks or seconds?
i think its in ticks right?
ticks
Thx
the spigotapi javadocs usually say what the parameter does
I think you mean the dependency inversion principle which says you should depend on abstractions
not that that's that useful without dependency injection
SOLID principles are kinda cringe anyway
?solid
What is SOLID?
S - Single-responsiblity principle
O - Open-closed principle
L - Liskov substitution principle
I - Interface segregation principle
D - Dependency inversion principle
If you wish to read up more on it, you can check here:
https://scotch.io/bar-talk/s-o-l-i-d-the-first-five-principles-of-object-oriented-design
"ummm implementations should follow the defined contracts" YES thats why its called a contract
LOOK at what object oriented programmers have been doing with your money
meanwhile in REAL languages it is quite literally impossible to write unlawful code (in some cases)
What is the best way (or at least a way) for loading libraries dynanically (Spigot). For example I provide more than one database option and all of them have different drivers, is there any way to make Spigot download and use my drivers according to user's selection (for example from config etc)
I've read this https://www.spigotmc.org/threads/java-16-dynamic-libraries-for-plugins.508083/ they talk about a way but don't mention the way (or at least I didn't see)
Imo just use spigot libraries feature and include all drivers
I think it's 1.17+
Just using libraries: in plugin.yml and loading? Right?
Yeah
I'm setting up a mc server in Oracle and I got it all setup, but I can't seem to get the ports working. I enabled the ports using firewall-cmd, and it shows at firewall-cmd --list-all.
sudo ss -ltn also shows that the port is open. But whenever I try to join, or ping the server at that port. It says the port is closed. (Port 25565)
firewall-cmd? what distro/os are you using?
ubuntu doesn't have firewall-cmd by default I don't think
Uhm, no idea. I'm trying to login into the cloud but oracle cloud is taking ages to load. But I've also tried using ufw
if you left it as default then it's Oracle Linux 🥲
Make sure you opened the port on Oracle as well
similar to port forwarding on your local network, you have to open the port on Oracle website as well
Oh, I actually have to open it on oracle?
yeah
it's some subnet setting
1 sec
on the vps instance details, click the virtual cloud network
then click the subnet
then default security list
then add an Ingress rule
Source CIDR: 0.0.0.0/0 and edit source port range to 25565
or you can do what I do and just allow all protocols and leave Source port range empty as well 🙃
Alright sounds good, thanks a lot
Is it normal that it stays on this screen for like 5 min?
It won't load me into the cloud for some reason
uh no
Oh I got on the site, so I did that, but the port is still not showing as open.
and the server is running?
Yeah
might be a firewall issue then
You're not using both ufw and firewall-cmd, right?
Yeah, I might have them both installed on the VPS
Both
ok try sudo ufw disable
and sudo systemctl restart firewalld
(firewalld is firewall-cmd i think)
so that they're not conflicting with each other
Alright, just did that. The second command, didn't return any message tho but that's probably normal. (Also I'm checking if the port is open using https://portchecker.co/checking, I hope that's fine?)
On the site it's still showing as closed
that should be fine, although note that the server has to be running or else it'll say the port is closed (even if it's open)
So I am using the oracle cloud free services with the OCPU count of 4 and 24GB of memory. And I would like to have like a small hub server, a bungee and a skyblock server. Would it be better to install Pterodactyl to have a good view over all the servers. Or should I just create them all in the VPS and let them run like that.
Doesn’t really matter, the performance won’t be great
i think pterodactyl is nice for the added convenience
but technically you should see better performance (assuming you have all the same jvm flags set, etc) if you deploy them on the bare server instead of through docker
overall i think ptero is probably worth it, the performance difference is not going to be that big and it'll be nice and easy to do stuff if you don't want to cozy up to the various linux command line tools too much
is it expensive to frequently call plugin.getConfig().getDouble(), wondering if i should cache the value or it's "good enough"
It’s not that expensive of a call, the yaml would be already loaded to the memory on the startup. It’s not like every time you call, the plugin needs to read the file from the disk.
But, imo you can cache it if it’s not too hard. I don’t know exactly how Bukkit’s configuration retrieves the value
Also a getter would be far more better in terms of maintainability and readability, than hardcoding the configs node path in all the places you are gonna call those config value
thanks
Hey is this still a correct way to get a player his UUID? (offline player)
public static UUID getOfflinePlayerUUID(String playerName) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
if (offlinePlayer.hasPlayedBefore()) {
return offlinePlayer.getUniqueId();
} else {
// Speler heeft nog nooit gespeeld, UUID is niet beschikbaar
return null;
}
}
public static void main(String[] args) {
String playerName = "SpelerNaam"; // Vervang dit met de naam van de speler waarvan je de UUID wilt weten
UUID playerUUID = getOfflinePlayerUUID(playerName);
if (playerUUID != null) {
System.out.println("De UUID van speler " + playerName + " is: " + playerUUID.toString());
} else {
System.out.println("Speler " + playerName + " heeft nog nooit gespeeld en heeft dus geen UUID.");
}
}```
Or do I need to use the mojang API?
thanks charles
what a nice man
If I’m trying to make a plug-in that the total blocks forward(not left to right just forward) a crossbow or bow shot is IF IT HITS SOMEONE and they are hit once how would I do that
Explanation
I shoot crossbow into somone 5 blocks away from me straight they then strafe 2 blocks Side to side then go up 3 more before being hit it should calculat 8 how would I do that
store a variable of the location when they shoot and on hit calculate the distance between the hit player and that stored location
There are ways to avoid memory leaks or smt, like you can delete that variable after x seconds or whatever
could u give me like an outline or smth im not very smart
I don't understand your question
Are you trying to calculate the distance between the player hit location and the new player location?
Already told you everything you need to do, not going to spoonfeed you.
yes
he is, but he wants to prevent that when shooting you are at X and while the arrow is mid flight, you can move to Y which makes distance bigger
oops just edited my message 🥲
is the 'yes' still true
uhh
spigot provides a distance method on Location (ex loc1.distance(loc2))
So you can make like a HashMap<UUID, Location> to store the hit locations (google HashMap for more information)
Beyond that, I'd need more information
is there any library similar to SlimJar available for Maven?
nice ping
We get it, you vape
Hey, question. Im using getConfig() to save and load my config. but im having trouble with the data after a reload
Its lost, anyone knows why?
@Override
public void onDisable() {
for (ZooFeeAnimal a : AllAnimals){
a.HolographicName.removeAll();
}
Bukkit.getScheduler().cancelTask(growTaskId);
saveConfig();
}
My on disable
hello everyone, how does one set up xc and xv after installing paper 1.18.2, the dependencies and jars?
i would appreciate the help a lot
xc and xv?
Xmx and Xms ?
guns 😱
i can provide the jars if u want
nah, ty
i have no idea how to get this to work
i really want my sv to have ww1 ww2 vibes and i need this plugin
guns bad - illegal
british
british no like gun
but im uruguayan hehe
topfu i saw u texting, do u know anything about the plugin? :0
Go to the respective xc/xv folders and run ./gradlew build. Generally, that should be sufficient to produce a working jar at (xc/xv)/build/libs, otherwise you'll most likely have to spend a lot of time messing around to get it working
i already have the jars built tho
let me try again
ill build it again
also i have paper 1.18.2 as asked by the readme
Then what's the issue? Is it not being recognized as a plugin or something?
like
xc got installed but there is no guns nor anything
xv didnt even created a folder
Look at the server's console, there is most likely an error there
who could've though that there might be errors in the console
fro the caps
ik mb for not thinking about that
like
yeah ur right
I mean it should be first thing to do
instead of going to discord to ask for help
where you will be asked to check the console for errors
im a newbie at making MC servers once again tho so plz be patient haha
hello again everyone, hope ur having a good evening.
Does anyone know about a dynmap addon that adds towny towns to the dynmap? dynmap-towny doesnt support 1.18.2 apparently
i dont
modify it yourself?
or check for an earlier version of it that does
cus its unlikely that they never supported 1.18 unless it was left unmaintained untill 1.19 came out or smth
Wdym? How do I do that
ill keep searching
ask dynmap support or towny support or #general-plugins or #1007620980627230730
#development is for coding help
sorry for the incorrect use of the channel, thanks for the info!
So I am having trouble trying to link plugins with my maven dependency (this is the pom of the Main plugin).
In other plugins I can't call JavaPlugin class, or the static method from this plugin. I get i either java.lang.ClassCastException: Cannot cast me.albusthepenguin.mines.Mines to me.albusthepenguin.mastery.Mastery at java.lang.Class.cast(Class.java:3889) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.getPlugin(JavaPlugin.java:431) ~[slimeworldmanager-api-1.20.2-R0.1-SNAPSHOT.jar:?] at me.albusthepenguin.mines.Mines.onEnable(Mines.java:42) ~[Mines-1.0.jar:?] with the class call, JavaPlugin.getPlguin(class) <- and with a static instance of the class I get java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "masteryPlugin" is null.
https://paste.helpch.at/zaxosuselu.xml (fixed)..
Anyone here have experience with SmartInvs, specifically creating like a storage gui using it
mind posting the actual code your trying to run?
also have you made sure that the plugin you are trying to hook into is being set as either a depend or softdepend
so if your trying to hook into Mastery from Mines, you would set Mastery as a depend or softdepend in the plugin.yml of Mines
what this might mean?
org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!
the event being registered is really basic, this one:
public class KitSelectEvent extends PlayerEvent implements Cancellable {
private static final HandlerList HANDLERS_LIST = new HandlerList();
private boolean cancelled;
public KitSelectEvent(final Player player) {
super(player);
this.cancelled = false;
}
public boolean isCancelled() {return this.cancelled;}
public void setCancelled(final boolean cancelled) {this.cancelled = cancelled;}
@Override
public HandlerList getHandlers() {return HANDLERS_LIST;}
public static HandlerList getHandlerList() {return HANDLERS_LIST;}
}

where does the stacktrace come from? Are you trying to listen to PlayerEvent?
Code is literally on main class
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(new KitSelectListener(), this);
}
and listener is
public class KitSelectListener implements Listener {
@EventHandler
public void onKitSelect(KitSelectEvent event) {
Bukkit.getLogger().warning("Kit Selected");
}
}

Sorry forgot to mention I figured out the solution. was my own api, and I forgot to set scope and shade hikari properly.
can you provide the full stacktrace?
updated to 1.20.1 spigot as dependency, seems to work
i'll have to test now using java 8 in server to make sure nothing broke in old versions
thanks for the reply ^^
I'm looking to hire experienced Plugin Configurators
is there a way to convert MyClass.class to new MyClass(para1, para2) so i dont have to do MyClass.class.getConstructor(...)?
im trying to add a object type as an id so i can create an object of that type using its constructor so i dont have to make a massive switch statement of strings to get the relative other object
I don't think so. I think a constructor would be required in that class.
basically im trying to copy how ItemStack and ItemMeta classes work to implement it for my custom items, ive searched through how bukkit handles getting a relative ItemMeta object from the item's id (Material) and it looks like they hardcode a switch statement of
switch(Material) {
case LEATHER_HELMET, LEATHER_CHESTPLATE, ... -> new CraftLeatherArmorMeta(item.getTag());
...
}
for example this
actually
i think i figuredd out a method just now
ill just make a method that i can override to give whatever meta its supposed to have
which means i dont have to make the massive switch statement
since itll call the owner class of that method anyways
Isnt there like an ItemFactory or sth that does just this
declaration: package: org.bukkit.inventory, interface: ItemFactory
its my own copy of itemstacks, metas, etc
my own impl
ive done it for a couple different projects
i like how the item modification works with ItemStack and ItemMeta so why not just use their concepts to allow for my own metas to exist
Myea
ofcourse without extending itemmeta cus idk if thats even legal to do so
yeah ik internals don’t always like being extended and implemented left and right lol
This sounds like a good idea, abstract factory basically :^)
basically

[16:48:11 ERROR]: Thread Craft Scheduler Thread - 14 - BDiscord failed main thread check: command dispatch java.lang.Throwable: null just wondering, is this cause I can't dispatch a command async?
why is uploading files actually not allowed
Paste code and configs in a https://paste.helpch.at
Post images in imgur
Once you're tier 2 and above, you will be able to upload files in some of the channels (such as this channel)
imgur is a pain tho
It's to prevent spam, once you're tier 2, you will have permissions
Also if you have a program such as ShareX, it uploads your screenshots to imgur automatically
how does it prevent spam exactly?
So I usually end up sending imgur links anyways even tho I have perms
Prevents other types of files & ig "is a pain" prevents spam too :))))
I'm not staff btw
what
ok then
So I have this if statement, how do I turn it into a switch statement? I'm planning on making multiple of these if statements and someone told me to use switch but idk how
yes
(just did for embedding)
You can do ```
switch (event.blah().getDisplayName().toLowerCase()) {
case "name"
}
Lowercase is to ignore case
thanks
Google switch statement and try going based off my incomplete code 🥲
doesnt work
it simply doesnt do anything
as if the item i clicked wasnt named "Kits menu"
probably because the item has the color "blue" while the swtich statement is looking for the text without a color
I tried doing case case ChatColor.BLUE + "Kits menu": but that doesnt work
says "Constant expression required"
can you send your whole code
ive got it to work now
just had to remove the color from the item
which isnt that big of a deal
does anyone know how to disable a hover+clickevent after you click them once for adventure components
manually keep track of the interaction, have a boolean or something to keep track of if they have accessed it or not, then when they click the thing in chat just flip the boolean
you cant get rid of the hover and click from the message since you cant modify messages that have already been sent
you can only prevent them from accessing whatever when clicked
Does anyone know how to track whether a player has moved an item from a spexific chest into his inventory and if he has moved a specific amount of diamonds back into the slot?
Dkim sent.toLowerCase() and your case is not lower case
That's never gonna be true
So i have these custom items, and I don't want them to stack so I want to add a custom "tag" to it in the lore, i want it to look something like this, how do I go about doing that?
https://imgur.com/mZoeBkB
I was thinking about using random?
Hey, I'm using Triumph GUI and I've been wondering how I can make "dynamic" items with a PaginatedGui.
For example, if the player's on the first page, the "previous page" item shouldn't be shown and instead be empty/another item. Same with "next", if the player's on the last page. Is there a way I can add this?
Thanks in advance
Okay I guess I found a solution, is it the best way? https://paste.helpch.at/oyahusutum.java
Trying to learn Kotlin for MC plugins and for some reason .isOP and .sendMessage aren't a thing according to IntelliJ, the error is "unresolved reference".
you don't need to to use lore for this. you can just use nbt tags. https://docs.papermc.io/paper/dev/pdc#itemmeta. And yeah, you can use a random number generator or just generate a UUID.
Hello, Im not sure if this issue is with PlaceholderAPI or not but I would like your advice.
So the issue Im experiencing is that whenever I use a placeholder from within a local placeholder expension(from a different plugin like ItemsAdder or DiscordSRV) in one of my plugin messages, it seems to not work on server startup.
Like directly after the server restart my placeholders aren't working, they only start working out of them selfs after like a minute or two after server restart(even when requesting them 100 times).
Though, what is weird is that whenever a different plugin uses the placeholders or even /papi parse --null <placeholder> it works fine. And hell after /papi parse my placeholder in my plugin start working.
I've tried alot of different things and maked sure my placeholders are parsed after PAPI and its expensions, but Im unable to find a reason for why it does this.
I hope you can help me, thanks.
It's probably because yiure doing it in onEnable, and the plugin that you're using papi in might not have enabled ywt
I've tried alot of different things and maked sure my placeholders are parsed after PAPI and its expensions
Like I sayd ^^
I even tried to schedule a task 200 ticks after server startup and it still doesn't work
2000 ticks on the other hand works, but this has the same affect as waiting for the placeholders to start working
Oh huh
Yea, Im kinda speechless as I don't know what to try next.
I was wondering if I overlooked something obliviously so thats why I came and ask here
Even if DiscordSRV triggers a message(send by my plugin), the placeholders don't parse, but after a while they start working for some odd reason.
The weird thing being, is that /papi parse makes them work magically
Its like /papi parse inits the expension or some, but I looked at github and it doesn't do anything different then PlaceholderAPI#parse
Lol what if you Bukkit.dispatchCommand?
I mean, that might work as a workaround, I will test it soon and let you know if it worked
Its possible the local placeholders are awaiting to be loaded by placeholderapi. These plugins likely softdepend on it and you should use it to so all placeholders should be loaded by the time you try to access them.
I would think that to, but then still, these is no reason that /papi parse always works for the first time, even directly on server restart
I can help you in video editing and logo editing dm me for more information
Doesn't work either, see this where I test the placeholder using /papi parse which works and followed by my plugin executing a delayed task which tries to parse the placeholder:
[18:39:16 INFO]:
[18:39:18 ERROR]: [EconomyShopGUI-Premium] [STDERR] %img_test% - true```
mind posting the code you are running for doing that?
This is my code for testing the placeholders:
for (int i = 0; i < 100; i++) {
System.err.println(PlaceholderAPIHook.translate(p, "%img_test%"));
}
what does PlaceholderAPIHook.translate do? the code
public static String translate(OfflinePlayer p, String message) {
System.err.println(message + " - " + PlaceholderAPIHook.enabled);
if (!PlaceholderAPIHook.enabled || !PlaceholderAPIHook.plugin.placeholders)
return message;
return PlaceholderAPI.setPlaceholders(p, message);
}
try removing your if statement, could be eithrr of those are false and just returning prematurely
Yep, I just looked at it and thought by myself "Im a moron" :p
Trying it now..
Well, thank you, I guess I shouldn't be coding at 4AM...
I feel so emberased now lol
so the if statement was the issue?
Yes, since PlaceholderAPIHook.plugin.placeholders loads delayed
if statements can be the most frustrating thing when you expect them to be true, but actually they are false for some dumb reason and you can think your code after it is broke and its not
like for awhile i didnt know InventoryDragEvent existed which was fucking with my first interactable menu i ever made
Yes, thats going in my memory lol if statements can be the most frustrating thing when you expect them to be true.
Well, thanks for wasting your time on me lol
well, yes and no
before calling X and expecting it to return Y, you should know what X behaviour is in A, B, C, etc. situations. of course this cant always be applied (though most of these imo should be/are usually covered by tests, either by mocking/stubbing or in a working environment), but you get the gist
or dont code at 4am, that usually fixes the problem
its not a waste of time if something was learnt
True, thank you guys. For helping me debug my own code :p
if you fixed your issue, or atleast diagnosed it and can figure out a fix then i say it was well worth it
Hello, can I take a question about minecraft packets and protocole libs here? or just about helpchat's plugins?
Anything related to development. (Following topic rules ofcourse)
by using packets
either manually through nms or by using something like protocollib or packetevents
Well, I am begginnrr in protocollibs . To train i Try to make the equivelent of the spigot event "PlayerCommandSendEvent". I have check I think its https://wiki.vg/Protocol#Commands
so the commands are more or less stored in "nodes" but nodes is a custom object, isn't it? (I can't find it in the libs protocol methods. So which packetcontainner method do I use to retrieve commands?
any developers with deluxemenu know what this iss ie please need support https://discord.com/channels/164280494874165248/1165676695097966774
for protocollib i'd suggest using PacketWrapper https://github.com/dmulloy2/PacketWrapper they are type-safe packet wrappers with plib "WrappedXxx" types with all the necessary getters and setters, but you don't need to fiddle with indices or anything
as you can see in the wrapped commands packet https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCommands.java there is no "special" getCommands in PacketContainer, it's just brigadier's RootCommandNode directly (since it's technically not "nms internals" so it doesn't really need a wrapper representation)
I would take a look at PacketWrapper
It's not always up to date but it can be very useful
It shows examples/utils to use protocollib
okay I'll give it a try, but for node, normally data is represented as it should be by computer convention (string, int, double) etc... because it's not the same size it seems to me. but for node this isn't the case, is it?
packwraper add an abstration couche at protocolib?
Not sure what a couche is but I think so, yes
yes not really couche
packet warper work with protocollib or it rempalce?
Work with
where i can find example of warper projects? (the doc don't show how to use it)
Those are the examples
It shows you how to use protocollib
I wouldn't recommend using the wrapper itself since it can be wrong/outdated sometimes
So look at the wrapper code to see how it works and use it in your code
okay
for nodes https://wiki.vg/Protocol#Commands i am note sur to understand, what is node ? arraydatabytes?
I recommend not looking at wiki.vg when working with protocollib, wiki.vg shows you the encoded byte stream that is sent to the socket and goes over the network, protocollib simply allows you to use the Packet java objects/classes and its java fields without having to use reflection and weird names, this is before it is encoded and is why PacketWrapper is useful. wiki.vg is not useful at all when working with plib
The type is, like PacketWrapper shows there, a RootCommandNode, it is a Java class you can access and it is part of Minecraft's command framework https://github.com/Mojang/Brigadier
yes
So you're telling me not to use packet warper but to see how it works to do the same thing with the protocollib??
so i have to import Brigadier dependency to can use node in my plugin?
from the event objet, to get node, what i have to do? (because event.getnode can't existe)
well i found that here
https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCommands.java#L43
I did pretty much the same thing
protocolManager.addPacketListener(new PacketAdapter(
this,
ListenerPriority.NORMAL,
PacketType.Play.Server.COMMANDS
) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packetContainer = event.getPacket();
Player p = event.getPlayer();
//extracting infos
RootCommandNode node = (RootCommandNode) packetContainer.getModifier().read(0);
System.out.println(node);
}
});
}```
but on load I got
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class com.mojang.brigadier.tree.RootCommandNode
an integer Can't an object be cast regardless of the child?
In this case, packet wrapper appears to be incorrect, I think - if you look on https://wiki.vg/Protocol#Commands, notice how the first one is integer
You want the 2nd value
So do read(1) and not read(0)
so i found this
https://github.com/dmulloy2/ProtocolLib/issues/1646
and I have make this code but I got an com.comphenix.protocol.reflect.FieldAccessException: Field index 0 is out of bounds for length 0 at com.comphenix.protocol.reflect.FieldAccessException.fromFormat(FieldAccessException.java:49) ~[?:?] at com.comphenix.protocol.reflect.StructureModifier.read(StructureModifier.java:245) ~[?:?]
error generated by InternalStructure commandInfo = subCommand.getStructures().read(0);
public void onPacketSending(PacketEvent event) {
PacketContainer packetContainer = event.getPacket();
Player p = event.getPlayer();
//extracting informatdions from the packet
//RootCommandNode node = (RootCommandNode) packetContainer.getModifier().read(0);
int rootIndex = event.getPacket().getIntegers().read(0);
StructureModifier<List<InternalStructure>> lists = event.getPacket().getLists(InternalStructure.getConverter());
List<InternalStructure> commands = lists.read(0);
int[] subCommands = commands.get(rootIndex).getIntegerArrays().read(0);
for (int i = 0; i < subCommands.length; i++) {
InternalStructure subCommand = commands.get(i);
InternalStructure commandInfo = subCommand.getStructures().read(0);
String commandName = commandInfo.getStrings().read(0);
if (commandName.equals("help")) {
System.out.println("help");
}
}
}
is an internal problem? (in protocolib)
i'm desperate now I generate an error instead java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "generic" is null
I deduce that commands with protocollibs can't work after 1.19 and I have to conctact the dev?
Maybe I'm not sure
Also ignore my other response
The 1 instead of 0 one
the problem line is
InternalStructure commandInfo = subCommand.getStructures().read(0);
yes the devlopper has givent it in a commit but was for 1.19 maybe no work in 1.20?
it is possible that the packet class structure has changed
why are you doing this anyway?
Can I return a Component instead of a string in the placeholder?
no, but you can return a MM string if that helps
to learn packets, and also to redefine commands via the sendcommmand PlayerCommandSendEvent event is not sure, there are client to get server plugins without /pl because when you use PlayerCommandSendEvent event if you remove certain command. Theys command will still be sended to the client, i want avoid that
its possible to check in the src code? or is too dificult?
Here: https://mappings.cephx.dev/1.20.2/net/minecraft/network/protocol/game/ClientboundCommandsPacket.html
version: 1.20.2, hash: 634f33aa72
look at the last field
1.18.2 uses RootCommandNode, but 1.19+ uses nms
ah I thought the changes were in protocollib
I haven't looked at the github issue yet so idk protocllib has support for it
if you speak about that https://github.com/dmulloy2/ProtocolLib/issues/1646 its for 1.19
hm, then I'm not sure why it doesn't work
yes stranger (I don't get the same errorall the time)
what I have to do ? open an issue in the project?
Litebans says "All punishments made through LiteBans will take effect globally across all servers linked to the same database."
What would be the best way to implement something like that? Checking db every second for new records?
they dont cache the bans afaik, they just query the db anytime they need data async
like if you own a copy of litebans you could open it up with jdgui or recaf to see what they do
afaik its not obfuscated
i think what they mean is more of a message queue system
e.g. you ban someone playing in Server1 while you're in Lobby2 or w/e
It works exactly like they said, I have 2 servers with Litebans and they both connected to same db, when I ban someone it gets banned (ban message is sent too) on both of the servers
I understand they are not caching and querying, which makes banning in one server affects the other but I didn't understand how can it send the message to other server
Probably sends a pluginmessage to the other servers
Pluginmessage? This? https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
yes
Hey, anyone know a way to paste worldedit schematic so that only a specific player can see them? Similar to player#sendBlockChange however I want it to work with schematics.
you'd want to create an Extent that delegates the setBlock call to the (worldedit) Player#sendFakeBlock
This?
uh that's not standard worldedit API, idk what you're using
but you want to create your own Extent class
^
he should use amazon prime worldedit for sure
it's a fawe 1.8 lib for worldedit
Hey guys, i'm working on a plugin for the first time since 2015, I'm trying to set a block at a players death location but I'm facing some issues:
location.getBlock().setType(Material.OAK_PLANKS);
DOES NOT WORK... it gives the error: The method setType(BlockType<?>) in the type Block is not applicable for the arguments (Material)
Any reason on why this is?
BlockType isnt a spigot or paper api thing
so how would you set a location to a block then?
are you using maven or gradle?
Eclipse
thats the ide, im talking about your buildtool
ohh your talking about what built the spigot.jar for the library?
I used the buildtool program from the spigot site to build the .jar I am using
not to build the jar
to compile your plugin
... you dont just export it in eclipse?
that would end up including the spigot/paper jar in your plugin, which inflates it to like 45mb or smth
gradle or maven is the go to way to compile your plugins nowadays
I'm to too concerned about 45mb lol for a basic plugin like this
still, its better to use a compile tool
How would you set a block in the newer versions of spigot?
player.getlocation().getblock.setType(Material.SAND) use to be the way but
,setType(Material.SAND) does not work anymore and looks deprecated
its not deprecated last time i checked
did you build the experimental branch of spigot or something 🤨
that exists?
So anoying we cant send pictures here
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.
^
thats dumb but yes it says material. is deprecated
yeah you built the experimental branch lol
So in the experimental branch of spigot they removed material. ? What did they replace it with?
Whats the point of changing somthing years old smh
BlockType
because it has many issues
to improve how it works ig
the whole point is to separate item types from block types
they are very different things with different behaviours
means setting invalid materials is no longer a thing
Never understood complicating things like that which then makes updating old plugins a pain in the ass
atleast that means that people wont try to set blocks to MATERIAL.DIAMOND anymore for example
Its changing something that been around for over a decade its silly imo
updating legacy shit that is annoying af is a good thing
you can just not use the experimental branch anyway
since 0 people are running it because it's incomplete
its experimental for a reason
I miss the days of just downloading the bukkit.jar from bukkit.org straight from the page... so much easier to make sure you always had the right version
well those days have been long over since like 1.7 days
Sadly
so time to get with the times and ig cope?
how childish
"oh no, the platform is improving for good! bleh"
bukkit has been stagnant for almost a decade and this is just one of the many changes that have been long overdue
im actually rooting for that update
didnt even know that it was being changed till like 20 minutes ago
The only way to get the non experimental version of the spigot.jar is to use their buildtool right? They dont have a direct download or anything?
you could also not download a jar and use it as an external library
gradle or maven (gradle is so good tbh) is so nice for that
running the regular buildtools command won't build the experimental build
you have to explicitly opt in a flag
and it means you can also hook into other peoples plugins so much easier and wont include their code either unless you specify otherwise
Intresting that i setup buildtools and i used the one it instantly provied
odd
it's deprecated, not removed
I don't think spigot will remove it in order to keep legacy compatibility
or else they wouldn't have added the Material.LEGACY_STUFF
its like
ItemStack(Material type, int amount, short damage)
only exists because 1.12.2 and below used the damage value to specify an items sub material, like stone types were like 1:6 for polished andesite for example
yeah it definitely doesn't automagically build the experimental branch for me without me telling it to do so lol
I'm quite new to plugin development, working on my first one.
I've been having an issue and looked around various threads looking for a solution but it seems there might not be one.
Is it seriously impossible to detect a player right clicking the air with no item in their hand? That seems like something that should be detectible.
I don't think so? To detect player interactions, listen to the PlayerInteractEvent event, and then use hasItem() to achieve what you want. Here's the javadocs for that particular event for more details: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html
declaration: package: org.bukkit.event.player, class: PlayerInteractEvent
playerinteractevent should trigger
I am using PlayerInteractEvent, but it's not firing at all when there's no item. I searched several threads on spigot/bukkit and all I found were people saying the client doesn't send a packet in this case, but that seems really dumb. Is this really the case even in 1.20?
you arent ignoring if cancelled right?
Correct.
@EventHandler
private void onInteract(final PlayerInteractEvent e) {
Plugin.plugin.LOGGER.info("Right click!");
<code to be triggered>
}
When right clicking the air with no item in hand, the top logger line doesn't run at all, so the event must not be firing. The event is registered, and it fires in all other cases.
ive looked online and seems like alot of people have come to the same conclusion that its not possible to see if a player has right clicked air with an empty hand
you could in theory set an entity to always be infront of them and see if they click it but idk if they can only click it if its not invisible
might just be sol
That's very dumb..
Unfortunate, I guess I'll have to switch which trigger I use. Or use that invisible entity method, though that sounds like it could get messy..
Well thanks for confirming.
ypu could use left click
or drop item
tho idk if drop item works when you have nothingnin your hand
Does this channel apply to skripting as well?
You can ask questions about skript but be prepared for it to go unanswered or receive responses of why you shouldn't use it. You might get an answer to your question.
Good to know, ty
yo
is it possible to make a place holder that detects the version and sends whatever it picks like if your on older versions it sends [owner] but with newer versions it sends a unicode aka
snap
i cant send images
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.
alright it works
but the place holders wont send
(i fixed it )
moved from the placeholder-api channel
this motivates me to come back to coding server side
Hey, im pretty new to plugin development, iv come into a situation where i need to store a value with a UUID for every player that joins, and i feel this isnt the best way to do this, how would yall typically handle that
Well that depends on what you’re trying to achieve, and what "store" means to you
Well essentially when a player joins, im going to store a number 1-20 next to their uuid, and then mostly read it it, but occasioanlly write as well, i only need to read the value while they're online
it would be better if you explain what exactly you want to do and why, maybe there is a better solution
So you need to store it even when the player is offline or the server is stopped?
But yeah, knowing what you want to achieve would be better
The real question is do you want it to persist or not
If it's just a number and you don't need it to persist you can just store it in a map
If you do need it to persist, your options are:
MySql
SQLite
Yaml
You can probably just use yaml-based storage in your specific case.
Thanks, i looked into all the options and i think ima do yaml, thanks very much for the help
Wb json? D:
NBT, PDC?
json bad
yeah well forgot about these (tho PDC and NBT is effectively the same thing)
Depends on his version
im using 1.20.1 but i think yaml will work the best
Can I get some assistance with this
https://paste.helpch.at/opivuzoqif.csharp
it's giving nullPointerExpextion
Hi json
Why
For your simple case actually PDC would be the simplest
cuz funny
yo wtf
hows blud tier iv
member since aug 30
im tier 3 member since 2020
his ass is not looking at message history
Hey guys so im writing a grave stone mod for storing a player inventory in a yml file and ive run into a 1.20 issue where since players can color signs in single player they are able to recreate the grave stone signs. Any solutions to avoid this? Besides storing the locations of the signs
you could add PDC to the signs upon creation to distinguish them, otherwise make it so they cant recreate the signs
Yeah disbale making signs with [Gravestone] as the first line
blud is typing about 150 messages per day 💀
I feel like I'm missing something simple... Was testing if my classes are caching, but the method isn't even outputting the strings.
public static void main(String[] args) {
System.out.println(ReflectionBaseRecode.base().parsePlaceholders("{NMSVersion}"));
System.out.println(ReflectionBaseRecode.base().getClassFromPath("com.thecrappiest.library.reflection.single.ReflectionMain"));
System.out.println(ReflectionBaseRecode.base().getClassFromPath("com.thecrappiest.library.reflection.single.ReflectionMain"));
}
public Class<?> getClassFromPath(String path) {
System.out.println("Path >> "+path);
String parsedPath = parsePath(path);
System.out.println("Parsed >> "+parsedPath);
```Output```
net.minecraft.server.v1_20_R2
class com.thecrappiest.library.reflection.single.ReflectionMain
class com.thecrappiest.library.reflection.single.ReflectionMain
are you able to show more code?
That means that that method isn't being ran, so without more info I don't think we can really help
Thats basically all the code but yeah I can show the rest.
The methods are being ran as the output is returning the right class both times.
then either it's not building correctly or you have a duplicate method, unless there's something else that I'm not thinking of
but with the info right now, I don't think there's anything I can say besides running in debug mode (shift f9 instead of shift f10 i think)
and putting breakpoints
actually yeah i think thats a good idea
public class ReflectionBaseRecode {
private static ReflectionBase instance;
public static ReflectionBase base() {
return instance = instance == null ? new ReflectionBase() : instance;
}
public Class<?> getClassFromPath(String path) {
System.out.println("Path >> "+path);
String parsedPath = parsePath(path);
System.out.println("Parsed >> "+parsedPath);
System.out.println("Cached >> "+cachedClasses.toString());
if (cachedClasses.containsKey(parsedPath))
return cachedClasses.get(parsedPath);
try {
Class<?> retrievedClass = Class.forName(parsedPath);
cachedClasses.put(parsedPath, retrievedClass);
return retrievedClass;
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return null;
}
}
yeah that looks right, use the debugger
you aren't doing anything with the output right?
Like this is normal and default System.out (no System.setOut or whatever it is) into a normal and default terminal? (or intellij terminal)
Normal output. (Eclipse)
I assume eclipse has a debugger with breakpoints and stuff as well
IJ for example allows you to press a button which lets you go line by line and inside methods, I assume eclipse does as well
Doubt it. I'll look
yeah it does
Just has "Debug as" which essentially just runs the program
look at Stepping
Step Into -> go inside method
Step Over -> next line
Step Return -> exit method
Checking
idk just saw it on https://www.eclipse.org/community/eclipse_newsletter/2017/june/article1.php
#4
Not seeing any different outputs
then ig the only thing left is to post a full code example on like github
if it still doesn't work, then it's an issue with something in your environment that differs (ex using eclipse, or if using eclipse's build tool, that too)
wait
so you used the debugger
it passed through the print statements
so yeah either eclipse or its tool is bugging, or you modified terminal somehow either via eclipse or code, could've been intentional or accidental
IDK honestly. I added the breakpoints and it didn't add any additional output.
nono use the stepping
not just breakpoints
or wait
did the breakpoints stop the code in the method?
that isn't printing
Do I add break points to every line thats suppose to run?
usually you'd use the stepping features in the link above but if you can't find it (I never used that feature in eclipse so I have no idea on where it is and stuff), then I guess that works too..
but anyways I'm gonna go sleep
Feel free to post a fully reproducible example on GitHub with maven or gradle files included (if used)
I got the Debug perspective to show. Looking thorugh it now. Thank you, have a good night.
🤦 Instance is ReflectionBase rather then ReflectionBaseRecode
Recoded the single portion. https://github.com/TheCrappiest/ReflectionLibrary
I wish github would allow you to modify without commiting. I know thats the system of git.
just don't commit the changes?
How the hell would that even work lol
You’re basically saying “i wish i could edit a file without saving the file”
you can
idk how to do it in command line but in intellij you can select certain portions to commit
by portions I mean like if you modify lines 1-3 and 6-8, you can choose to only commit lines 1-3
I have had usecases where I forgot to commit something and didn't want to commit more than what should've been in that commit
2 commit messages go brr
and the new portions of code wasn't ready yet
- multiple commits
- rollbacks
- stashing
I have that sometimes too
I just f it, finish both and commit both with 2 messages
Amend would like a word with you
real
no that's not what I mean
oh
u mean for the 2nd commit?
Commit, realise you forgot something, amend the commit with new content, force push
nono I forgot to commit
No that's not the issue
skill issue
anyways turns out stackoverflow has the answer in cli for @hoary scarab: https://stackoverflow.com/a/1085191/14105665
https://stackoverflow.com/a/1085202/14105665
git gui is a thing??
Lmao yes?
...
that's cool
thats the way I started with git
with github desktop
commands were too confusing lol
Thats still committing. I don't want the old code available.
Basically I want a text host but with a file display like github.
It doesn't have a "tree" file system.
just branch off main and commit changes to that
then merge it into main when ur happy with ur changes
basic git stuff
what about rollback and force push?
or amend and force push?
force pushing to main is cheeky
Forcepushing still displays a commit and what was updated.
just put commit message as empty
it will show the whole file being added as "what was updated"
if you always force push
no it doesnt
force pushing just pushes ur naughty changes
if you always amend & force push, there will always be 1 commit
is what i meant by that
yeah just amend ur previous commit and it wont add a commit
but why do u wanna hide what you changed if its literally there
I know. I think people are skipping that portion of my message lol.
I don't like that part of github.
interesting
you're misusing github
I can't think of any software right now without googling for the use case you have though so I didn't mention it earlier
Like you said it shows updated or added files though
you can ignore it
the 1 commit will just be "added file x" or "added files x"
it won't show you which files
or what lines were modified
because that 1 commit would cover everything
make an empty git repo
every time you make a file change, delete .git and make a new repo
force push
"profit"(?)
this is insanely dumb but
why delete .git 🤨
to remove all the commit history?
I kinda did that but deleted the whole repo instead of forcepushing lol
what
wb amend or rollback
that works too but its almost more effort
amend?
tbh idk what it is on cli but on intellij its very simple so I assume it's very simple on cli as well
Yeah just to clarify, I know how git works.
I want basically gits UI and file management but without commits. You can see the source code as is no older versions no updates etc...
So just a text website like pastebin but be able to clicking through the files with a ui.
Just don't wanna bother making it myself.
you may know how git works, but you are misusing git - that's not what the purpose of git and github is
#development message
So just always ammend to the first commit?
I know it's purpose. I don't care if I'm misusing it lol
it seems like theres a big difference between "version control doesnt matter" and "i actively want to remove the version control aspect"
curious about the reasoning for the latter
if it's some security through obscurity thing, that's a bad idea
Basically I only ever want to show the latest code. That's it.
idk at this point use like google drive or dropbox lol
Doesn't have the ui I like though.
Cause that's what I want.
not really a reason but ok
birstern stop asking!!!!
I can force push I read that. Didn't say I can't use it. Just clarified what I was asking.
And what harm will having a history be?
there must be a reason why you feel so strongly about this, if it's this reason, that's very misguided at best
^^ even if you dont use it, it's not like it hurts having it
okay, but it sounded like you were clarifying it to sparky and I, who both understand what you are asking, so I thought you missed the answer
seems like it's FAR easier to just ignore the history than making your own github replacement
he wants what he wants stop gaslighting!!!
It's just preference. I don't like having the previous updates posted.
get help
Nah posted it after m0dii's message (not directly)
I'll just stick with force pushing I was just hoping I can just upload it the same way without additional steps.
Well the whole point of git is to track changes so it's kinda expected that it'll take an extra step to not
Don't want a full github replacement...
I mean I wouldn't even mind like jet packs file management ui and then a simple text page for the class files.
or if you just want to clear history run:
rm -rf .git
git init
git add .
git commit -m "Initial commit"
git remote add origin git@github.com:foo/bar.git
git push -u --force origin main
after every commit
could probably automate it with cli
amend :)
also idk if its some setting but you might also just be able to do git push --force
btw whats -u?
short for --set-upstream
oh
Just amend all commits and force push and boom your project will always only have 1 commit :')
This is so stupid lmao
Brister with the recode what do you think of the library now?
Why would I do that?
because I told you so
Shut up
Sorry
hop on tf2
I’ll look soon if I don’t forget
👍
You know I’m right
Does anyone know how to get rid of this?
[16:53:28 WARN]: Found inconsistent skull meta, this should normally not happen and is not a Bukkit / Spigot issue, but one from a plugin you are using.
Bukkit will attempt to fix it this time for you, but may not be able to do this every time.
If you see this message after typing a command from a plugin, please report this to the plugin developer, they should use the api instead of relying on reflection (and doing it the wrong way).
https://github.com/TriumphTeam/triumph-gui/blob/9339472c84bc90075a5eacb82e305e7daa27248b/core/src/main/java/dev/triumphteam/gui/builder/item/SkullBuilder.java#L74-L102
According to the Paper team, all we need to do in 1.20.2 is to provide a name, but idk what to do about that warning
I assume just add a string in the name param...
I mean the warning tells you what to do
Welp, I gotta see how they do it internally 😦
Does paper now have an api for setting the player head texture?
And how do you make a player profile?
https://jd.papermc.io/paper/1.20/org/bukkit/profile/class-use/PlayerProfile.html
Bukkit#createProfile
Cool, finally
how do you know?
is that spigot or paper?
Spigot
Paper has had one for a long time, since like 1.12 or whatever, Spigot recently added a profile API this year I think
Oh I see
is serializedprofile a new thing in 1.20.2?
Ig it depends, if you are talking ab spigot it was probably added recently since PlayerProfile only exists since 1.20.1
you should make a
PlayerHeadProfileSetter interface
and depending on the profile API availability pick one instance or another
yes yes
peak software design
and a factory
serializedProfile field is available since 1.16.5 (idk if older versions too, i guess)
Anyone know why only the last expansion is registered and loaded correctly?
They are all set up like this https://paste.helpch.at/dicineketa.typescript
Only difference is the onRequest method
it's tied to your Plugin instance lmao
Can anyone help? For some reason this code ONLY works on a single chest not a double.
public void onInventoryOpenEvent(InventoryOpenEvent event) {
InventoryHolder holder = event.getInventory().getHolder();
if (holder instanceof Chest || (holder instanceof DoubleChest && holder instanceof Inventory)) {
Player player = (Player) event.getPlayer();
boolean signFound = false;
if (holder instanceof Chest) {
Chest chest = (Chest) holder;
signFound = checkChestForSign(chest, player, event);
} else if (holder instanceof DoubleChest) {
DoubleChest doubleChest = (DoubleChest) holder;
Chest leftChest = (Chest) doubleChest.getLeftSide();
Chest rightChest = (Chest) doubleChest.getRightSide();
if (checkChestForSign(leftChest, player, event) || checkChestForSign(rightChest, player, event)) {
signFound = true; // A valid sign is found on either side
}
}
if (!signFound) {
// If no valid sign was found, cancel the event
player.sendMessage("BLOCKED");
event.setCancelled(true);
}
}
}```
Block chestBlock = chest.getBlock();
BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
for (BlockFace direction : directions) {
Block signBlock = chestBlock.getRelative(direction);
if (signBlock.getState() instanceof Sign) {
Sign sign = (Sign) signBlock.getState();
if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
&& sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName())) {
event.setCancelled(false);
return true; // Exit the loop if a valid sign is found
} else if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
&& !sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName())) {
event.setCancelled(true);
player.sendMessage("§6§l[Lockit] §athis chest is locked by " + sign.getLine(1));
return true; // Exit the loop if a valid sign is found
}
}
}
return false; // No valid sign found
}
}```
This is my orginal code that also worked but\ double chests did not work.
public void onInventoryOpenEvent(InventoryOpenEvent event) {
if (event.getInventory().getHolder() instanceof Chest
|| event.getInventory().getHolder() instanceof DoubleChest) {
// Get the block of the chest
Player player = (Player) event.getPlayer();
Chest chest = (Chest) event.getInventory().getHolder();
Block chestBlock = chest.getBlock();
// Define the possible directions to check for signs
BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
for (BlockFace direction : directions) {
Block signBlock = chestBlock.getRelative(direction);
if (signBlock.getState() instanceof Sign) {
Sign sign = (Sign) signBlock.getState();
if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
&& sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName().toString())) {
event.setCancelled(false);
return; // Exit the loop if a valid sign is found
} else {
if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")
&& !sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + player.getName().toString())) {
event.setCancelled(true);
player.sendMessage("§6§l[Lockit] §athis chest is locked by " + sign.getLine(1).toString());
}
}
//SIGN was FOUND BUT it was not a lockit chest.
}
}
}
}
}```
Have you tried it without holder instanceof Inventory? I don't see why you would need to have that
Good catch that was it LOL
I figured haha. Try using debug messages next time when in doubt, it usually helps you figure out whether it's stopping midway and whatnot
Well that was the thing right: so it was working on regular chests just fine LOL I thought somthing with DoubleChest was bugged or it was wrong
public void onBlockPlace(BlockPlaceEvent event) {
// Get the placed block and player who placed it
Block block = event.getBlock();
Player player = event.getPlayer();
// Check if the placed block is one of the allowed sign materials
if (block.getType() == Material.OAK_WALL_SIGN || block.getType() == Material.ACACIA_WALL_SIGN
|| block.getType() == Material.BIRCH_WALL_SIGN || block.getType() == Material.BIRCH_WALL_SIGN
|| block.getType() == Material.SPRUCE_WALL_SIGN || block.getType() == Material.CRIMSON_WALL_SIGN
|| block.getType() == Material.DARK_OAK_WALL_SIGN || block.getType() == Material.JUNGLE_WALL_SIGN) {
// Define the possible directions to check for other signs
BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN };```
// Iterate through each direction to check for other signs and a chest
for (BlockFace signDirection : directions) {
Block possibleSignBlock = block.getRelative(signDirection);
// Check if the block in this direction is a chest
if (possibleSignBlock.getState() instanceof Chest || possibleSignBlock.getState() instanceof DoubleChest) {
Chest chest = (Chest) possibleSignBlock.getState();
// Now, check if the chest contains a Lockit sign
Block chestBlock = chest.getBlock();
BlockFace[] chestDirections = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST, BlockFace.UP, BlockFace.DOWN };
for (BlockFace chestDirection : chestDirections) {
Block possibleChestSignBlock = chestBlock.getRelative(chestDirection);
if (possibleChestSignBlock.getState() instanceof Sign) {
Sign sign = (Sign) possibleChestSignBlock.getState();
// Check if the sign text matches the Lockit format
if (sign.getLine(0).equalsIgnoreCase("§6§l[Lockit]")) {
// Cancel the placement and notify the player
event.setCancelled(true);
player.sendMessage("§6§l[Lockit] §cthis chest already has a lock on it.");
return; // Exit the loop if a valid chest is found
}
}
}
}
}
}
}```
@void orchid if you could take a look at this, for some reason this code is working for regular chests but not doublechests.
Using debug messages to verifying your assumptions would work too; you won't believe how many times a set of code can look fine at first sight but ends up acts in many unexpected ways
Try applying that to the code above, I am sure you will be able to figure it out
@void orchid im curious if you have any ideas on this; im worried about players in survival being able to recreate the signs for my plugin in the wild since now players can color their own signs. Any ideas on how to stop this easily without needing to go crazy like storing locations of signs etc?
Depends on your ultimate goal. I think you could add metadata to the sign's block when an authorized person performs the action; this way you are able to differentiate legitimate from illegitimate ones plugin-wise. But now whether that is easier, it depends on your experience
I was able to figure out that GOLD and BOLD are impossible to do in survival so im safe on that
Nice!
Check ur dms if u can
Like i have told you before you can just use PDC on the sign
Then you can format your sign however you want
I could yeah, fortunately i can skip that since players cant recreate the sign since gold isnt a dyeable color
Is it not? Isn’t that orange dye?
Nope thats orange
You also cant make text bold
if you look in game it is not the same
fair yeah
Is it?
tip here btw you can convert the sign thing to a string and check if it contains “SIGN”
will make it cleaner
bro…
@rich lance @void orchid
So this is the code Im using to handle chest breaking so unwanted players cant break a locked chest.
However; What is happening is chests placed diagnoglly from the chest with the sign get the locked properties (in addtion to the fact that double chests do not get protected at all, which I think is releated to how the sign is being calculated) (Also bukkit.broadcast debug never comes up.
public void onChestBreak(BlockBreakEvent event) {
Block chestBlock = event.getBlock();
BlockFace[] directions = { BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST };
if (chestBlock.getState() instanceof DoubleChest){
Bukkit.broadcastMessage("debug");
}else
if (chestBlock.getState() instanceof Chest || chestBlock.getState() instanceof DoubleChest) {
for (BlockFace signDirection : directions) {
Block possibleSignBlock = chestBlock.getRelative(signDirection);
if (possibleSignBlock.getState() instanceof Sign) {
Sign sign = (Sign) possibleSignBlock.getState();
if (sign.getLine(0).equalsIgnoreCase("§6§l[Locked]")) {
if (!sign.getLine(1).equalsIgnoreCase(ChatColor.BOLD + event.getPlayer().getName())) {
event.setCancelled(true);
event.getPlayer().sendMessage("§f§l[§6§lChest§7§lLock§f§l] §cOnly §a"
+ sign.getLine(1).toString() + " §ccan edit this §6§llock§c.");
event.setCancelled(true);
return; // Exit the loop if a valid chest is found
}
}```
Yep I learned that far to late after doing it
RIP: Bukkit: Material.SIGN_POST
just so you don’t have to add a huge if statement like that
block.getType().toString().contains(“WALL_SIGN”)
Thanks! ill have to go in and clean that up later
Any idea on the diagonal and double chest issue from above?
Why not simply just track the chest when it gets locked initially?
To avoid unwanted stuff
How do you lock the chests anyway?
The sign acts as the lock ie: if the users name is not on the sign it wont open
It actually works flawlessly expect for the double chest and diagonal \chest issues
so I can just put anyone’s name on it?
no I mean when creating the sign
So what I did is for Line 2. and 3. you can add users names, but line 1 is auto set to your name and line 0 is autoset to [Locked] gold and bolded
So basically you put a chest and then you add the sign to lock it right?
sender.sendMessage("-");
sender.sendMessage("1. §fTo create a locked chest, place a sign on any chest with the first line being §6[lock]§f.");
sender.sendMessage("-");
sender.sendMessage("2. §fYou can allow multiple users (up to 2) to have access by adding their names to §c3nd and §c4th §flines of the sign.");
Yep
that’s nice I see. Okay well basically what you could do is use the code for the initial locking to stamp the chests using PDC, then it should be a simple check later to see if a chest is locked or not
The issue im facing is around determining if a sign is attached to a chest or not but since im using the faces of the chest to determine that IF a chest is placed diagnol to the locked one it also gets the locked features
for PDC how can you add that to a placed sign?
PersistentDataContainer pdc = event.getBlock().getBlockData()
pdc.set(test, PersistentDataType.INTEGER, progress);
im not sure how you would edit block meta?
send your class
@craggy gale where is the one that registers a locked chest?
Here ill do somthing real quick
https://pastebin.com/fpUjgmKp - handles creating of the sign and locking the chest
https://pastebin.com/nM2Uq9FZ - handles opening the chest and determining if the sign is on it
https://pastebin.com/gpqDP0v7 - handles breaking the chest if you are not the owner
yea thats what i wanted
so you can make a pretty simple method here
all ears
actually might need my IDE for this lol


