#development
1 messages · Page 78 of 1
oh?
It’s used in other plugins
To simplify stuff like handling configs etc
And chatutil and so on
That will be used as a separate jar in each thing?
Like, you'll put ValdemarF-Lib.jar or whatever in your Paper backend server and your Velocity server?
Not sure if all plugins using the library should shade it or have it at runtime
I think have it at runtime
Because multiple plugins on each backend server will probably use it
Plugins using the library, if the library is a .JAR file included in the plugins folder and loaded as a plugin by the classpath loader, should ABSOLUTELY NOT shade it
They should compileOnly it and use it at runtime
It won’t be a registered plugin though, that’s not the plan at least, it should work like Configurate basically, other than the fact that Configurate is in the server jar already
The default version of Configurate I mean
I meann you have to have it loaded by the Bukkit classloader somehow lol
Is Configurate also setup as a plugin?
No, because it's exported as a library by Paper
Ah yeah ofc
you don't include the Configurate .jar in your plugins folder lol
Yes, so that it can be loaded by the Bukkit classloader
And optionally like, do other stuff
like maybe if you want a global config for the library, or to have it register some listeners or common things
Alright yeah, that would make sense, but no server would have the common jar would it?
That would just be internal right?
uh, I'm not really sure?
it depends on what you're doing
In the scenario as I understand it, people using your plugins would need like SummitLibs-Bukkit.jar in their plugins folder, plus whatever plugins you make that depend on them
ah I see your question now, yeah you'd only have the specific implementation jar in your plugins folder
Because it should be shaded in the bukkit module
but each specific implementations one would basically just include all the code of the common one
absolutely!
Hello there, I was wondering how I could update the victim's scoreboard inside the if (killer != null) in my onPlayerDeath script. I tried importing the code below into it but it won't work.
int victimKillStreak = killStreaks.getOrDefault(victimId, 0);
int limitedVictimKillStreak = Math.min(victimKillStreak, 5);
ChatColor victimKillStreakColor = getColorForKillStreak(limitedVictimKillStreak);
String coloredVictimKillStreak = victimKillStreakColor + String.valueOf(limitedVictimKillStreak);
victim.setPlayerListName(victim.getName() + " " + victimKillStreakColor + "[" + coloredVictimKillStreak + "]" + ChatColor.RESET);
updatePlayerScoreboard(victim);```
Full onPlayerDeath script: https://pastebin.com/ZCfYshw8
Is this a listener class?
guys how can i disable the plugin name like when i type/warp it says /warp:warp
how can i change whether it shows the name of the plugin or not
Is this your own plugin?
ofc
Just as a side note: This is java, not Skript, we don't call them "scripts" xD
And by scoreboard you mean actual ingame scoreboard or...? If so, in theory you use a scoreboard plugin like TAB or so, and just create a PAPI placeholder and update that.
then the only way is to modify tab completion.
It's an intended feature. If 2 plugins have the same command, that can be used to differentiate between each other.
i know that but i dont need it
well then as said, just modify tab completion
google is your friend, but in short, you would get all the completions, remove those you don't want and set the completer if I recall correctly.
^ yea that’s about right
Yes
Can someone help me with getting the minecraft server's ip address without port?
So like: 82.3.122.112
i need it for an api call
The reason why i can't use plugin.getServer().getIp() is because my server is on bungeecord, so i don't have the server-ip set in server.properties
public ip?
probably use something like https://stackoverflow.com/a/2939223
I need the dynamic IP address which allows me to join
in java
as a string
wdym dynamic?
numerical
yeah this might work then
it gets the public numerical ip
note that it should run async though
or actually even better - get it once and save it in onEnable, no async needed there
It works, tysm!
By the way, i have the public void inside the onEnable so that shouldn't cause any issues
Not sure if my logic here is right...
I want to ensure, that the = found is after {{r and that the last } is after it...
if(target.toLowerCase(Locale.ROOT).startsWith("{{r=") && target.toLowerCase(Locale.ROOT).endsWith("}}")){
int start = target.indexOf('=');
int end = target.lastIndexOf('}');
if(start < 3){
CachedWarnHelper.warn(expansion, "reg-start", raw, "Index of '=' for Regex is invalid. Needs to be at least 3, but got" + start + ".");
return null;
}
if(end <= 3 || end < (start + 1)){
CachedWarnHelper.warn(expansion, "reg-end", raw, "Invalid index of '}'. Expected at least 4, but got " + end + ".");
return null;
}
Matcher matcher = Pattern.compile(target.substring(start + 1, end - 1)).matcher(text);
}
Hello there, I was wondering how I could fix my onPlayerDeath javascript so that the correct killstreak is displayed over the players head. It keeps telling me there is an Invalid killstreak placeholder for the player but I don't know how to fix it. And my scoreboards aren't updating in real time. Here is my full code.
Why not substring after the first {{r then?
Can I get help development for php and web dev here it is related to minecraft kinda
yes
okay so when I click logIn instead of taking me to userdata.html it just takes me to http://127.0.0.1:5500/LogIn/logIn.html# I dont know if its the php file because when i run it by its self it gives me Username: Password: {"error":"Invalid username or password"} this is my js https://paste.helpch.at/opogopexug.js and this is my php https://paste.helpch.at/sididitare.php i did blur out the info stuff at the top and keep in mind im very new to php and web dev
this is what my database looks like https://imgur.com/a/5cNL08V
Idk
anyone knows how does minecraft authentication works?
not packet protocols but like the process to get access token after logging in with microsoft account
should be it
Why is wait (\d+) seconds not matching wait 5 seconds?
Matcher matcher = getMatcher(task);
int time = Integer.parseInt(matcher.group(1)); // this line
java.lang.IllegalStateException: No match found
what does getMatcher do?
public Matcher getMatcher(String string) {
return getPattern().matcher(string);
}
you need to call find I guess
basically changed this to:
Matcher matcher = getMatcher(task);
matcher.find(); // added this line
int time = Integer.parseInt(matcher.group(1));
me when i use the regex method lol
ok now a different question. How can i send a title to a player inside completablefuture#runasync
i did tru bukkitscheduler#runtask, but it didnt show the title
Does it work without it?
no
Well if it doesn't work within a runnable you can try with packets as a last resort but if that doesn't work your code ain't runnin
is there anyone actually willing to provide insight on my delima here someone helped me with making my first tab complete class for my pluggin and im trying to add more tab complete args to that command for instance right now its /command <tab completed> <arg> <arg> <arg string builder>
i want to add a tab complete list to the second and third <arg> but these ones would be manually set to static elements the first tab complete is made up of a list of config paths for the worldpoints that are in the config i tried to copy the public tabexecute but its giving me some error on not superclass or what have you so any insight on what i could do to achieve this would be great i even tried to reverse engineer the class to see where the tabex is called in the command etc but its not so im at a loss here and dont want to spend hours scraping through forums and jdocs to try to figure this out
this is the class code as of right now http://ycs.canvaswrite.com/resources/uploads/TabEx.java
declaration: package: org.bukkit.command, interface: TabCompleter
already have that so this wasnt helpful 🙁
args - The arguments passed to the command, including final partial argument to be completed
just read
i do see my error was trying to make a second override but now i have a new issue the matterials list i need to display all and every poissible (including uncraftable) item in the game im only getting ACACIA_BUTTON since its the very first available item alphabetically and its the only tab complete option for all args now http://ycs.canvaswrite.com/resources/uploads/TabEx.java
turn all mats into a list then return that
i did attempt that but im pretty wure what i did was not right
Arrays.asList(Enum.values())
String tabString2 = "";
if (args.length > 1) {
tabString2 = args[1];
}
for (Material items : Material.values()) {
if(items.getKey().asString().toLowerCase().contains(tabString2.toLowerCase())) {
tabComplete.add(String.valueOf(items));
}
}
or you can just stream it
Stream.of(Enum.values()).map(Enum::name).collect(Collectors.toList());
either works
enum here would be material obviously
i would probably cache that list though rather than mapping it over and over on each tab complete request
ok that worked for the item list but im still only getting that list as tab complete instead of the pointnames for the first arg
// Grab the current text the player is typing, or empty String if none
String tabString = "";
if (args.length > 0) {
tabString = args[0];
}
// Go through each point and add values to our list if the player is typing them
for (String pointName : points.getValues(false).keySet()) {
if (pointName.toLowerCase().contains(tabString.toLowerCase())) {
tabComplete.add(pointName);
}
}
String tabString2 = "";
if (args.length > 1) {
tabString2 = args[1];
}
for (String items : Stream.of(Material.values()).map(Material::name).collect(Collectors.toList())) {
if(items.toLowerCase().contains(tabString2.toLowerCase())) {
tabComplete.add(String.valueOf(items));
}
}
// Return our list
return tabComplete;
}
``` this is just a snippet of the full class so you can see what ive put in so far im sure its something silly and small that ive dine wrong here for the first args tab complete
im seeing now the whole list for the tab complete is every item ive added so far but how can i remove a certian section of added elements tot he array when its tab completing to the new arg
String tabString = "";
if (args.length > 0) {
tabString = args[0];
}
what is this even
args gives you whatever they entered already
so, check for size then for arguments themselves
its just what was in there from when the first tabexecuter was given to me so i coppied it assuming its required
Thx a lot man! This is what I’m looking for
Somehow searching it keeps returning the legacy and I thought new one wasn’t understood yet
What is the best way for saving an inventory to MySQL and then being able to loading it back in game
Every item to a json string then map by slot number (or include in json string).
Guessing converting item to json string can be done with GSON right?
The only thing I know of built in is ItemStack.serialize() but its for yaml.
for (String items : Stream.of(Material.values()).map(Material::name).collect(Collectors.toList())) {
You're already using a stream why reloop?
Hello I was wondering how I would fix the errors in the lore in my script. It displays this error to me in console: "Tag not valid: {display:{Lore:['{"text":"","extra":["Re-roll your Boost to any random number between 1-5"]}'],Name:'{"text":"","extra":["Reroll Book"]}'}}"
public void onPlayerUse(PlayerInteractEvent event) {
Player player = event.getPlayer();
ItemStack item = event.getItem();
// Check if the player is using a reroll book
if (item != null && item.getType() == Material.KNOWLEDGE_BOOK) {
ItemMeta meta = item.getItemMeta();
if (meta.hasDisplayName() && meta.getDisplayName().equals("Reroll Book")) {
// Create a list for the lore
List<String> loreList = new ArrayList<>();
loreList.add("Re-roll your Boost to any random number between 1-5");
// Set the lore to the meta
meta.setLore(loreList);
// Set the meta to the item
item.setItemMeta(meta);
// Update the item in the player's hand
player.getInventory().setItemInMainHand(item);
// Remove the reroll book from the player's inventory
item.setAmount(item.getAmount() - 1);
// Create a new Random object
Random rand = new Random();
// Generate a random killstreak as soon as the reroll book is used
int killStreak = rand.nextInt(5) + 1;```
Does Deluxemenus have a API ?
its not meant to be used as api
just save as the given yaml format
Does EntityDamageEntityEvent run when a player is hit by an arrow shot by another player?
yes
check for damager
if arrow get its shooter
dont have a fix for the issue but you should make one instance of Random and then reuse it everywhere instead of making a new object every time
Does anyone know how to make a chest menu in the deluxe menu plugin?
Not really a #development question, deluxemenus doesn't have an api
If you mean like a personal player vault that a user can store items and later retrieve them though, you can't do that
I use a serialization with base64 to save an inv to a string in a pdc to recall it to the player at will i can share how i did it if you’re interested
Because when i did that i only got acacia_button as an option nothing else but thats not the issue now i’m having an issue with the list of tab completables being every single item i’ve added so far instead of a specific set per arg so regardless of what arg i’m on it shows all items and all static sets i’ve made instead of just that args set of array items
I'd like to see if possible
I’m not at my desk right now but i can provide the git repo https://github.com/newtX00/worldPoints.git
Is it private?
@fading stag - Yeah, the repository is private but the gist I'm about to link you should do the job. If you're saving a non-player inventory, I linked you the method directly (named toBase64), otherwise search for the playerInventoryToBase64 method which is at the very top. https://gist.github.com/graywolf336/8153678#file-bukkitserialization-java-L63
was just about to post that one as well
:)
Thanks
Description: Initializing game
[22:53:17] [Thread-3/INFO]:
[22:53:17] [Thread-3/INFO]: java.lang.RuntimeException: Could not execute entrypoint stage 'client' due to errors, provided by 'auto-miner'!
....
at de.rainix.autominer.client.AutoMinerClient.onInitializeClient(AutoMinerClient.java:24)
[22:53:17] [Thread-3/INFO]: at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
[22:53:17] [Thread-3/INFO]: ... 7 more
[22:53:17] [Thread-3/INFO]: Caused by: java.lang.ClassNotFoundException: net.minecraft.util.math.Vec3i
line 24: import java.util.Random;
anyone any clue why this occurs and how to fix it?
code?
but Caused by: java.lang.ClassNotFoundException: net.minecraft.util.math.Vec3i this line makes me assume
you did not include / did not remap
well it should be included (using gradle btw)
sounds like you need to remap your jar
not sure if thats the issue
suit yourself
Hello, I have 2 databases: gitea (as example) and luck perms database. The first one was created by its user itself but the second one was created by postgres user and later transferred to luck perms user, now it looks like this:
gitea | gitea | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
luckperms_proxy | luckperms_proxy | UTF8 | en_US.UTF-8 | en_US.UTF-8 | luckperms_proxy=CTc/luckperms_proxy
The problem is that if I remove all privileges at luck perms database from luck perms user then it gets unable to interact with that database from its user BUT gitea db hasn't any configured privileges and gitea is able to interact with its database
My bad i forgot its a private repo i was pretty sure sharing the link would allow you to see it but i suppose not
Omg and it wasn’t even the right repository anyway 🤦🏼♂️
To resolve this, you can grant the necessary privileges to the luckperms_proxy user on the luckperms_proxy database
Ofc I can but the question is still open: why can't the owner (even if it was reassigned) fully interact with owned db..?
In PostgreSQL, the owner of a database does indeed have full privileges to interact with the database. However, these privileges apply to the database itself, not necessarily to all the objects within the database such as tables, views, sequences, etc.
When you reassigned the ownership of the luckperms_proxy database from the postgres user to the luckperms_proxy user, the luckperms_proxy user became the owner of the database, but not necessarily the owner of all the objects within the database. The ownership of these objects would still be with the original owner, i.e., the postgres user.
If you then removed all privileges from the luckperms_proxy user, it would lose its ability to interact with the objects within the luckperms_proxy database, even though it is the owner of the database.
To allow the luckperms_proxy user to interact with the objects within the luckperms_proxy database, you would need to either:
- Grant the necessary privileges on the objects within the database to the
luckperms_proxyuser, or - Reassign the ownership of the objects within the database to the
luckperms_proxyuser.
Ah, didn't know that it works so, thought that if I reassign the owner of the database then ownership of its sub objects will be reassigned as well, thank you
chatgpt looking ahh
Configurate question:
I have no clue why, but this (https://paste.helpch.at/kuqoguvuhi.kotlin) throws an exception when trying to referenceTo this simple test class
@ConfigSerializable
public class Test implements LocaleReference {
@Setting
@Comment("Whatever")
private final int num = 2;
}
Error: https://paste.helpch.at/idifogebov.rb
If anyone got an idea it would be a huge help! :))
Important part: java.lang.RuntimeException: com.summitrealms.summitlibs.configurate.serialize.SerializationException: [] of type com.summitrealms.cosmetics.cosmetic.attributes.particles.Test: Unsupported typeio.leangen.geantyref.TypeToken$1@fcaf5bbb
idk but relocate gentyref
Oh, didn’t know that was required, why?
I just use the version from paper or Configurate, forgot where
if its inside ur plugin jar it should be relocated
presumably its a transitive dependency of configurate
Is that the case for all shaded libraries / apis?
I thought it was only if there’s another version at runtime as well
For example in the paper jar
it is
but because bukkit is so ass class loaders arent isolated
so if any other plugin has the same classes youll get conflicts
Is that bad if both are identical?
As in 2 libraries at same version
like between two plugins?
Like if I shade Configurate at exact same version as the one inside the paper jar
So both versions are identical, are conflicts then an issue?
if its provided by paper you dont even need to shade configurate
That’s true, so the issue comes if there’s two different versions of same class?
yea
Gotcha, I don’t think that’s the issue in this case but it might, will try to relocate it tmr
Thanks for the help! :))
Yeahhhh no response yet tho
how do i get SQL Dev without an oracle account 
ughhh seem like i will have to give up my personal data to them again
yes, at least that's right 😂
/tp snowball coords 😏
nah im not sure if there is any easy way to do that, you are probably facing a whole bunch of math
but maybe you can use a skeleton ai
have it target a thing at that block and fire an arrow, then steal the velocity
seems scuffed though
really wish i did calculus
dkim moment
i meant if you did the /tp
i think setting velocity would be fine
ah, yeah
just calculating it is something I can't do, yeah
the math itself shouldn't be difficult, but finding out what values to put it as probably will
nah you should be able to extrapolate the values from your input coords / gravity
you'd want to check the speed of a normal snowball and use that speed
and gravity
yeah
then the angle is all you need I suppose, but 🤷♀️
I don't think player velocity works the same because the player is in control, but I'm guessing
for ex idk if theres any documentation on what the amount of gravity is
although you could probably make a plugin to calculate that
yeah i think players have air resistance and other stuff to worry about, i dont think projectiles have that
actually there is a wiki where they like decompiled the movement code
oh i forgot about that
and there's also https://www.mcpk.wiki/wiki/Vertical_Movement_Formulas
what about not player
I mean I assume it's the same
I hope it's the same
🙃
https://i.imgur.com/gHB87z4.png
ignore the image I sent before
2% drag
😏
oh you didn't want a snowball really?
oh
i think the teleporting zombie might be laggy
wait whats the end goal
i missed that, yeah
to move the player?
Are you looking for a straight line? or something more like a snowball throw with an arc
is the player the one deciding where they are thrown
if so ender pearls are your friend
or snowballs ig
why on an entity?
so in an arc?
if the end goal is just to make the player fly to a certain location (on an arc), then honestly the best thing here is probably to just make up your own values and do simple trig
probably so the player wont move midair
imo 20hz teleporting is probably the best thing to do here
or else theres gonna be a lot of effort in finding out what values to put velocity as
i dont think so, if you can make a program do the math once it can do it a million times
then you just draw a preview in-game of the path
ah
and you can just eyeball it and export the values you want from there
wait wdym make a program to do that
like spawn a million snowballs with different velocities and track each location?
no
like if you're doing the math to determine the arc, you are no loner limited to just using it to throw a snowball
you can do whatever you want with that arc
if you don't want it to be laggy, it has to follow minecraft's physics with 1 set velocity at the start
except 3d
oh i forgot about 3d 🥲 (at least with the /tp method though, you can just treat it as two 2d planes i think)
🙂
o
its also partially random
don't know how much that impacts it though, but for large distances it wouldn't really work well if you were to set 1 velocity at the start
if it's being calculted then shouldn't matter
i think
man, i really want to try doing this
nevermind that's when it's in the ground
🥲
issue is that it doesn't take into account air resistance and stuff
without air resistance, it's just these 3 equations (x = position)
yeah, ex a = 9.8
although you'd still have to use #development message (probably some more straightforward formulas online)
32 m/s?
ooo they have different gravity
thats a high number-
right...
lol
some errors tho
idk
reeddit
i would just set a snowball with no velocity and track it's movement
figure out gravity ig
true
where can i find the updated map color id's for 1.20.4?
or do i have to look through some registry
hello, i am using Citizens API and Sentinel to create some type of bot and i want to send a message to the player when they kill a NPC i tried using onPlayerDeath but that doesnt seems to be working..
@EventHandler
public void onPlayerDeath(PlayerDeathEvent event) {
Player victim = event.getEntity();
Player killer = victim.getKiller();
if (killer != null && CitizensAPI.getNPCRegistry().isNPC(victim)) {
String npcName = CitizensAPI.getNPCRegistry().getNPC(victim).getName().toLowerCase();
List<String> deathMessages = new ArrayList<>();
deathMessages.add(" ");
deathMessages.add(formatColors("̚dff&lғʟᴀʀᴇ"));
deathMessages.add(formatColors("&7You defeated " + npcName + "."));
deathMessages.add(" ");
for (String message : deathMessages) {
killer.sendMessage(message);
}
}
}
Probably need to search those plugins apis for a death event.
Have you tried doing a debug to see what the entity type is by returning a message with the event target
Probably not going to achieve the desired outcome given the entity is entirely specific to citizens but it could help possibly
will try, thanks
does boundingbox#contains not include the actual border of the box?
what
I don't think so as it wouldn't be "containing" that location. Could be wrong though.
Positions exactly on the minimum borders of the bounding box are considered to be inside the bounding box, while positions exactly on the maximum borders are considered to be outside. This allows bounding boxes to reside directly next to each other with positions always only residing in exactly one of them.
what
what
so im trying to spawn a client side entity and make it move https://paste.helpch.at/jadeboguwa.java but i keep getting this 30.03 08:57:12 [Disconnect] User [08:57:12 INFO]: Msked has disconnected, reason: Internal Exception: io.netty.handler.codec.EncoderException: java.io.IOException: Can't serialize unregistered packet
you are subclassing a packet, creating your own type
why are you overriding the write method to not send any of the packet info?
citizens npcs are classed as humanentity's not players afaik
so use entitydeathevent and cast to humanentity
Hi, does anyone know how to patch the Ancient Debris dupe with Fortune?
With some configuration, directly by programming... Something?
Since I am a bit inexperienced in programming and it has given me some headaches to correct this... 🤣
When resetting a world using a world reset plugin (or copying world folder and loading it)
world uuid is the same?
how?
I changed it here but still same issue
ClientboundMoveEntityPacket movePacket = new ClientboundMoveEntityPacket(spawnPacket.getId(), (short) (x[0] * 32), (short) (y[0] * 32),
(short) (z[0] * 32), (byte) location.getPitch(), (byte) location.getYaw(), true, true, true) {
@Override
public void write(FriendlyByteBuf ignore) {
}
};
ps.send(movePacket);```
huh
already figured it out, thank you!
Why does Team#removeEntry and Team#addEntry kinda lag players client sided for a split second
In doing this on leave & join and when loads of people leave at once. My game just stops responding, for some players it’s fine and responds but lag spikes occur. And it’s only on these two methods
What NBT type is display? I thought it would be NBTTagString since its a json string but its not.
it's a compound tag
it holds other tags, like Lore (string (json) list), and Name (string (json))
🤦 literally just figured that out. Thank you though.
Triumph GUI
Fixed
what are you expecting and whats the exact placeholder you are trying to test?
I would like to know if there are any public, available benchmarks comparing using the WorldEdit API vs using NMS directly to set blocks, or if anyone here has already done this comparison and know the answer (how they stack against each other)
I'm curious because I am performing maintenance in a plugin that has to modify a lot of blocks (next to each other, up to 150K blocks), and the current logic is using NMS to do that, but I remembered that WorldEdit has an API to set tons of blocks at once, and I would like to use it instead of NMS if the performance hit is not that big, because that means the plugin won't have to be updated on each major MC update.
I know that using WorldEdit API is going to inevitably be slower than NMS, what I wanted to know is if this performance hit was already benchmarked before, so I can make an informed decision faster. I'll benchmark nonetheless, but if you tell me the performance hit is huge I might just skip testing it altogether.
This is how the plugin is currently doing the updates using NMS, if that serves as reference. Since I haven't much experience with NMS, I'm not able to explain the decisions and tradeoffs made by this code snippet.
https://paste.helpch.at/ewugedotoz.typescript
Please ping me if you answer.
I don't know of any publicly posted comparisons, over the years though I've definitely found using nms methods is much faster as you can chose what occurs rather then doing hundreds of updates for setting a few blocks.
Also there is a thread posted from 1.14, that still works today, of most of the set block methods and their ranges for performance.
What exactly happens when you set a block via NMS, what ends up not running when compared to normal spigot setBlock method?
you can disable updates and other side effects when using the WorldEdit API tho
Ah see that's new ^^^
You disable Physics, block updates, light updates, notifiy etc...
Hey, I am looking to make a certain chucks a separate instance to the player inside it, if they were mining, users will only be allowed to break certain blocks. and will not effect other instances of that area. does anyone have any advice on how I can move forward wiht this
I am using the paper api
like lets say a collection of players are inside a chunk
if player a breaks a block
player b, c, d cant see that only player a
dev-general vanished so.. just wanted to randomly say that javacord is quite cooler than jda
I take that back
lol
quite rapid regrets
hmmm, where 5th usage
The last one is both a read and a write, so 2 usages
how do we detect a respawn anchor death event, OnPlayerDeath doesn't seems to be triggered when a player is killed using Respawn Anchor
its not the respawn anchor that kills the player its the explosion, try when a player interracts with a respawn anchor
So, how do I remove a packet. I tried sending a packet of 0, but that doesn't really remove the last that was 9. how do I go about remoing the 9 animation?
container.getIntegers().write(1, animationStage);
protocolManager.sendServerPacket(player, container);```
Is there a way to change the glow color of players without changing the tab name color?
I've got a Minecraft plugin which uses a production URL for api requests. Right now I have to manually change the URL and compile the plugin, which really isn't ideal.
I see that people like Aikar have launch flags like -Dusing.aikars.flags=https://mcflags.emc.gs on boot, if I added my own, how can I check this flag within my plugin?
I thought it was something in RunTime?
though most likely not all of then are going to show up
you want to use System.getProperty(...)
Ah thanks folks! Yeah, System.getProperty worked a charm
I use a local url for testing, and I've been constantly recompiling when it comes to the production plugin. Of course, it's a pain if you ever forget to change them back, or you commit the local name etc
Now I've swapped the code to..
String url = System.getProperty("tebex.analytics.url", String.format("https://analytics.tebex.io/api/v%d", API_VERSION));
Using it like so..
-Dtebex.analytics.url=https://tebexanalytics.test/api/v1
This is a lot easier
no config.yml?
Nice idea, I did consider this option - though this is mainly solely for me to test the plugin with.
If I ever need to test a fresh install, it would be a nightmare to set the value each time.
I mean surely you'd need to set the launch property each time anyways? lol
idk I had a similar thing when I couldn't figure out how to get Velocity configs to work, ended up just hardcoding the secret for a while lol
System property best, just set it once on your test environment and don't have to worry about it again
Yeah I believe this was my main reason for going down this avenue ^ I have a start.sh file and now I just launch the server and it auto uses my local instance instead.
I can delete the config files and launch it, and never have to change or recompile the plugin
at this point just go full .env 😌
If only we could put startup flags into a .env 😂
yeah where's the Java dotenv package
it's really nice to work with in like every other language lol
Would be good for paper to have this
^^^
The "aikar" flags alone are crazy lol
so basically with this u can force the plugin users to use aikars flags? sheesh
or basically any other flag
not like this wasnt possible before but either way
What value is defining the texture of a skull meta? Say I set it using a GameProfile with a custom textures property, is that data then reflected on SkullMeta#getOwningPlayer? If it's not, which I assume, how do I get it? I can get the PropertyMap of the profile but the textures entry gives me a collection of strings?
value is what you are looking for
Huh?
Yup
thats sad
Is there a way of knowing what property is the skull?
🤷♂️
ah you want to get the data from an existsing skull
i thought you were trying to create a skull
sorry
Yeah no, I want to easily be able to serialize the data and want to know what field/data I need to save.
You sure? I can enter a base64 string as a new property to render a texture?
how come
I assume you meant how I know this? Because this works:
Where m is the skull meta
whats the questions exactly
what are you trying to achieve expect setting the texture
which you already do
What data do I need to save in order to recreate the skull.
ah
I assume it is one of the values of a Property under the textures key?
Unknown which?
yeah it is
With no way of telling which?
Is it encoded in the base64 somehow?
It must be right?
I don't know how many values there are, I assume not many. But would it be worth getting the correct value instead of saving them all in an array?
Or are there typically like 2 values
I just don't want a big array taking up a bunch of space
i believe there is already only one skin in textures
but it may also include the cape and model
i am not sure tho
Meh, I'll see how much space it takes up. If it annoys me I'll have to do some base 64 mumbo jumbo.
you should be fine storing the whatever the value you got
Thank you for your help! :)
np
actually you can decode it and see
Problem is I'm trying to save a SkullMeta, so I don't know the value. The sc I sent was for applying a skin to a SkullMeta, not saving it :/
Probs will :> thanks again
np
yo - having issues with js expansion in papi
function worlds() {
if ( "%player_world%" === "world" ) {
return "Build World";
}
if ( "%player_world%" === "world_the_end") {
return "Build End";
}
if ( "%player_world%" === "world_the_nether") {
return "Build Nether";
}
else {
return "Null";
}
}
worlds();
not sure why it doesn't work when i do /papi parse me %javascript_worlds%
fixed
Anyone know if theres a way to get the blocks in a sphere region from worldedit without setting them?
I've been messing around with it but I cant see a way to get the actual list of affected blocks
create an EllipsoidRegion and iterate throught the blocks in it
ty
I'm running into an issue where the slf4j logger cannot be found in tests, anyone got an idea?
dependencies {
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
api("com.summitrealms:configurate-core:4.2.0-SNAPSHOT")
api("com.summitrealms:configurate-yaml:4.2.0-SNAPSHOT")
api("com.summitrealms:configurate-gson:4.2.0-SNAPSHOT")
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
}
java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
item meta extends configuration serialisable so you can check what needed info they save
this what i use to grab it
Hey i have a question
How to create a button in chat?
Like a message in chat, when a player click "accept" it do something
Some API to recommend?
you can use either:
a) Spigot/bungee component API (built-in to spigot) https://www.spigotmc.org/wiki/the-chat-component-api/#textcomponent and then https://www.spigotmc.org/wiki/the-chat-component-api/#events
b) Adventure (built-in to 1.16.5+ paper, must shade if else) https://docs.advntr.dev/getting-started.html and then https://docs.advntr.dev/text.html
and with both, you'd use the "run command" event
Adventure is preferable, but I'm just presenting both options
Tnx
👍
If you want help setting up and/or using Adventure, you can ask in kyori discord (found in https://docs.advntr.dev/index.html - I can't link discord invite urls here directly)
Anyone know what the best way to spawn in a packet player that's sitting behind the player in the spawn area and have the skin load is?
It seems like about half the time the skin just fails to load since the chunk isnt immediately rendered by the client
Hi! I'm kind of new so I might make dumb questiosn lol. I'm using an open source plugin and found a bug which I tried to solve at the .java files. Now I don't have the faintest idea which might be the easiest way to make a .jar file out of all the files (java, yml and even a pom.xml file). Just tried with Eclipse but, when I tried to import the project, it gave a lot of errors because it doesn't recognize anything. My only goal rn is to make a .jar file out of all the plugin files (only edited 1 file with a small validation) so that I can upload it to the server
pom.xml = maven 💩
you need to download maven and then run mvn clean package and the jar will be in target folder
Why exactly are you trying to compile it yourself?
What's that "small validation"
Bc the plugin has no support and found the possible error
Just an if to check if a method returns null and, if so, return false, at some point of the code it tries to use a method with a function which has null and kind of explodes
Everything is the same except that small if
hey, can somone help me compile a decompiled plugin
i've been trying for hours
i managed to decompile it but i cant recompile it
why did you decompile it
^
it had code giving the develper op items and such in it
im trying to remove it but its hard
why are you using such a plugin
just don't use the plugin and report it to spigot or wherever you got it?
i need it like in the next 2 hrs
that does not answer any of our questions
the developer was bad i checked the plugin for backdoors and found that
and i want to remove the class that has the bad stuff in it
well i decompiled it and found this class
so there isnt any way of recompiling it without the source code?
If there is malware you shouldn't use it
what's the plugin? link it
Why am I smelling leaks
1 sec\
What's the correct way of removing an item from a player inventory after inserting it into a gui? It shouldn't move to the gui, just get deleted
ItemStack cursorItem = event.getCursor();
player.closeInventory();
player.getInventory().remove(cursorItem);
I've also tried closing after, doesn't work
Is the best option just to wait 1 tick?
?
try with removeItem()
ItemStack cursorItem = event.getCursor().clone();
player.closeInventory();
player.getInventory().removeItem(cursorItem);
``` like that
Doesn't work sadly
XY?
I want a gui where players can drag and drop an item into a specific item / slot in the gui. Then close the gui and delete the item
A lot happens in between this, but that's the important part
so it only deletes after the inventory is closed?
It should just not be added back into the players inventory
I'm cancelling the event, so it's being added back rn, but wanna override it somehow
maybe this is the best choice
Didn't work, so it's not checking the right items
Dm
Can someone fix BetterRTPs’ economy.yml its been bugged for over 2 years and the developers refuse to fix
What is wrong with it? It'd be good if you can link an issue.
bit of a late reply but you cant ge tthe blocks in an ellipsoid region
any clue how I can do that
Assuming this inventory is a random GUI then don't cancel the event, let the player actually add the item to the inventory, then after that since you close the inventory just ignore it, the inventory is closed it's gone
You can get the (relative) positions, you the use those positions to get the blocks in a real world/extent
Sorry, I'm just looking thru the worldedit code I dont fully understand what you mean
by using calculateDiff?
nws I got it, thanks
Ah yeah true, I make a new gui every time its opened anyway
I need to check if they're taking items out then tho
I am making custom enchantments with spigot and am struggling to figure out how to register the enchantments. Can anyone help me?
depends on the version
Spigot 1.20.4
?
well I dont think its possible to register them anymore
you need a different approach such as using PDC
you need to use PDC & manually lore setting
I have this code to create a listener using byte buddy. It creates the method properly, it's correctly annoted etc.. But the bar method is not called when the event is fired. I can trigger it manually with Method#invoke and it works fine.
public class Foo {
public static <E extends Event> void bar(@Nonnull E event) { /* Some code */ }
private void create() {
Class<? extends Listener> c = new ByteBuddy()
.subclass(Listener.class)
.defineMethod("accept", void.class, Visibility.PUBLIC)
.withParameter(eventClass)
.intercept(MethodDelegation.to(Foo.class))
.annotateMethod(AnnotationDescription.Builder.ofType(EventHandler.class).build())
.make().load(classLoader).getLoaded();
Listener listener = Reflections.getInstance(c);
Bukkit.getPluginManager().registerEvents(listener, plugin);
}
}
Nvm I'm dumb lol
could someone help me out with the deluxe spawners we are using wildstacker but anytime we buy a spawner it all stacks into a pig spawner regardless of spawner placed
EllipsoidRegion ellipsoidRegion = new EllipsoidRegion(new BlockVector3(0, 150, 0),
new Vector3(15, 15, 15));
EllipsoidRegion innerRegion = new EllipsoidRegion(new BlockVector3(0, 150, 0),
new Vector3(14, 14, 14));
List<Block> blockVector3List = new ArrayList<>();
for (BlockVector3 block : ellipsoidRegion) {
blockVector3List.add(Bukkit.getWorld("world").getBlockAt(block.x(), block.y(), block.z()));
}
for (BlockVector3 block : innerRegion) {
blockVector3List.remove(Bukkit.getWorld("world").getBlockAt(block.x(), block.y(), block.z()));
}
for (Block block : blockVector3List) {
block.setType(Material.BARRIER);
}
new BukkitRunnable() {
int iteration = 0;
final int blockPerRun = 30;
@Override
public void run() {
if (iteration >= blockVector3List.size()) cancel();
else {
for (int i = 0; i< blockPerRun; i++) {
blockVector3List.get(iteration).setType(Material.QUARTZ_BLOCK);
iteration++;
}
}
}
}.runTaskTimer(this, 0, 1);
Can anyone think of a way to rotate the Ellipsoid region so that the first block in the list is not always the north most block?
do you actually want to rotate the ellipsoid or do you just want to change the iteration order?
so atm it plays a "building" animation but it always builds from the same direction, I am just trying to get my head around how to make it build from another direction
I was thinking go a quarter of the way through the list but that wouldnt work
I mean as you only have a sphere you could rotate all the points around the center
How would you actually do the rotation, maybe using the coordinates?
you can use the AffineTransform class
Do i still extend the Enchantment class?
quite not possible anymore
Are there any tutorials or anything on making them with the PDC's \
not really
but all you need to do is set a custom pdc instead of an enchantment
thats it
rest is the same
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Server.Spigot.html#restart()
If the server administrator has not configured restarting, the server will stop.
how would one "configure" restarting 🤨 ping if reply
declaration: package: org.bukkit, interface: Server, class: Spigot
You provide it a restart script.
^
oh 
yeah
settings.restart-script
wanted to make plugin where u could run cmd and then when the server is empty it'd restart
ig i could still but then i gotta make a restart script for all my servers 🥱
and make sure anyone else that uses plugin has one too
Pretty sure you can pass it a script. Maybe ask n0rska how he does it in ultimate restart
i haven't done any googling but theres gotta be a way to
a) know what script was used initially
b) modify restart script (reflection even?)
What IDE?
it probably forgot your JDK or something
on IntelliJ, ctrl alt shift S and then I think it's like Project SDK
oh also make sure it compiles too or your build.gradle/pom.xml could be messed up (but not likely)
that should be right
assuming u installed it earlier
not an error but you can alt enter and apply the quick fix
and it should work
yes
then offlinePlayer.getName()
no, you'd do this
you would use offlinePlayer.getName() to get the name
it's nearly midnight so I can't really explain everything right now, sorry about that, but I should probably get some sleep 🥲
how would someone listen if a player gets op ?
private void AntiOP(PlayerJoinEvent e) {
Player player = e.getPlayer();
if (player.isOp()) {
player.setOp(false);
player.sendMessage(CC.translate("&cYour operator permission have been removed, no one is allowed to have OP"));
}
}
}```
this is what i have right now, it checks if the player has op on join and then removes it, but im scared somehow they can get op while in game how could someone check for that?
What is zee problem
why u even making a config.yml ?
You can listen for the OP command also…
what about a malware ? tho
and i found a good way
plugin.getServer().getScheduler().runTaskTimer(plugin, () -> {
for (Player p : Bukkit.getOnlinePlayers()) {
if (!config.getOPList("oplist").contains(p.getName()) &&
!config.getOPList("oplist").contains(p.getUniqueId().toString()) &&
p.isOp()) {
p.setOp(false);
}
}
}, 20L, 20L);
}
👍
it checks a config if there is no username in it will setop to false
If I am right even the malware needs to somehow execute the command or maybe rewrite ops.json, but rewriting ops.json will need a server restart iirc, (Sorry if I am wrong). even tho checking it every sec might be a bit unnecessary in my opinion
that is true im trying to add as many stuff to prevent it, and the "1 second checking" thing im not sure i might as well make it 1m or 5m, just for performance on high player's count
i know its very unrelated but can i ask why we're preventing /op
Honestly, if u are that concerned, think it from the root…like not providing console access to anyone, use plugins from trusted sources etc. Prevention is always better than cure imo
I am also a bit curious regarding this, if it’s just u want to secure the server…u might want to consider what I said above
decompile...?
What is your project structure?
How long is it taking?
Like to build the jar?
That's not too crazy per se, but it is longer than I'd expect from what I assume is a smaller project.
maven probably
Maven actually added cache support like a year or two ago, I'd hope it was better than that
uhh ok?
Oh you'll probably have a better time (and more support) with gradle, at least in the MC community
Not to say people don't use it, there's a few out there.
jda has nothing to do with minecraft
you cannot use its features ingame
can you create a plugin that runs a discord bot? yeah
but you cannot use it to play songs in minecraft
maybe not the only way
but definitely the best/most performant way
not all servers have a start script
and without knowing the initial startup cmd, it'd be unsafe to just set it as whatever i want (like the default start cmd or whatever)
i meant like the start command
ye, dont think server knows what it was
You can retrieve all the start parameters.
no way
Get the launch args and display them
true nice i can just look at what they do then lol
In the method NBTTagList.add(int, Object) is the integer parameter for position or list type?
position
I'm not on PC but the error I got was different then that.
hmm what was the error? because i checked the mc code and it should be position
it seems to ultimately just go to List#add
I thought so. But if it's a list of multiple object types it seems like the error is saying it's not the right type.
I won't be on PC for a bit.
make sure that if it's like a String nbt tag list that it's a string that ur trying to add
I won't be on PC for a bit.
👌
Caused by: java.lang.UnsupportedOperationException: Trying to add tag of type 6 to list of 3
ah yeah
list.getElementType() = 3
your tag type = 6
I thought for NBTTagList you can add all object types not just a single type.
doesn't seem like it 🙃
there's a type byte field preventing it
and its primitive so non null too
Damn. More work 🤦
🥲 🥲
Is there anyway to allow NBTTagList to function the same as List<Object> ?
I don't mind rebuilding the list but if I can have all the object in the same list it would be better.
Also yes having the same object types fixed it.
maybe use string nbt tag list and serialize everything to string
since mojang has to know how to serialize them
I might be able to but its more work to recheck the object type when being used plus I think the client check for specific NBTTag types.
So I setup hotswap hopefully correct, but i got a small unsolvable problemo
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007ff87137552a, pid=1920, tid=17684
#
# JRE version: OpenJDK Runtime Environment JBR-17.0.10+1-1087.23-jcef (17.0.10+1) (build 17.0.10+1-b1087.23)
# Java VM: OpenJDK 64-Bit Server VM JBR-17.0.10+1-1087.23-jcef (17.0.10+1-b1087.23, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, windows-amd64)
# Problematic frame:
# V [jvm.dll+0x4d552a]
#
# No core dump will be written. Minidumps are not enabled by default on client versions of Windows
#```
everytime i try reload classes D:
I tired JBR 17 and tried 11 as in https://wiki.helpch.at/piggys-barn/java/hot-swapping
same result
idk if this helps
?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
im out of ideas on how to fix this
infact if you findout what's wrong wake me the hell up ill be on my bed
looks like a skill issue no ?
lol
Use imgur
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload to upload images/screenshots.
You can also use a screenshot service like gyazo or jinx and post those links here.
impossible with regular chest gui's
if you provide me with art assets I could work on this in tandem with my custom GUI project
nah you can't get click detection on the sides like that
you doing this for ur server?
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 am I doing wrong with the set entity metadata packet? It says the vector field at 11 is invalid (I am new to packets, I have no clue what I am doing)
PacketContainer packet = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
packet.getIntegers().write(0, entityId);
packet.getVectors().write(11, Vector.fromJOML(this.transformationMatrix.getTranslation(new Vector3f())));
packet.getVectors().write(12, Vector.fromJOML(this.transformationMatrix.getScale(new Vector3f())));
packet.getChatComponents().write(23, WrappedChatComponent.fromText(this.text));
packet.getIntegers().write(25, backgroundColor.asRGB());
packet.getBytes().write(15, (byte) billboard.ordinal());
packet.getByteArrays().write(27, new byte[] { 0,0, (byte) (showDefaultBackground ? 1 : 0), textAlignment == TextDisplay.TextAlignment.CENTER ? (byte) 0 : textAlignment == TextDisplay.TextAlignment.RIGHT ? (byte) 2 : (byte) 1 });
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
for (Player player : players) {
manager.sendServerPacket(player, packet);
}
Whats the best way to add armorstands like a nametag for a player?
In my plugin Vitalo I used text displays and set then as a passenger to the player. it acts as a named armor stand without the armor stand
doesnt that prevent players from being teleported by other plugins?
It does, but there are ways around it
I know other plugins that use the same system
Whats the best way you found to make it work?
For the portals I just check in a bukkit runnable and remove the text display if needed. For the teleporting I haven't implemented it yet, but I believe you could listen to the teleportation event, as it should get canceled and you can just remove it and send the event again
hope it works
the best way is to do it client side
so the entities never exist on the server end
hence what I was trying to implement above
\ I have almost never worked with packets before so I am struggling a bit12
yeah i know what, but kinda hard to do it haha
Is there a way to check if another placeholderAPI plugins Placeholder equals a certain value?
I am using OldCombatMechanics and want my custom anticheat to check which mode their in using their Placeholder Value
Do u maybe have a src for me?
Or is that to much?
https://www.spigotmc.org/resources/tab-1-5-1-20-4.57806/
This plugin works with armorstands for a nametag too
But I dont get the code that he wrote, because it has so many classes
doesnt it use packets?
I don't know
@EventHandler
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Location location = player.getLocation();
EntityArmorStand armorStand = new EntityArmorStand(((CraftPlayer) player).getHandle().getWorld(), location.getX(), location.getY(), location.getZ());
armorStand.setCustomName(new ChatComponentText(ChatColor.GREEN + "Custom Nametag"));
armorStand.setCustomNameVisible(true);
armorStand.setInvisible(true);
((CraftPlayer) player).getHandle().passengers.add(armorStand);
PacketPlayOutMount packet = new PacketPlayOutMount(((CraftPlayer) player).getHandle());
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
for (Entity passenger : ((CraftPlayer) player).getHandle().passengers) {
if (passenger instanceof EntityArmorStand) {
Location location = player.getLocation();
passenger.setPosition(location.getX(), location.getY(), location.getZ());
PacketPlayOutEntityTeleport packet = new PacketPlayOutEntityTeleport(passenger);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
break;
}
}
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
Player player = event.getPlayer();
for (Entity passenger : ((CraftPlayer) player).getHandle().passengers) {
if (passenger instanceof EntityArmorStand) {
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(((CraftPlayer) player).getHandle().getId());
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
break;
}
}
}```
Maybe this works

hey can i somehow separate each placeholder in a new class?
I recommend EXACTLY 18,528 x 18,566
Ivan knows
I'm trying to set a block in a world via nms, for that I need to get BlockState given a Bukkit material. before I'd do
material.getId() then net.minecraft.world.level.block.Block.stateById(blockId), but now it doesn't work since modern materials dont return an Id. any solutions?
nvm
there are so many other things to worry about for lag than map size, just pick a number
map size realistically will only impact how much storage space you use
When you realize minecraft worlds are already limited to 30m x 30m
non-minecraft question
i wanna make api for a discord bot using mongo and someone that wants to use the api needs to like listen to an event (similar to a minecraft plugin ig)
is there any way to achieve this nicely? only way i thought of requires them to spam my api to check for changes
Web sockets
Just look them up
The mdn article is good
They are pretty much like an api, but the server will send events to any listening clients
So you don't have to constantly ping for updates, the server will just send updates to the client when they are ready
ok yeah thats what i wanted but didnt know it was possible thx
wait i dont have to do anything to like allow a client to listen right? anyone can just hook in and listen?
For most applications they first require you to send a message to the server through the socket with an api key or something
But this would be something you would implement on the server
yeah and then like hand out api keys?
Yeah, like they would for a normal api
ok
ok wait, the person that wants the api is making a minecraft mod
so they cant include their api key in the code obv, should i do something where a key is generated for each client or something??
doesnt rly make sense since a key is supposed to be like per-service
You can make your bot collect classes (listeners) and run the methods the same way as spigot. (Using annotations)
I mean if it is just for one person you can personally give them an api key
the mod would be public
how would that work tho? spigot only works cause the plugin is running on the same machine
btw discord api uses/can use websockets for events
just listing a real world example
yeah i thought i heard of it somewhere
API keys won't really be necessary unless you want a lot of control and knowledge of what every user is doing
I must have misread then. You are probably better with the rest api route then as mentioned above.
i'd prefer that to avoid people abusing the api (the community that'd have access to it are notorious for doing so)
Just rate limiting the number of connections per client IP per hour may be fine for what you are doing
yeah think thats what i did for laser tag's api
something called bucket overflow rate limiting 🤷♂️
If people are abusing it you can implement api keys
But that would also require you to make a system where users create accounts, which you have to store
If you aren't already doing this it may be unreasonably over complicated
that'd be easy especially utilizing login via discord/microsoft
but yeah not preferred
Well it's a discord bot so don't need to store account data just have them interact through that bot or another 😉
Alright, I'm not too familiar with discord bot development
yeah if needed can just have a command to generate/get api key
wait nvm
discord bot not ran on api server
actually sitll possible if i make api endpoint to generate keys but require authorization
interesting
I mean you should store the api keys and their corresponding discord accounts in a database somewhere
So the discord bot can add to this database when a new user creates an api key
And the server can read from this database to check that all incoming web socket connections have a valid api key
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
Is chatchat available yet?
id like to note you shouldn't be using titles to check inventories
anyone could just call a chest "Coin Flip" and it'd act the same
although im unsure of what exactly you're doing
- have different classes for different stuff example: a class to listen to events, a class for Command Executor, a class for Item building etc
- Do not ever use menu titles to check inventories, could use something like an enum combined with a HashMap instead
- Keep in mind that HashMap values aren’t that reliable for a coin flipping plugin because player bets will be removed if the server restarts
You can solve 3 easily by giving the player their money back in leave event, or in onDisable by having a for loop, but then other players wouldnt be able to take other offline players coin flip games
i also have no idea what you’re trying to do with the coin flip plugin anyway, i’ve made one recently and i can help you out a bit
what are you looking for exactly
you should have some kind of prototype or template
like what kind of inventory you want, what you wanna display on it
then you can figure out what to do from there
e.g. your coding structure
take a look
if (inventory != null && inventory.getName().equals("Coin Flip")) {
you are checking if the inventory name is Coin Flip
so someone could just get a normal chest
and call it Coin Flip
and then it would execute code
you dont want that
so like what i said earlier, you can use a HashMap combined with an enum
public enum MenuState {
MAIN_MENU,
ROLLING_MENU
}
something like this
then you have another class called PlayerStateManager, create methods like getState#, setState# and deleteState# to make your work easier
then to check if a player is actually in the menu, you open the menu somewhere and use the setState# method
enum isn't the best either to be fully honest
what do you mean
what do you suggest
InventoryHolder
well if hes using a static inventory he cant do that
but if he wants to display info like profit, amount of wins/losses, then sure
inventoryholder is the way to go
from his code seems like hes using a static inventory
or global inventory i should say
public class X extends InventoryHolder // do whatever
createInventory(this)
new X()
if (!(event.getInventory().getHolder() instanceof X)) return
yk
i do it like this
public class A implements Listener, InventoryHolder
then i just register the click and close events
and unregister them when the menu is closed
compressed version of mf-gui for testing purposes when i was being stupid https://github.com/Oribuin/DeepChests/tree/main/src/main/java/xyz/oribuin/deepchests/gui/api

but honestly if they're that new to plugin development, frameworks are better until they have a solid grasp on spigot api (and obviously studying how the framework actually functions is important too but)
what does your client want
a gambling plugin right
o
so how is your game going to work
you bet $500, guess a random number to win money?
ok
so whats going to happen when the command runs
define your check clearly
it would be correct, it might get by with different wording but meh
selling stuff to people that give them a gameplay advantage is against the mojang EULA
afaik gambling plugins arent
they updated the guidelines where the server has to be like, friendly to all ages
so any references to drugs, gambling, violence etc aren't allowed
o
the server i work for had to remove our "lottery" plugin
im quitting, time to host a SMP server
no shit but mojang is mojang
they dont play around ever since that tf2 mann co supply stunt back in april fools a long time ago
here's the exact guideline
as far as compliance goes, at a certain point they just send an employee on your server to briefly search the features (check if chances are on crates and looking out for certain things, haven't seen them do an in-depth search though)
time to ban every mojang staff member known to existence
the account is called MCEnforcement
and they'll tell you they're showing up beforehand, or atleast they did for us
although that likely won't happen unless your server blows up or you try to put it on the official mc server list
not if i ban that account
they'll either send a different account or blacklist the server because you banned the account prior
also does anyone know how to send a TextComponent as part of a message e.g. click HERE where only HERE has hover and click actions
No way minecraft can make more minecraft accounts
depends what text component you're on about
kyori/minimessage or vanilla
vanilla
although i believe there's a component builder somewhere
and you'd just have to append a new component with the hover events and such onto the previous component
sounds mind boggling considering im doing all this in AsyncPlayerChatEvent
correct!!
so after appending all that bs
i cant just turn it back into a string to use e.setFormat
im basically stuck after that then
lol probably not
it's easier when using kyori (bundled with paper api) by a significant margin because spigots text component system can be really jank
most chat plugins to memory will just redo the chat system and overwrite it with their own messages that are individually sent
big headache for if a user has that user ignored
i think it's just operate on event priority HIGHEST or MONITOR with ignoreCancelled and it'll send whatever messages go through whatever other plugins are listening for chat messages
but the actual message event itself gets cancelled at the end every time
When I ride my lord، the crash automatically becomes a stew or a crash.
what
When I ride my lord، the crash automatically becomes a stew or a crash.
I'm looking for a developer to write a mode, PM for more details.
I have this bit of code to launch an entity in a direction. It works fine when the multiplier is 1, but when I increase it the target becomes really inaccurate. Why is this? In my head multiplying the vector should not affect the angle? Pls ping if you respond :)
Vector vector = /* My vector */;
double multiplier = /* My multiplier */;
entity.setVelocity(vector.multiply(multiplier));
I've tested it with Entity.getLocation().getDirection() on myself and sometimes I get launched like 20 degrees of course?
anyone here knows how to use FAWE API properly? I am trying to copy/paste and it takes abnormal amount of time to copy (2 minutes just for 3x3 chunk radius)
when using the commands its almost instant
Is it simple enough to create a JS placeholder that will return 'true' if the item in a player's hand is a certain ID?
I haven't touched the player side of stuff, only permission checking in existing scripts.
Yes, but I would advise using the changeoutput expansion + player expansion
should be more efficient than using a js placeholder (since a new javascript engine has to be started every time a js placeholder is called)
%changeoutput_equals_input:{player_item_in_hand}_matcher:DIAMOND_SWORD_ifmatch:true_else:false%
@cursive slate
I wanted it to check against an array of items, and can be either one of those.
I decided to just make a javascript for it.
changeoutput has a contains fyi
only telling you because of js's inefficiency
what's the best way of making dynamic permissions, or checking for them? For instance, homes.X permission defines how many homes I can have.
ig u can just loop from 0 -> X
unless u have like 1000 homes there shouldn't be a performance issue
LuckPerms api would probably have a solution to loop over the permissions though to check if it starts with homes.X
oooh i forgot that existed
Meta is best
anyone with advanced NMS knowledge for 1.12.2 please dm me, got issues to clarify/find out and dont wanna flood the chat here
Just ask your question it might be simple and you don't know it.
im trying to set a pre-defined path for a nms entity to follow infinitely
but i have no idea how to start defining that path, and also have no idea how to get the entity to then follow that path
maybe something like a list of coordinates, and when the entity is within a certain radius of the next coordinate it is retargeted towards the next in the list
no idea what you mean, dont think teleporting the entity to the next in the list would be viable
i should also mention that i want to save the defined path into a yml, and when the entity follows its supposed to have its walking animation
there is no teleporting involved
that would require the user to also use that xD which they prefer using perms...
so, if it has any of those looped perms, it would return that perm?
loop player permissions, check if it starts with my.permission.
extract the num, Integer.parseInt(perm.replace("my.permission.")) or smt
ofc find the max, not the first one
hello everyone, i need some help, so i was trying to import papi, using maven. But it doesnt recognise symbol me.clip
<dependency>
<groupId>me.clip</groupId>
<artifactId>placeholderapi</artifactId>
<version>2.11.5</version>
<scope>provided</scope> all of the values appear red
oh wait wrong channel sorry
not rlly wrong channel lol, it's the right channel
did you add the repo?
if u havent solved it yet, u probably gotta click the reload icon in the top right
thatll fetch all the maven dependencies and sync it up with intellij
Ctrl shift o
I used to create a single package-info.java file at the project root's src folder in order to have everything annotated with @NotNull by default.
package-info.java
@DefaultQualifier(value = NotNull.class, locations = {TypeUseLocation.PARAMETER, TypeUseLocation.RECEIVER, TypeUseLocation.RETURN, TypeUseLocation.CONSTRUCTOR_RESULT})
package net.countercraft;
import org.checkerframework.framework.qual.DefaultQualifier;
import org.checkerframework.framework.qual.TypeUseLocation;
import org.jetbrains.annotations.NotNull;
build.gradle.kts
dependencies {
compileOnly("org.checkerframework:checker-qual:3.42.0")
}
I'm trying to use that same setup in another existing Java project, but the IDE is not catching up. RemoteControlledCraft is a simple interface that had its getCraft method annotated with @NotNull, and if I comment it out, Kotlin doesn't pick that the field is non-nullable, even after I've added the package-info.java file.
How could I fix this?
And the method doesn't appear annotated as well.
as far as i can tell, kotlin doesnt support checkerframework's DefaultQualifier annotation, only the use site annotations (i.e. @org.checkerframework.checker.nullness.qual.NonNull)
ill always recommend jspecify though, its fully supported by both kotlin and intellij and supports the equivalent of what you have, @NullMarked
https://jspecify.org/
eh, jspecify is overhyped and it's nothing but a draft rn
it'll be cool once it's actually out then i'll use it, but considering jetbrains-annotations and checkerqual have many years of adoption in the ecosystem those are the safe options

Hello. I am currently building a multi-module gradle project, and here is what the main file looks like: https://paste.helpch.at/afejabaxin.java
I have a module that requires a task called remapping to be done once the jar is formed, which obfuscates the deobfuscated code. (so it will run on a certain system)
However, I am unsure about how to remap the jar and allow it to be shaded into the main module, as it currently is not working and I am not sure what I am doing wrong.
The module needing remapping: https://paste.helpch.at/emaladucov.csharp
ig thats fair
its the only well-supported set of annotations though
that also has a scoped annotation or whatever you wanna call it
weird take but ok
my only gripe with jb-annotations is that they have both type_use and method/field/etc target types
but that's generally my go-to
its true ??
that also has a scoped annotation or whatever you wanna call it
and i dont think kotlin supports jakarta annotations' nullness annotations
i dont think its type use either
idk what you mean by "scoped annotation"
like @NullMarked, @DefaultQualifier, @ParametersAreNonnullByDefault
idk what to call it
sure
i mean if u enjoy spamming @NotNull u can do that
Smh, using Java was your first mistake
at least its not kotlin
yes
Kotlin ftw
ArmorStandGUI.java
import org.bukkit.plugin.java.JavaPlugin;
public final class ArmorStandGUI extends JavaPlugin {
@Override
public void onEnable() {
System.out.println("Plugin has started.");
getServer().getPluginManager().registerEvents(new RightClickEvent(), this);
}
}```
```RightClickEvent.java```
package org.firstproject.armorstandgui;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
public class RightClickEvent implements Listener {
public void onRightClick(PlayerInteractEvent e){
Player p = e.getPlayer();
p.sendMessage("WASSUP BRO");
System.out.println("INTERACT EVENT DETECTED");
System.out.println("p.getTargetEntity(3)"+p.getTargetEntity(3));
if (p.getTargetEntity(3) instanceof ArmorStand){
System.out.println("p.getTargetEntity(3)2"+p.getTargetEntity(3));
GUI gui = new GUI();
gui.ArmorStandInventory(p, (ArmorStand) p.getTargetEntity(3));
}
}
}```
what am i doing wrong. player interact event is not sending anything no console errors
You forgot the EventHandler annotation
PlayerInteractAtEntityEvent and also @EventHandler annotation as mentioned by porey.
Guys, u know that saveDefaultConfig(); takes our /resources/config.yml and creates the same file with data in our minecraft plugin Folder.
How can i do a method like that? i want to create multiple .yml files in my "/resources/" and pass their defaults when its needed(not created) instead of doing
getConfig().set("myfile.yml", "Test test test");
for every line i want to add to the default file
forget about it, i figure it out hehe
Any reason CraftItemStack.asNMSCopy(ItemStack) isn't keeping the ItemMeta?
wdym "keeping"?
like you set a custom name/lore in the meta and it isn't in the nms item or what?
Its not. Which is super weird. Atleast when I copy back it doesn't contain the data. The toString of the minecraft ItemStack just returns the amount and materal.
well, that's because that's what the nms itemstack toString does
public String toString() {
int i = this.getCount();
return i + " " + this.getItem();
}
I know
The toString of the minecraft ItemStack just returns the amount and materal.
sure..? but why does that matter
it doesn't include any of the useful info
so why is it relevant
Unless I go through all the item meta from the minecraft itemstack thats the only data available.
I can check later if the item data is in the minecraft itemstack class but was to lazy earlier.
Anyways from itemstack -> minecraft itemstack -> itemstack it loses the ItemMeta
how are you verifying that? it works fine for me
Giving myself the item before and after
So now I'm just reapplying the itemmeta on the returned itemstack.
idk, it certainly works fine and it's been working for over a decade lol
would be nice to see some code
Can't right now. Can send it later.
Object minecraft_item = nbt.asMinecraft(item);
nbt.setTag(minecraft_item, tag);
item = nbt.asBukkit(minecraft_item);
item.setItemMeta(meta);
Heres all I can send for now.
this is my code
final var bukkit = new org.bukkit.inventory.ItemStack(Material.IRON_INGOT);
bukkit.editMeta(meta -> meta.displayName(Component.text("stink")));
final var vanilla = CraftItemStack.asNMSCopy(bukkit);
final var bukkit2 = CraftItemStack.asBukkitCopy(vanilla);
final var bukkit3 = CraftItemStack.asCraftMirror(vanilla);
getSLF4JLogger().info("{}\n{}\n{}", bukkit.getItemMeta(), bukkit2.getItemMeta(), bukkit3.getItemMeta());
and this is what it logs
[Paper-Test-Plugin] UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name="stink"}
UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name="stink"}
UNSPECIFIC_META:{meta-type=UNSPECIFIC, display-name="stink"}
Mine
Object nmsItemStack = asNMSCopy(itemStack);
Object itemCompound = getTag(nmsItemStack);
setString(itemCompound, key, value);
setTag(nmsItemStack, itemCompound);
return asBukkitCopy(nmsItemStack);
Also been working for years
Thats why I'm questioning it just stopped working for me.
i believe this is what the kids nowadays call a skill issue
the itemmeta is certainly retained, but i wouldn't be surprised if spigot/minecraft removed foreign tags at some point, i know that's a thing that happens with entities, not itemstacks but who knows
Ill do more debugging later. Weird that its causing an issue now.
Sigh nbt.setTag(minecraft_item, tag);
tag is null so I was essentially erasing the display tag after I set the item meta.
Made sure to copy tags from the minecraft_item onto the new tag.

Any decent brig command libs for paper?
cloud
Oh wow this is actually perfect I think, thanks
no problem
There's also CommandAPI (it's what I use)
Has kotlin dsl too
But it's based on spigot
Is there a way to tell what type of villager a villager is? Like a jungle villager or a desert villager
declaration: package: org.bukkit.entity, interface: Villager
im having flat out errors with my permissions in my server
essentialsx is somehow having an interference with everything and customcraftings just disabled itself
that's awful, consider undoing whatever you most recently changed
mmm yes
also probably better to ask for help about that kinda stuff in #minecraft
This has been going on since the start of the server
womp womp
Has anyone seen this error before? I hate debugging protocollib / packets https://paste.helpch.at/huxecesafe.swift
Yeahhhh just found that as well, protocollib has 895 open issues tho lol
I doubt it'll get fixed soon
What do you guys think, Exlll ConfigLib vs Spongepowered Configurate?
I love configurate, never used the other
I also use hocon fwiw
Never really why hocon is used, what's better about it?
I started in sponge and it's just the standard there.
I find it more readable + it has comment support whereas configurate I don't think supports yaml comments (yet)
Yeah there's a working pr with comment support which I use tho
Oh yeah I remember you
But after reading this, I doubt configurate is better with yaml at least https://github.com/Exlll/ConfigLib
Oh lol, that can't be good hahah
Support inheritance, and more easy to setup imo
But I have made a wrapper so it's not really an issue, it just looks so simple
I read the sponge guild a lot :p
configurate supports inheritance too?
although it isn't really configurate that handles that, but the underlying serializer library, but they all support that
Hocon my beloved
I need to add a custom type serializer for it to work I think
I've got a question for you actually, is it possible to remove the player inventory for a gui? So it only shows the gui I created
Yes with resource packs
Ah, so not with just the api
I'm still very new to kotlin, is this like a record in java?
class PetItem(
private val plugin: EcoPlugin,
private val pet: Pet
)
So it adds those fields through constructor?
thought that were data classes
these are like records
Ah gotcha, but what I sent above adds to the constructor and adds the required fields right?
no idea, I am not a kotlin user
In Kotlin when you do private val/var you create a "property" which is composed by a field, a getter, and if var a setter
class Test(plugin: EcoPlugin)
// Equivalent to
class Test {
public Test(EcoPlugin plugin) {}
}
// While
class Test(private val plugin: EcoPlugin)
// Equivalent to
class Test {
private final EcoPlugin plugin;
public Test(EcoPlugin plugin) {
this.plugin = plugin;
}
private EcoPlugin getPlugin() {
return this.plugin;
}
}
"hack"?
At best "syntax sugar" is what this would be, but still it isn't since it's a different language that works differently, that's why I say equivalent, because it isn't exactly that
yeah fair enough
although I have never fully understood why everyone hates lambda... I personally don't use but idk
Also, data classes are not the same as records, there are some small differences, for example data classes can be mutable
And you can make a data class into records by annotating it with @JvmRecord but I have never had a need to ever use it
Are you sure you're talking about what you think you're talking? Lambdas? You mean Lombok?