#development
1 messages Β· Page 67 of 1
you can check if the IP is in a range known to be used by a VPN provider
but more than that? Not really
(not exposing that it is a VPN is the idea behind a VPN)
Is there a Minecraft plugin development competition currently running or upcoming?
you use get logger? 
other then manually writing down each block's color or checking the material's string name for a valid color no there isnt
theres no api for it because its a bit too niche and the color of the block's texture can be different then its supposed to be with resource packs for example
like theres a MaterialTags for colorable, but other then that no doesnt exist rn
Hello, java noob here and I have made a method that infinitely spams my error log whenever it runs. Do you see any way to stop this?
pseudo:
- pass in a loaded chunk from chunk loaded listener
- select random X/Z coordinates in that chunk, find the highest Y location at that X/Z
- check some booleans about the material of the block at that location, before proceeding onto "NewNodeEvent.createNode" method
- if none of the booleans pass, call the method again to get a new random X/Z coordinate and try again
the code works fine, it does exactly what it's intended to do, but for some reason every time this method is called it spams my server console with errors
int randX = rng.nextInt(16);
int randZ = rng.nextInt(16);
int topY = chunk.getChunkSnapshot().getHighestBlockYAt(randX, randZ);
Block targetBlock = chunk.getBlock(randX,topY,randZ);
Material targetMaterial = targetBlock.getType();
if (checkMaterial1(targetMaterial)) {
Location finalLocation = targetBlock.getLocation();
NewNodeEvent.createNode(targetBlock, finalLocation);
}
if (checkMaterial2(targetMaterial)){
Location finalLocation = targetBlock.getLocation().add(0,1,0);
Block finalTarget = finalLocation.getBlock();
NewNodeEvent.createNode(finalTarget, finalLocation);
}
if (checkMaterial3(targetMaterial))
FoundLeavesLogic(targetBlock.getLocation(), chunk);
else {
TryNode(chunk);
}
}```
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
error log https://paste.helpch.at/axucuvazoj
stack overflow, who could've though about that in a recursive function
you're not doing anything with the chunk and you're calling the method again with the same chunk
intentionally
the end of each if statement sends to a new method which ends in return
Here's "NewNodeEvent.createNode" method for example
int tryNodeRNG = rng.nextInt(10) + 1;
if (targetLocation.getY() >= 120)
return;
if (targetBlock.getBiome().equals(Biome.SNOWY_BEACH) || targetBlock.getBiome().equals(Biome.BEACH))
return;
if (targetLocation.getY() > 75) {
if (targetBlock.getBiome().equals(Biome.STONY_PEAKS)) {
if (tryNodeRNG >= 5) {
targetBlock.setType(Material.BEDROCK);
targetBlock.getWorld().spawnEntity(targetLocation, EntityType.MARKER);
return;
}
}
//etc
//etc ```
"if biome this, do this, return"
"if heigh this, do this, return"
It gets passed into more logic about the block it found and every statement ends in return;
so it should be logically impossible for the function to get looped unless it failed the 3 boolean checks in the initial method
I don't think you understand how it works
no probably not, I've been coding for 4 days
whatever happens in createNode where you do the return, stops the execution of the createNode method, not the TryNode method.
my understanding was it would take the result of the createNode method (return) and apply that to the original if statement which sent it there
in your provided code it will only stop if checkMaterial3 returns true
else it will loop infinitely
hence StackOverflow exception
gotcha
alright well that's an easy fix then, I'll check it out
its throwing the same StackOverflow error. I'm sure the missing return statements was a problem, but it looks like it's not "the problem"
so uh
maybe none of the conditions ever return true?
because at the end of the day you're calling the TryNode on the same chunk without altering it in any way
that can't be it, because it is actually functioning and giving me the result I wanted to get when the conditions are true. It spawns a little mini structure at the target location, they are all over my world now.
I just can't figure out why it's blasting my error log
well, because it's being called too many times
I think I just needed more return statements. I'm looking deeper into the methods its splitting off into, and there is another one that tries to call "TryNode" at the very end if all conditions fail.
yea I'm completely clueless as to why this is still giving me issues so I'm just going to set a recursion limit to only try the same chunk 5 times before giving up. 5 is smaller than infinity, I'm pretty sure.
as long as the plugin isn't completely torching my server resources, it's behaving in game exactly the way I wanted to, so I can be happy with that
Are there any minecraft plugin development competitions?
wtf haha
I fixed it but I don't know why it fixed
I put this condition at the top of TryNode
if (!(checkMaterial3(targetMaterial)) && !(checkMaterial2(targetMaterial)) && !(checkMaterial1(targetMaterial)))
{
TryNode(chunk);
return;
}
and that pleased the machine god
I cannot fathom why the method kept calling itself after the boolean checks were passed, I put such an excessive amount of return statements everywhere I could think to cram them
but if I check for the absence of the booleans first, then everything works?
there is clearly some sort of computer logic going on that does not match the human logic which wrote it
but the problem is solved and my error log is clear. Thanks for your help @river solstice
just kidding, that was just reorganizing the same problematic code.
The problem I believe is that I have no contingency plan for when the attempt is made in an ocean. It tries to find a block that is not water, and it can't find that block, so it just endlessly loops itself pinging the same 16 water blocks ad infinitum
the logic was sound, but I didn't give the method any way to handle chunks that don't have a single viable spawn location
actually fixed it now. This is definitely the biggest problem I have debugged and I don't think I could have done it without someone explaining StackOverflow to me
Thanks again sir, enjoy the wall of text I have errected in this channel.

where reun
its literally infiny loop my man
if you are not turkish i value u turkeybastard for begin such a great person
step 1: make infinity
step 2: "why infinity?"
nvm im still perfect looks like it was cuz gradle only looks at the services file for annotation processors
https://github.com/gradle/gradle/blob/master/platforms/jvm/language-java/src/main/java/org/gradle/api/internal/tasks/compile/processing/AnnotationProcessorDetector.java#L153C60-L153C60
hey guys, crazy question but is it possible to like randomize item texture overlays, like the overlay might be from a pool of a few different textures. I know you can do this with blocks textures but im not sure about items
smthn like this
"parent": "item/handheld",
"textures": {
"layer0": "item/sword",
"layer1": "item/#random overlay from a choice of multiple files#"
}
}```
So I'm trying to make a scoreboard, but when I added the location part, the spaces whitespaces above and below it don't exist anymore, why?
https://imgur.com/a/2gJTXDX
https://paste.helpch.at/irakiwikop.java
ive done all the testing i can
even used a fresh server
the empty spaces in 5 and 3 don't show for 0 reason
im so confused????
Try this:
objective.getScore(ChatColor.BLUE + " ").setScore(5);
objective.getScore(ChatColor.WHITE + "β¦ ").setScore(4); // Location
objective.getScore(ChatColor.BLUE + " ").setScore(3);
objective.getScore(ChatColor.WHITE + "Balance: " + ChatColor.GOLD + "0").setScore(2); // Money
objective.getScore(ChatColor.BLUE + " ").setScore(1);
objective.getScore(ChatColor.AQUA + "" + ChatColor.BOLD + "SERVER.IP").setScore(0); // Server's IP
π
tysm
who can help me start my server
how long does auctionbar display in seconds?
auctionbar?
Actionbar
ikr?
I just wanted to troll tony
whatever
some old spigot forum thread says that it stays for 2s and then fades for 1s
obv varies by client, cuz the packet itself only contains the text
also
anoher question
how to get inventory name
i see no shit in the api
or waitin
inventory class
inventory.getview.gettitle
doesnt exist
in new vesions
ver*
can you stop spamming?
real
The view is part of the event not the inventory in newer versions
I worry why he needs the name of the inventory
Inb4 it's to check if it's his inventory lol
classic use of that method 
π
I have a custom entity (villager) with a custom name, how do I check if a player interacts with this villager?
actually the listener doesn't work at all
idk add an nbt/pdc tag on creation
and try to retrieve the tag when player interacts with a villager
**I was wondering if it is possible to after I make something like (see yml below) then add some lines to prevent the player purchasing it again after a he has done it once and recieved his permission. **
Example: eglow.color.red.I need this to prevent players from spending their coins on the same color twice on accident.
||`'glow1':
material: red_dye
slot: 11
hide_enchantments: true
enchantments:
- DURABILITY;1
display_name: "&c&lRed glow"
lore:
- ""
- "&fCost: &#FF711E250 Gold"
- ""
- "&a&lβ₯ CLICK TO PURHCASE"
left_click_requirement:
requirements:
anything_here:
type: '>='
input: '%playerpoints_points%'
output: '250'
deny_commands:
- '[message] &cYou dont have enough &6gold &cto buy this glow.'
- '[close]'left_click_commands: - '[console] lp user %player_name% permission set eglow.color.red' - '[console] playerpoints:p take %player_name% 250'`||
tho you can just create a requirement that requires the player to not have a permission
theres a bit on it in the docs
oh no not that
i dont use inventory names to check within my plugins of those are my inventories
i check via addresses
nah i was making a plugin to work as a rat and return some data of some actions in an other plugin π thanks for all the advice i made it!
Forgot how this thing works, is this correct usage? String regionType = type instanceof FarmRegionType ? "farm" : "mine";
If it's true it should be set to "farm" else set to "mine"
Havn't heard of jshell before actually
Lol ty
Intellij scratch file is awesome
yes but much more effort when all you need is a single expression
var thing = true ? yes : no
answer to all your questions
ask no more
Lmao thank you! What's it called? This thing
ternary operator
Thanks
why is it saying material cannot be null when trying to use items from newer versions (such as NETHERITE_SWORD)? my paper api is on version 1.18.2?
[18:54:13] [Server thread/ERROR]: Error occurred while enabling ChestRegen v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: Material cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[commons-lang-2.6.jar:2.6]
at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:86) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.inventory.ItemStack.<init>(ItemStack.java:74) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.inventory.ItemStack.deserialize(ItemStack.java:516) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
here's the yml that its deserializing:
# Loot items for the chests
loot:
- type: DIAMOND
min: 1
max: 5
chance: 1
- type: IRON_INGOT
min: 1
max: 5
chance: 0.75
- type: NETHERITE_SWORD
min: 1
max: 3
chance: 1
in plugin.yml I have api-version: '1.18'
bad deserialize
?
is it a custom method you are using or what
no its just ItemStack.deserialize()
and how are you using it in your code
val lootItems = configFile.getList("loot")?.mapNotNull {
if (it is Map<*, *>) {
val min = (it["min"] as? Number)?.toInt() ?: return@mapNotNull null
val max = (it["max"] as? Number)?.toInt() ?: return@mapNotNull null
val chance = (it["chance"] as? Number)?.toDouble() ?: return@mapNotNull null
val item = ItemStack.deserialize(
(it as Map<String, Any>).minus(listOf("min", "max", "chance"))
)
LootItem(item, min, max, chance)
} else {
null
}
}
it works fine for every other item, it's just items from newer versions (i think 1.12+) that it doesn't recognize when i have them for the type field, like NETHERITE_SWORD would throw an error, but DIAMOND_SWORD works fine
ig it doesnt know what netherite sword is
π
do you have api-version set correctly
in plugin.yml
Β―_(γ)_/Β―
i dont think it should make a difference
but
Β―_(γ)_/Β―
yeah it really shouldn't
hm
mind posting the entire error?
yeah
1 sec
anyone have any idea how to get the loot/drops of a mob thru the bukkit/spigot/paper api? is it possible to do so without using nms?
i see Bukkit#getServer()#getLootTable() but not sure exactly how to use it
this syntax making me puke
Hey, im trying to compile the plugin 'oraxen'. i git cloneed the repo, then ran ./gradlew build
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :
w: file:///root/oraxen/oraxen/oraxen/build.gradle.kts:40:13: 'paperDevBundle(String? = ..., String = ..., String = ..., String? = ..., String? = ..., String? = ..., String = ..., ExternalModuleDependency.() -> Unit = ...): ExternalModuleDependency' is deprecated. Replaced by extension methods
> Configure project :core
Branch: master
FAILURE: Build failed with an exception.
* Where:
Build file '/root/oraxen/oraxen/oraxen/core/build.gradle.kts' line: 56
* What went wrong:
null cannot be cast to non-null type kotlin.String
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 2m 11s
root@germanythpire:~/oraxen/oraxen```
Build fails with this error, can i get some help?
line 56, which seems to be causing hte problem is empty
group = "io.th0rgal"
version = pluginVersion
//This is line 56
allprojects {
apply(plugin = "java")
repositories {
mavenCentral()
minecraft:entities/zombie for example i think
so perhaps something like new NamespacedKey(NamespacedKey.MINECRAFT,"entities/zombie");
tho maybe you should have a look at datapacks since they can override loottables and might have some insight into how to use loottables even if its just a basic understanding
im not saying to use datapacks, just see what they do
orr what about Lootable#getLootTable
yea i was just looking through Zombie javadocs π₯²
if i was to add custom drops to an entity i would just manually do it on mob death rather then using loottables, like i might make my own version of loottables but i wouldnt use minecraft's tables
maybe, idk if I've ever used loottables before
but for this usecase, I think loottables is the best option
yeah probably
honestly id rather not do that and just go even simpler with a datapack
its super easy to just override the table and i think thats what your supposed to do anyways
why is lore always italic?
fun replaceColorCodes(input: String): Component {
return LegacyComponentSerializer
.legacyAmpersand()
.deserialize(input)
}
val sword = ItemStack(Material.DIAMOND_SWORD)
sword.lore(
listOf(replaceColorCodes("&r&7Telepathy I"))
)
got it, i needed to put .decoration(TextDecoration.ITALIC, false)
use applyFallbackDecoration
applyFallbackStyle*
what's the difference between that and what i did?
applyFallbackStyle(TextDecoration.ITALIC.withState(false))
yours will override italics
but fallback will only disable italics if not set
i think
although if you hardcode it it really doesn't matter ig
i just did the .decoration() at the end of the listOf stuff not the actual replaceColorCodes fn
I would put fallback in replaceColorCodes
alright
how can i place a double chest? I placed two chests, but they're not joining together
in code?
oh probably
try this
I don't see Type.Left
nevermind!
this doens't work
(leftChest.blockData as Chest).type = Type.LEFT
Error: Type mismatch. Required: Material Found: Chest.Type
nvm, im awesome leftChest.blockData = Material.CHEST.createBlockData("[type=right]")
its possible you are casting it as the wrong chest
there is org.bukkit.block.data.type.Chest
and
org.bukkit.block.Chest
the first one's getType() uses Chest.Type and the second ones getType uses Material
ohh probably yeah
hello, guys what you think about this ? https://prnt.sc/RkEpmnB_rzEf
45$ monthly, Single thread 2468
For minecraft
terrible
D:
any suggestion for price/quality?
why do i have a little iron next to my EventHandler? It's like a lightning bolt with blue headphones on?
it is an event listener, just a small icon from mc dev plugin
gotcha, i was wondering if it was like a warning of some sort, ty!
hello! I was wondering: how do I parse papi placeholders in the case of a broadcasted message? The message is intercepted via the BroadcastMessageEvent
you can use a null Player
unless do you mean for each player gets their own placeholders?
like %player_name%
if so, you'll likely need to intercept packets as well
I need something like that yes
^ the best way would probably be to detect the messages via BroadcastMessageEvent, then use packets to intercept those messages
not optimal
but i dont think theres an alternative
besides modifying the plugins themselves
isn't there really an event fired for a message sent by a plugin to a player?
not that I know of
I tried searching in the purpur javadocs (we are using it for our backend) but I had no luck
for packets I would recommend https://github.com/retrooper/packetevents/ btw
what about ProtocolLib?
you can use that too, and that's what I myself have experience in, but I heard packetevents is a lot better
I do have 0 experience in packets ;-; but like, how does luckperms send its prefixes to essx? I could be happy by doing something like that too
doesn't it store it with a prefix.vip permission node?
I don't know how ess fetches it exactly since I haven't looked into it
I only know that somehow it is injected into the displayname based on weight (depends by lp config) and if permission has prefix text
LP does not inject anything anywhere
Essentials requests the prefix from luckperms
then essentials does some weird shenanigans 
oh boi
btw what is your usecase for this?
if you need a /broadcast to support PAPI, make your own /broadcast command
that's the awesome part of being a developer 
I'm also looking at their API (which I just discovered existing) and it's confusing me more than before, also the javadocs are... something?
for now I needed to add text via placeholders to everywhere {DISPLAYNAME} appears in chat from EssX
what is getDamageIncrease in Enchantment class?
does essx not already support {DISPLAYNAME}?
I haven't managed a server in forever so i dont remember
but as some guys stated on Purpur discord, I could just do my welcome message and afk too
yes but I need to do %my_prefix%{DISPLAYNAME}
can you link the javadocs? I can't find it on https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/enchantments/Enchantment.html
declaration: package: org.bukkit.enchantments, class: Enchantment
in intellij it just says "
Gets the damage increase as a result of the level and entity category specified
Params:
level β the level of enchantment entityCategory β the category of entity
Returns:
the damage increase
"
doesn't specify which package is from?
?
yeah i see the function description but i have nooo idea what it's used for π€
I think this methods gives you the increase of damage from the base damage based on enchantment level, properties and entitiy it is used on
so would it be for like sharpness for example?
Sharpness adds 0.5 * level + 0.5 extra damage according to mc fandom, so let's say you are using it on Sharpness 4, getDamageIncrease() returns 2.5
what do you mean by required?
like if you want to extend Enchantment, you have to add that method
i'm a new java dev so theres probably a reason but i find it a little weird
what you need to extend for?
making custom enchants
hmm, that's interesting
I assume you just put 0
I see, but I think you can just return 0 if your enchanting is harmless
yeah that's what im doing
im gonna make a wrapper class so i dont need all these random things
anyway yes, I think I'll make my own welcome and afk methods for my own joy ;-;π
i personally modify and check the itemstack's nbt data manually instead of trying to register the custom enchant using the vanilla enchants system
just cus all ive seen of others doing it using the vanilla system is complaints of something not working right
Β» Give the helpers some details
Β» Ask suitable questions
Β» Be polite
Β» Wait
anyone ? can you help me with player pushing each other and also help me make the server less laggy?
this channels is for coding help
while there isn't really a support channel for what you're asking, you can try asking in #1007620980627230730 with the server help tag or #minecraft
I would also provide a timings and/or a spark report for the lag issue
for players pushing each other, you can use paper and in paper.yml, search for collisions -> enable-player-collisions and change it from true to false
if you aren't already using paper, you can download it at https://papermc.io/downloads/paper
If I make an event/listener system, should the listener be ran on the same thread as the event if the event is called when read from a socket? Or should I pass the data to listeners on a separate thread?
i mean, it doesn't technically matter, it will likely work the same, but for true async message passing they probably should be run at least on some sort of thread pool scenario where they can share resources and actually run concurrently
Hello, I have a question about PAPI. I have read this guide: https://github.com/PlaceholderAPI/PlaceholderAPI/wiki/Hook-into-PlaceholderAPI, but I have some doubts.
Let's assume a situation where I want to use placeholders in the message displayed after defeating a player. I'm not entirely sure how I can apply this to two players at the same time. Sample message: "%victim_player_name% was killed by %killer_player_name%". The PlaceholderAPI.setPlaceholders() method accepts only one player. How to do that? W will be glad for help!
The player variable is the player receiving the message, so the method will be run for each player viewing the message
Since this is a death message and the values donβt depend on the player viewer, you donβt need any variables
assuming you can retrieve the values from your event or whatever
I don't quite understand. I want to have placeholders for two players in one string. I gave the example with death message because there is such a situation there.
Now suppose I want to send a death message to all players on the server. I get the message from the plugin configuration file and now I need to replace the placeholders with values. How to tell these players apart? For example, their prefixes: %player1_vault_prefix%, %player2_vault_prefix% or in this case %victim_vault_prefix%, %killer_vault_prefix%. I have no idea how to write this in code.
Well in this case using placeholderapi is probably not the best idea? Just string replaceall would be easier probably
Assuming these values are grabbed from an event or something
You can also pass a null player
But that wonβt work for this use case
Example:
public String replacePlaceholders(String message, Player victim, Player killer) {
String victimPrefix = /* code to get victim's prefix */;
String killerPrefix = /* code to get killer's prefix */;
message = message.replace("%victim_vault_prefix%", victimPrefix);
message = message.replace("%killer_vault_prefix%", killerPrefix);
return message;
}
π
PlaceholderAPI isn't what you need here. you'd use it for example for something that is based on the player viewing, but for global things its better to just directly replace it with regular string methods, and much faster too anyway
and not only that, you should really only want to use it when you want to support other plugin placeholders, or want other plugins to use your placeholders
I understand, thank you for your help!
if another plugin was the one providing the %victim_vault_prefix% or whatever in question, then yeah you would need to use it maybe, but since its all internal don't bother
Agree 
if you for example, decide to track player kills or whatever and make a %player_kills% placeholder, then that also calls for placeholderapi support, in case you want to use %player_kills% in your tablist or chat plugin or etc etc
its kind of like:
Valid: Plugin1 -> PAPI -> Plugin2
but you're asking more for
Plugin1 -> PAPI -> Plugin1
Could someone tell me what is going on here?
Im trying to make other players invisible via the entityMetaDataPacket and ProtocolLib
new PacketAdapter(PixelParty.INSTANCE, PacketType.Play.Server.ENTITY_METADATA) {
@Override
public void onPacketSending(PacketEvent event) {
//
WrapperPlayServerEntityMetadata wrapper = new WrapperPlayServerEntityMetadata(event.getPacket());
Entity entity = wrapper.getEntity(event);
Bukkit.broadcastMessage(event.getPlayer().getName() + " - " + entity.getName());
if(!Objects.equals(entity.getName(), event.getPlayer().getName())) {
List<WrappedWatchableObject> watchers = wrapper.getEntityMetadata();
for(WrappedWatchableObject watcher : watchers) {
if(watcher.getIndex() == 0) {
watcher.setValue((byte) 0x20);
}
}
}
}
});```
The name check is respected when only one player is online, however the second player loads in not being able to see themselves and shortly after the first player disapears to themselves as well
The name check should be fine as far as my printouts have gone, but I have also tried comparing entity and entityID
I just have no idea how in any case a player would be invisible to themselves with that if statement
Inside open commands, from deluxemenus. How can I set a command to move you between modes?
new PacketAdapter(PixelParty.INSTANCE, PacketType.Play.Server.ENTITY_METADATA) {
@Override
public void onPacketSending(PacketEvent event) {
WrapperPlayServerEntityMetadata wrapper = new WrapperPlayServerEntityMetadata(event.getPacket());
Entity entity = wrapper.getEntity(event);
Bukkit.broadcastMessage(event.getPlayer().getName() + " - " + entity.getName());
if(!Objects.equals(entity, event.getPlayer())) {
List<WrappedWatchableObject> watchers = wrapper.getEntityMetadata();
for(WrappedWatchableObject watcher : watchers) {
if(watcher.getIndex() == 0) {
watcher.setValue((byte) 0x20);
}
}
}
}
});
?
Oh you reformatted it, thanks.
Yea
why not use the API?
Player#hidePlayer or something
can someone help me with this confusing world edit issue
im trying to give my builders the permission world.edit.* right using my own plugin but when they go and //wand
the command works but the little things after it are red and this message pops up
unknown or incomplete command, see below for error at position 1: /
its a development thing isnt it?
no, here we only provide help with codes
The screenshots definitely tell us all the context we need to know, thank you
Can you please send here? The resolution from the phone is low
I cannot send images to this chat :/
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.
Just copy and paste
Owh I see I forgot to write LMAO but I guess I found out
I have no perms to 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.
Nice
I'm talking about the code
owhh ahaha
nvm I found out the fix but tysm for the help i appriciate it :)
No problem π
The problem was me forgeting to use p.spigot().sendmessage
ahaha
I instead used p.sendmessage
Oh π
aahaha
You are welcome matt
Any idea on why I'm getting null
public static void TradeSystem(Player p, String args[]) {
if (args.length == 2) {
if (args[0].equals("request")) {
Player tradeWith = Bukkit.getPlayer(args[1]);
if (Bukkit.getOnlinePlayers().contains(tradeWith)) {
messagePlayer(p, true, "You sent a trade tequest to: &6" + args[1]);
requestTrade.put(tradeWith, p);
TextComponent accept = Logger.createClickableMessage(HoverEvent.Action.SHOW_TEXT, ClickEvent.Action.RUN_COMMAND, "&2Accept Trade", "&2Accept Trade", "/trade accept");
TextComponent decline = Logger.createClickableMessage(HoverEvent.Action.SHOW_TEXT, ClickEvent.Action.RUN_COMMAND, "&4Decline Trade", "&4Decline Trade", "/trade decline");
messagePlayer(tradeWith, true, "&6" + p.getDisplayName() + "&7 wants to trade with you ");
messagePlayer(tradeWith, true, "&7Click to accept:");
tradeWith.spigot().sendMessage(accept);
messagePlayer(tradeWith, true, "&7Click to decline:");
tradeWith.spigot().sendMessage(decline);
} else {
messagePlayer(p, true, "&c" + args[1] + " &6 is not online");
}
}
} else if (args.length == 1) {
if (args[0].equals("accept")) {
if (requestTrade.isEmpty()) {
messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
return;
}
if (requestTrade.containsKey(p)) {
Player tradeWith = requestTrade.get(p);
if (Bukkit.getOnlinePlayers().contains(tradeWith)) {
//create the menu and then open it for the player
tradingPlayers.put(p, tradeWith);
requestTrade.remove(p);
Inventory tradeMenu = new TradeMenu().CreateInventory();
p.openInventory(tradeMenu);
tradeWith.openInventory(tradeMenu);
} else {
messagePlayer(p, true, "&c" + args[1] + " &6 is not online anymore");
requestTrade.remove(p);
}
} else {
messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
}
} else if (args[0].equals("decline")) {
if (requestTrade.isEmpty()) {
messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
return;
}
if (requestTrade.containsKey(p)) {
Player tradeWith = requestTrade.get(p);
messagePlayer(p, true, "&6You have declined the trade request");
messagePlayer(tradeWith, true, "&c" + p.getDisplayName() + " &6 Has declined the trade request");
requestTrade.remove(p);
} else {
messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
}
} else {
messagePlayer(p, true, "&4Command timed out");
}
} else {
messagePlayer(p, true, "&4Command timed out");
}
}```
Stop sending images lol
How am I gonna send the error log
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
might be too long and considered as spam
Thats not pastebin. Also how TF would pastebin be banned?
I have no clue It has been banned in my country since 2012
there are hundreds if not thousands of paste sites
ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
Utils$PlayerManager.TradeSystem (Utils.java:353)
in line 353 in your utils class you are trying to access object at index 1 in an array that only has 1 element (at index 0)
which one is line 353?
messagePlayer(p, true, "&c" + args[1] + " &6 there are no active trade requests");
i think
im guessing here yeah
You might want to replace that with like p.getName()
aightt tysmm lemme check
oh there are many uses of args[1] under that check
you'll want to not have those cuz they'll all fail lol
πππ
alrr fixeddd
Iβm trying to use the invisibility effect so that I can use the see friendly invisibles scoreboard teams feature
what the code did i just read
How can i get the actual string value of an item displayName() ?
item#displayName is the displayName but it also has square brackets before/after?
item.itemMeta.displayName() works, that's weird there's two different functions ?
ItemStack#displayName() is a misnomer, it's how the game shows the item, for example, when you kill someone with a renamed or enchanted item, it'll have the brackets and you can hover your cursor over it and see some of the item details
ItemMeta#displayName() is the component in the NBT display.Name
ohh, i see thank you!
Hello, i need a little help with a plugin Im making, so its a type of authentication but thing is that i have a flaw where the users can still use commands while not being authenticated. How could i disable users rights to use any other command than the plugins /authenticate command?
i think a good solution is to have only the /authenticate permission node given to players by default, and only add the other permission nodes after the users go through the authentication process
if this is a plugin you are making for public use, you can have a config setting for the permission node(s) to apply to players after the auth process is completed
Yeah in the mean time i figured the same, since i haven't done this before really. Would this be sort of difficult to implement? This is used for private not public and i dont have any other plugin nor do i plan on adding.
i dont think it'd be particularly challenging to implement
Okay, thank you so much. <3
π
Question: is there any reason not to use an interface over a regular class for a class containing purely (or mostly) constants / sf variables?
You canβt really prevent the interface from being extended/implemented
Yeah but when it only contains those constants that's not really relevant is it?
Well you could argue itβs bad design
But afaik interfaces donβt allow static initializers, so thatβs a limitation too
yeah those are the reasons i was expecting, just not sure what they are
static initialisers?
are those the ```
static {
}
blocks
Ah those
I might be saying this wrong, isn't interface just a mockup of another class?
It can have fields, but they're all public, static and final
I found it used for LuckPerms' messaging system, and it seems pretty clean
im pretty sure there is an event when you attempt to call a command
hmm
commandpreprocessevent or smth
you could cancel that if they arent authenticated
this is the way, just make sure to put your priority last
lowest in this case cus you wanna have the final say
highest comes last :^)
well, monitor comes last but you are not meant to modify the event
Thank you so much just tried it out, exactly what i needed.
Asking anybody now theres probably a way better method for this, but whenever i make change to my plugin i have to rebuild it and restart the server, im using Eclipse is there a more time efficient way?
Hey whats a better way to do this?
List<String> message = new ArrayList<>();
message.add(Colors.translate(user1.getName() + "&7:"));
message.add(Colors.translate("&7Kingdom &8> &7" + user1.getKingdom_Display()));
message.add(Colors.translate("&7Rank &8> &7" + user1.getRank_Display()));
message.add(Colors.translate("&7Points &8> &a" + String.valueOf(user1.getPoints())));
message.add(Colors.translate("&7Status &8> #2cbf4c&lONLINE"));
for (String msg : message)
player.sendMessage(msg);```
Like a Stringbuilder or something?
StringBuilder messageBuilder = new StringBuilder();
messageBuilder.append(Colors.translate(user1.getName() + "&7:")).append("\n");
messageBuilder.append(Colors.translate("&7Kingdom &8> &7")).append(user1.getKingdom_Display()).append("\n");
messageBuilder.append(Colors.translate("&7Rank &8> &7")).append(user1.getRank_Display()).append("\n");
messageBuilder.append(Colors.translate("&7Points &8> &a")).append(user1.getPoints()).append("\n");
messageBuilder.append(Colors.translate("&7Status &8> #2cbf4c&lONLINE"));
player.sendMessage(messageBuilder.toString());``` is this better?
java has multiline strings
No it returns a int, I think its indeed unnecessary to use String.valueOf().
String message = Colors.translate(
user1.getName() + "&7:" + "\n" +
"&7Kingdom &8> &7" + user1.getKingdom_Display() + "\n" +
"&7Rank &8> &7" + user1.getRank_Display() + "\n" +
"&7Points &8> &a" + user1.getPoints() + "\n" +
"&7Status &8> #2cbf4c&lONLINE");```
Got this π
is it really
no
thought so
oh alr
}.runTaskLater(Kingdom.instance, wilderniss ? Kingdom.instance.kGetConfig().SpawnTimeWilderniss * 20 : Kingdom.instance.kGetConfig().SpawnTime * 20);``` do I need to use Long for this?
For this "Kingdom.instance.kGetConfig().SpawnTime * 20"
Java will convert int to long
You can use a StringJoiner and then have a single Colors.translate call at the end 
or consider to use components if you are using paper
there was a gradle plugin for launching server etc, it was included in paper examples if i remember correctly
guys how to fix it
[17:41:13 WARN]: [DeluxeMenus] Plugin DeluxeMenus v1.13.7-Release generated an exception while executing task 32652037
java.lang.NullPointerException: null
help
idk
Hey guys! Just joined the discord looking for some support. I've been developing an alternative bundle plugin for minecraft that bascially opens a gui with 9 slots. I've been having an issue where I can put a bundle inside of the gui with the use of hotkeys, I have a system stopping players from being able to shift click or drag them in but I can use hotkeys to bypass that. Can anyone help?
this is my system for not being able to drag or shift click bundles into the gui:
(also i used a debug stick and re-textured it so ignore that)
public void onInventoryClick(InventoryClickEvent event) {
Inventory inv = event.getInventory();
if (event.getClickedInventory() != null && event.getView().getTitle().equals("Bundle")) {
if (event.getCurrentItem() != null) {
ItemStack clickedItem = event.getCurrentItem();
if(event.getCurrentItem() == null){
event.setCancelled(true);
return;
}
// Check if the clicked item is a bundle
if (clickedItem.getType() == Material.DEBUG_STICK && clickedItem.hasItemMeta() &&
clickedItem.getItemMeta().hasDisplayName() &&
clickedItem.getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Bundle")) {
// Cancel the event to prevent placing bundles inside the bundle GUI
event.setCancelled(true);
}
}
}
}```
Can't really read the code on mobile but I think there's like a getNumKey method or smth
Ik it's not called that
But I think something like it exists
But what if for example, instead of 9 for slot 9 in my hotbar I use Z. Then using something related to numbers wouldnt work, if im not mistaken
Server-side doesn't know about keybinds and stuff
It just sees it as 9 (edit: 8)
getHotbarButton
Btw
InventoryCreativeEvent
Use that
Anybody know why I am getting an error trying to implement the VaultAPI? I remember this being an issue in the past and honestly I can't remember how I resolved it
try deleting the local maven repo and forcing gradle to retrieve it again
Check the jitpack logs
i think this is a jitpack issue
Tried that nothing changed
how can I check the jitpack logs?
Uhh, well I would tell you except its not there anymore. Not sure what I did, but the error is gone all of a sudden
Oh ok
BTW intellij does that for new repos I think before you refresh maven
Or new dependencies
Or both
It's kinda misleading
Especially since it's marked as an error
Yeah, I had the issue in a previous project as well and it just sort of fixed itself after an hour
yeah and jitpack is also buggy
sometimes it's down for no reason
stopped using it cause i hated running into these random errors lol
well in this case i pretty much have no choice since vaultapi requires jitpack
unless u want to compile it into your maven local
can you or @dusky harness make a snippet? sorry im a little confused
Could someone help me understand how this code could possibly effect a player who is not receiving the packet?
https://paste.helpch.at/edubewedix.csharp
I thought at first it might be an issue where the DataWatcher obtained from the packet object being the same instance as the one attached to the player, but even after a deep copy, if the metadata of a player is set to invisible at all when sending a packet to another player, it causes the original player to still see themself as invisible.
// Hide player2 from player1
player1.hidePlayer(plugin, player2);
// Show player2 to player1
player1.showPlayer(plugin, player2);
Use API
The code has a check to prevent the packet from being modified if the entity in the packet is the same as the player receiving the packet (if(event.getPlayer().getEntityId() == entityId) return;).
This means that a player should not receive an altered packet about themselves, and therefore should not see themselves as invisible.
If a player is seeing themselves as invisible, it might be due to another part of your code or a plugin that is sending an ENTITY_METADATA packet to the player about themselves with the invisibility flag set. You might want to check other parts of your code or any other plugins youβre using to see if they might be causing this issue.
maybe like this idk:
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
// Your existing code...
// Check the inventory after a delay to allow the hotkey action to complete
Bukkit.getScheduler().runTaskLater(plugin, () -> {
Inventory inv = event.getInventory();
Player player = (Player) event.getWhoClicked();
// Iterate over the slots in the inventory
for (int i = 0; i < inv.getSize(); i++) {
ItemStack item = inv.getItem(i);
// Check if the item is a bundle
if (item != null && item.getType() == Material.DEBUG_STICK && item.hasItemMeta() &&
item.getItemMeta().hasDisplayName() &&
item.getItemMeta().getDisplayName().equals(ChatColor.GOLD + "Bundle")) {
// Remove the bundle from the GUI
inv.clear(i);
// Add the bundle back to the player's inventory
player.getInventory().addItem(item);
}
}
}, 1L);
}```
Does anyone know how to turn this code into a minecraft paper plugin?
Code:
https://bit.ly/3uCf5jr
(I need nitro to send code in message)
no you don't
1, very incomplete code
wouldnt work
if your using chatgpt, dont make it a paper plugin tbh
I did not use chatgpt
I'm just new
To coding
// Check if the role already exists
// Assuming playerRoles is a Map<String, String> where key is playerName and value is the assigned role
/shrug/ feels very much chatgpt written
Iβve confirmed that this is indeed the issue
And came to the same conclusion as you
I think it might boil down to some strange protocol quirk that isnβt documented well
Good job ππ
Well thatβs just my theory, the issue hasnβt been solved
@eternal wolf
public static List GetOwnedSlots() {
Logger.success("Henllllo");
List<Integer> ownedslots = new ArrayList<>();
int column;
for (int turns = 0; turns > 20; turns++) {
switch (turns){
case 6:
column = 1;
Logger.error(column + "Henlos");
break;
case 11:
column = 2;
Logger.error(column + "Henloss");
break;
case 16:
column = 3;
Logger.error(column + "Henlosss");
break;
default:
column = 0;
Logger.error(column + "Henlossss");
break;
}
column += 9;
ownedslots.add(column);
Logger.error(column + "Henlo");
}
Logger.success(ownedslots.stream().toString() + " Henlo2");
return ownedslots;
}
}```
[22:05:30 INFO]: [GC] Henllllo
[22:05:30 INFO]: [GC] java.util.stream.ReferencePipeline$Head@1be2453 Henlo2
[22:05:37 INFO]: [GC] Henllllo
[22:05:37 INFO]: [GC] java.util.stream.ReferencePipeline$Head@1012571e Henlo2```
what is the problem?
for (int turns = 0; turns > 20; turns++) {
turns are never greater than 20
it should be for (int turns = 0; turns < 20; turns++) {
happens
tysm :)
IntelliJ should tell you that there's something wrong already
It does not
It does
any way i can speed up the time it takes for fish to bite? I basically want to simulate 'lure' except even faster, since i think lure above level 3 doesn't increase the speed
or invoke a fish bite somehow
Is there an event for dropping an item from a gui? Also I've been working on a bundle plugin that has 1 row in a chest gui, but whenever I drop an item that is in the slots (top half) they dissapear instead of falling out.
what do you mean by "drop", like the same as pressing q?
I used this then tried dropping an item from my gui, and it didnt say anything in chat
public void onPlayerDropItem(PlayerDropItemEvent event) {
event.getPlayer().sendMessage("test123");
}```
your events class isnt registered as a listener
is this in the same class as the main plugin?
yes, this is just a snippet. Also if i drop an item outside of the gui, like from my hotbar or even in my main inventory gui it does function and send the test message
oh, then it is registered
hmm
so if you put an item in a gui and then press q on it (or whatever), it does not print?
Well if I drop an item from the gui, it doesn't send the message and the item just goes away. As in it just doesnt drop from the inventory, it dissapears when i drop it lol
thats weird, the item disappearing might be some other plugin, but the event should still fire and print...
im not sure
I could send you my code, i dont see why any of this would happen
sure, use the paste
?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
click the first link
i think i got it @signal grove
mb lol
yeah honestly no clue, i can't see anything that would cause the PlayerDropItemEvent not to fire in a gui
damn alr
try detecting it via InventoryClickEvent
it should fire in there
don't know why it wouldn't fire in drop event tho
Figured it out, the playerinteract event I have was not limited to only right clicking, it happend every time i tried to drop something.
if (tradingPlayers.containsValue(p)) { //Player 1
if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
ItemStack clickedItem = InventoryClick.getCurrentItem();
for (Integer i: getOwnedSlots()){
if (p.getOpenInventory().getTopInventory().getItem(i) == null){
int amount = 0;
for (ItemStack itemStack :p.getOpenInventory().getBottomInventory().getContents()) {
if (itemStack != null) {
if (itemStack.getItemMeta() == clickedItem.getItemMeta()) {
amount += itemStack.getAmount();
}
}
}
clickedItem.setAmount(amount);
p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
p.getOpenInventory().getBottomInventory().remove(clickedItem);
break;
}
}
return;
}```
I'm trying to loop thru all the slots of the bottom inventory to check if there is another item that is same in the inventory so I can send it to the other inventory without item loss
Β» Give the helpers some details
Β» Ask suitable questions
Β» Be polite
Β» Wait
what is the issue?
I cannot rlly explain it you can only see it
Can you try with this:
if (tradingPlayers.containsValue(p)) { //Player 1
if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
ItemStack clickedItem = InventoryClick.getCurrentItem();
for (Integer i: getOwnedSlots()){
if (p.getOpenInventory().getTopInventory().getItem(i) == null){
int amount = 0;
for (ItemStack itemStack :p.getOpenInventory().getBottomInventory().getContents()) {
if (itemStack != null) {
if (itemStack.getItemMeta() == clickedItem.getItemMeta()) {
amount += itemStack.getAmount();
p.getOpenInventory().getBottomInventory().remove(itemStack);
}
}
}
clickedItem.setAmount(amount);
p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
break;
}
}
return;
}
}
lmk
if (tradingPlayers.containsValue(p)) { //Player 1
if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
ItemStack clickedItem = InventoryClick.getCurrentItem();
for (Integer i: getOwnedSlots()){
if (p.getOpenInventory().getTopInventory().getItem(i) == null) {
if (clickedItem.getAmount() <clickedItem.getMaxStackSize()) {
int amount = 0;
for (ItemStack itemStack : p.getOpenInventory().getBottomInventory()) {
if (itemStack != null) {
if (itemStack.getType().equals(clickedItem.getType())) {
amount += itemStack.getAmount();
p.getOpenInventory().getBottomInventory().remove(itemStack);
}
}
}
clickedItem.setAmount(amount);
}
p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
break;
}
}
InventoryClick.setCancelled(true);
return;
}```
I did this lemme give it a try and let's see what happens
Okay thats right
if (tradingPlayers.containsValue(p)) { //Player 1
if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
ItemStack clickedItem = InventoryClick.getCurrentItem();
for (Integer i: getOwnedSlots()){
if (p.getOpenInventory().getTopInventory().getItem(i) == null) {
if (clickedItem.getAmount() <clickedItem.getMaxStackSize()) {
int amount = 0;
for (ItemStack itemStack : p.getOpenInventory().getBottomInventory()) {
if (itemStack != null) {
if (itemStack.getType().equals(clickedItem.getType())) {
amount += itemStack.getAmount();
p.getOpenInventory().getBottomInventory().remove(itemStack);
}
}
}
clickedItem.setAmount(amount);
}else{
p.getOpenInventory().getBottomInventory().removeItem(clickedItem);
}
p.getOpenInventory().getTopInventory().setItem(i,clickedItem);
break;
}
}```
how about this?
if (p.getOpenInventory().getBottomInventory().equals(InventoryClick.getClickedInventory())){
ItemStack clickedItem = InventoryClick.getCurrentItem();
int amount = 0;
for (ItemStack itemStack : p.getOpenInventory().getBottomInventory().getContents()) {
if (itemStack != null) {
if (itemStack.getType().equals(clickedItem.getType())) {
amount += itemStack.getAmount();
p.getOpenInventory().getBottomInventory().remove(itemStack);
}
}
}
for (Integer i: getOwnedSlots()){
if (p.getOpenInventory().getTopInventory().getItem(i) == null) {
ItemStack itemToMove = new ItemStack(clickedItem.getType());
if (amount > clickedItem.getMaxStackSize()) {
itemToMove.setAmount(clickedItem.getMaxStackSize());
amount -= clickedItem.getMaxStackSize();
} else {
itemToMove.setAmount(amount);
amount = 0;
}
p.getOpenInventory().getTopInventory().setItem(i, itemToMove);
if (amount == 0) {
break;
}
}
}
InventoryClick.setCancelled(true);
return;
}
}
hello guys! i just entered server and the welcome chat message was literally a png of the logo of the server.. how is that possible? does it works with a font resource pack or is there any other option?
#minecraft would probably be more suitable to ask
ok ty!
it worked tysmm
if (getOwnedSlots().contains(InventoryClick.getSlot())) {
ItemStack clickedItem = InventoryClick.getCurrentItem();
p.getOpenInventory().getBottomInventory().addItem(clickedItem);
p.getOpenInventory().getTopInventory().removeItemAnySlot(clickedItem);
InventoryClick.setCancelled(true);
}```
I have one more question :,(
sorry for keeping you busy
but how can I make it only remove the slot I clicked
actually like make it go from bottom to top so no matter where the player clicks it will remove the same item from the bottom and not let the inventory have a gap in between items
ItemStack clickedItem = InventoryClick.getCurrentItem();
p.getOpenInventory().getBottomInventory().addItem(clickedItem);
p.getOpenInventory().getTopInventory().clear(InventoryClick.getSlot());
InventoryClick.setCancelled(true);
}
anyone able to help me with a small job?
willing to pay if neccessary but I want an old plugin modified very slightly
it already sends admins a message when they join the server alerting them of the sub-domain used to join... but I want to be if it's not the main sub-domain to send them a message "You joined using X domain, you should be using X instead!"
im willing to pay
Np open dms π
But i dont want to delete all the same typed items i want to only remove the one thatβs in the bottom of the inventory so i can make when a item is removed the null slot is being filled with the slot that is after it
So there is no gap in between two slots
Like this?
if (getOwnedSlots().contains(InventoryClick.getSlot())) {
ItemStack clickedItem = InventoryClick.getCurrentItem();
p.getOpenInventory().getBottomInventory().addItem(clickedItem);
p.getOpenInventory().getTopInventory().clear(InventoryClick.getSlot());
InventoryClick.setCancelled(true);
ItemStack[] contents = p.getOpenInventory().getBottomInventory().getContents();
for (int i = InventoryClick.getSlot(); i < contents.length - 1; i++) {
contents[i] = contents[i + 1];
}
contents[contents.length - 1] = null;
p.getOpenInventory().getBottomInventory().setContents(contents);
}
hi i was looking to get into plugin development but im not sure how to start
my questions are:
does anyone have a reccomended tutorial for the basics?
are there differences between mc versions and which should i start in?
what is the difference between paper and spigot?
i did a little python and c# before and also made alot with skript
Hey can anyone please help me add models in my server with oraxen?
I know this is a little bit of a dumb question, however I am getting back into this after 2 years or so.
I am starting to use PaperMC's api, and I noticed that the Bukkit ChatColor got depreciated. What do I do in replacement of ChatColor and the TranslateAlternateChatCode or whatever it was called?
Watch the Kody Simpson series on youtube, he did like a 90 part series of basically everything you'd need to know in spigot development
He also have a java tutorial series as well, if you're not familiar with the basics of java
you might want to look into adventure and minimessage
Are those new APIs?
^ it's deprecated in favor of adventure
You can still use chatcolor just fine, but they want to push people towards adventure by giving the IDE notice and stuff
Ah
kinda
it's been in paper since 1.16.5
also, static imports make adventure a lot nicer to use, imo :)))
like the only times i use static imports lol
@dusky harness any idea why IntelliJ can't find the depenency for AdventureAPI?
I've added it to my pom.xml already as the docs explain to do, but for some reason BukkitAudiences just cant be found
BukkitAudiences is specific to the bukkit adapter
if you only want to target paper, it's probably easier to just use that (a Player is an Audience there already)
BukkitAudiences is for non-paper
basically if you're shading adventure
if you're using latest version + paper, there shouldn't really be any reason to shade it
ah so essentially I just do this then
Component msg = MiniMessage.miniMessage().deserialize("<rainbow>THIS IS RAINBOW</rainbow> <gray>and this is normal gray</gray>");
Player p = (Player) commandSender;
p.sendMessage(msg);
The </ tags there are redundant but yeah
Gotcha
I read they were redundant in the documentation but I guess my hours of writing things in bbcode for TS and Enjin got to me lol
they turned into a crypto scam didnt they
yes they did
well they turned into a crypto wallet
Yikes lmao
Solved
^
Thanks alot I wrote it down and I'll look into it
They are probably 3-4 years old at this point, I canβt remember when I first saw them, but there isnβt a whole lot that is different from the older versions
Alright
thru the bukkit api, is there a way to get the loot table of a specific entitytype? like the odds, etc
I've looked at loottable, lootable, and lootcontext, but they all seem to require an actual entity object. and then i've only been able to get the resulting loot, not the actual odds of the all the possible loot
Edit: probably wouldn't work
i attempted this, but using lootcontext i was only able to get what loot would come after the odds
Hmm
Probably possible with nms
I'm looking at nms mappings
If you use something like paperweight it shouldn't be tooooooo hard to figure out
I think idk
i'd figured it was, was just hoping could do it thru bukkit since they already have some loot stuff
Hmm, don't know why they only expose those 2 methods
yeah its actually funny
Unless mojang does too, I only looked at the fields
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/loot/LootTable.html
you'd really think there would be some kind of loot map here
I think mojang keeps it in a private field
And so it's unaccessible unless cb uses reflection
Assuming the loot map is the List<LootPool> variable in nms LootTable
I am making a cross server supported skyblock plugin, just like hypixel's. And of course it uses many services. Should I add a http api and manage almost every action from there or stick to the old system and just use the services inside the plugin? Even if I use an http api I would still need to use some of the services in the plugin too, and thats what made me think
I wonder what you guys think about this
feel free to ping me
the old one was working btw, but I just wasnt sure about the scalability and safety (lock, data loss etc)
Iβm looking for devs
cool
@dawn viper help me
what
?
what should be null
t in the line
that is the problem
input is B, and Bukkit.getPlayer("B") should be null
found the way π₯²
getPlayerExact
That nesting tho
Question
Say you have a method that gets a profile from a database/cache and returns a future
How would you use this in places where you need the profile sync? (Eg scoreboard tick)
when the future completes, use the scheduler to update the scoreboard sync
if you're using CompletableFuture, see .thenAccept
Hello. Any chance, anyone here can help me get TailwindCSS tab completion work properly in PyCharm? I have the TailwindCSS plugin.
I am using the TailwindCSS CLI to generate the .css file not the npm package. The problem is that the CLI can only generate the minimized styles. From what I found on github and youtrack issues, there is no single compilation for all TailwindCSS styles.
From what I can see, the tailwind developers don't want to give a compilation of all styles because it is pretty big and they don't want people to be sending these over the network. I don't want to send it in requests, I just want to use it for tab completion in pycharm...
Uh, two questions, 1. is there a good reason to not use the npm package? It's just basically the CLI but better, the only reason would be if you're not using Node at all during development, and even then it's pretty easy to just do it.
- Have you tried just putting a
tailwind.config.jsfile in your project? That's how the IJ Tailwind plugin gets its settings and can provide you lints. I ran into an issue where I was usingtailwind.config.ts(typescript) and it would not recognize it.
I don't use node yeah. I also don't use ts either. My config file is tailwind.config.js but afai can tell, the plugin only works with the npm module
I don't want to install it either. I might have to though
There is no time to wait! Ask your question @outer kestrel!
You will definitely have to install it somewhere, probably globally if you're not using npm in your actual project, so that it can run the tailwind cli through that
Can you explain a bit more and in #placeholder-api?
This channel is for coding help
Well I don't have to if I don't want tab completion
But I do. I guess its time to install it
I mean yeah lol
just embrace node.js π
i'm curious what you're working with though that's not node, Spring or something?
damn what are you building that's that speed dependent?
most stuff will be served pretty well with just a node based website lol
unless you're going really hard on a backend, but even then, usually you have a separate frontend yk
not speed dependent
just want to learn new stuff
also, I dislike javascript. For a long time I've just hated doing frontend stuff and after trying htmx, I've realised it is just javascript's fault
lol
TS is pretty nice, I've really gotten into it recently
and it's just basically impossible to avoid the whole frontend ecosystem is in JS/TS
I've been liking Vue recently honestly, but even stuff like Svelte is super refreshing for people who don't like normal JS stuff
Is there a way to cancel chunk specific weather with paper or do I need NMS for this?
In Spigot the weather is controlled at the world level
How does worldguard manage region specific weather?
do someone have some tutorials that can help me make custom abilities for some cool weapons im making? For instance one weapon granting the person holding it speed and the weapon has like a 50% chance of giving them the flame effect? Or have time to teach me?
Player#setPlayerWeather
probably
what flame effect?
for the speed one, you can probably just check like every tick if the player is holding the item, and apply speed potion effect if so
Like fireaspect but it has a 50% chance of being activated on a player?
The thing is idk how to do it
how much experience with java & spigot do you have?
this ones easier to explain/is simpler to code
I have watched some basic tutorials on Java but yeah thatβs about it
Wanna help me or something?
yeah I just want to know how much you know already
hm ok, so what have you made so far?
just simply
Well I have just made the model and sword and got it in game
wait model?
This is for spigot & a resource pack, not forge/fabric, right?
Blockbench model
but for the coding aspect of it, are you using forge/fabric?
or spigot plugins
I assume it would be forge/fabric
do you have a build.gradle or build.gradle.kts file?
assuming you made the coding project already
oh wait or do you mean like raw Java
you didn't watch a tutorial on how to make the mod/plugin yet
Ye, itβs impossible to find tutorials on it online
Iβve searched for everything
edit: i can send you if you want but it's not really needed here atm
so idk why i wrote all that
but
ok
anyways
I have no clue tbh
so like PlaceholderAPI
you want to make a plugin like that?
obviously with different features
but like same server setup
Idk if itβs a plug-in, can I just send you something in DMs maybe youβll understand a little bit better?
yeah
my brain's going wack
Anyone have a java solution for AOC?? I'm losing my mind here 
This is my solution: https://paste.helpch.at/evemuwukih.java
|| hint: the words can overlap, an example would be 4eightwo, which would be 42, so using a regex is not the greatest. also, you have to include normal numbers as well, not just the words, which it looks like you're skipping ||
I don't skip numbers, there's \d at the begin of the regex, but I didn't know that they can overlap
oh yeah, i just wouldn't recommend regex tbh
π¦
FINALLY GOT IT!
yeah but that's why I use htmx. to use as little of it as possible
yeah i guess
idk, i just had goals of using nice component libraries and stuff and having nice interactive websites and using htmx for that kind of highly interactive stuff is actual hell
it's certainly nice for lower interactivity stuff, but i find that even when i'm doing something simple, once i want to do something kinda complicated it gets horrendous
kind of a room to grow kinda situation
i'm using the citizens api and im trying to make an npc that looks to nearby players, but i can't seem to figure out how to get it to work. i have this code:
CitizensAPI.getNPCRegistry().createNPC(
EntityType.WITCH, "&c&lEnchanter", Location(
Bukkit.getWorlds()[0], -200.0, 203.0, 420.0
)
).apply {
addTrait(Enchanter())
addTrait(LookClose())
addTrait(RotationTrait())
data().setPersistent("lookclose", true)
}
the NPC looks fine when i do /npc to get the data, and then whenever i do /npc look and then check /npc again, the traits look the same so i'm not sure what's wrong
Yeah. Don't really need anything very interactive
FIX: ```diff
- addTrait(LookClose())
- addTrait(RotationTrait())
- data().setPersistent("lookclose", true)
- getOrAddTrait(LookClose::class.java).lookClose(true)
Learn some java and how OOP works before diving into plugins
what if the scoreboard is updated like this?
// ran every tick
@Override
public List<String> getLines(Player player) {
database.getProfileByUniqueId(player.getUniqueId()).thenAccept(profile -> {});
// how am i supposed to get data inside the profile
// without stalling the thread?
}
or if i need to get data on login, such as disguises
@EventHandler
public void onLogin(AsyncPlayerPreLoginEvent event) {
// not using CompletableFuture#join
database.getProfileByUniqueId(player.getUniqueId()).thenAccept(profile -> {
PlayerProfile prevProfile = event.getPlayerProfile();
PlayerProfile profile = Bukkit.createProfileExact(event.getUniqueId(), profile.getDisguiseName());
profile.setProperties(prevProfile.getProperties());
// im guessing this doesnt work
event.setPlayerProfile(profile);
});
}
Can you not make getLines return a CompletableFuture as well?
How do you remove a file from github repo? I added gitignore in the original post but the file was still there and even after multiple commits it still gets displayed...
git rm --cached filename
gitignore will just ignore it from IDE or matching paths for git add, it doesnt delete the file
That will remove it from here?
if you then commit and push the changes, yes
π will test that out in a bit.
Worked. Thank you.
I'm using an api + its not my codebase so unfortunately I can't do that
well, your options are:
- block
- cache the result ahead of time and reach into the cache
assuming the scoreboad is being shown to everyone, having a runTaskTimer every tick and a concurrent map should work nicely
i think
emily's #2 option
Hello, does anyone know how I can recreate a plugins gui using deluxemenus for example how would I make my own gui of auction house but it still works the same just the gui change?
I also have oraxen if that helps
does anyone know how i can store a List<ItemStack> either in a yml file or a .json so I can save/use the items in the file?
im using kotlin if that makes any difference
you can serialize the ItemStacks to a String
https://gist.github.com/graywolf336/8153678
ohj alright
if (e.getArmorStandItem().getData().getItemType() != Material.AIR){
why does this pass while the item is air?
like there is nothing on the armor stand
// Armor stand is holding an item
}
Thanks I'll try it
.getdata returns MaterialData which is deprecated, using ItemStack#getType() is what you should be using
so asyncchunk's method should be the one that works
Does anybody know of a good NPC Api that I could use to make a plugin similar to corpses? For 1.20.2
Does anyone know if I can merge oraxen and items adder cause there is some textures I need from items added but I also wanna use oraxen so is there a way to merge both?
Is there a way to add an extension to a plugin internally? One that's already a thing like the "Player" placeholders for example. I want to have that loaded already.
you refering to what? PAPI?
XY problem?
I'm guessing. I don't want to have to run /papi ecloud download player.
I want it to be apart of my plugin already if that makes sense.
So players that use it, dont have to run that command either.
That's if I wanted to create new ones. I don't.
Unless I missed something specific.
During start up or something run the command from your pluginβ¦or download the expansion jar and place it in the Placeholders expansion folder on startup from plugin
Unless there's a better way, best bet might be to use PAPI's ExpansionManagers, check if the extension is installed otherwise ask PAPI to install it
Yeah, this approach would be far better than mineβ¦let papi itself install if the expansion is not present
I'll try that tmr. My current solution was to download it with ecloud, then import it to my plugin resources. From there add it to expansions if it doesn't already exist.
you would then have the issue of the expansion being out of date
yeh sadly
and tbh its not working, i got somethin messed up cuz its adding more data than it should
is there a reason why you want the plaher expansion to be loaded by your plugin?
in your default lang files?
maybe?
where are you using the placeholders?
To allow players to use specific placeholders in config files.
Like player and server.
you only have to hook into placeholderapi, no need to attempt to manually load the expansion
It's automatically apart of it?
no
if youve used papi for any length of tine its pretty much common knowledge that if a placeholder doesnt work either your missing thr plugin that adds it and or the expansion
Yeah. I want to add said expansion on my own terms. If its not possible, then oh well.
so people who are using your plugin should beable to figure it out and you dont have to tell them
tho if they come to your discord or whatever for support and thats the issue just tell them to download the expansion using the papi commands
hopefully it ahouldnt be every singls time
Ig, tbh i'll either try to use this
or just do it the easy way and just do the command
File file = new File(getDataFolder().getParent() + "/PlaceholderAPI/expansions/Expansion-player.jar");
if (!file.exists()){
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi ecloud download player");
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "papi reload");
}
this'll work, thx tho
if you are gunna load it, make sure to add a disclaimer in your plugin so people will know what is doing the commands
so like after you run that, add a message like attempting to load player expansion or smth
yuh
Will using the expansionmanager mean the expansion is properly tracked for versioning by PAPI?
probably?
if it does, i'd say use that mechanism
rather than trying to check if files exist then using commands
you can just use ... = new File("plugins/PlaceholderAPI/expansions/Expansion-player.jar");
why do people always hardcode "/" in paths
what else are you supposed to use?
plugin folder wont change ?
Paths#get with spaces
Paths.get("PlaceholderAPI", "expansions", "Expansion-player.jar")
or something, alternatively the Path#resolve methojds
how is that better?
cus Java will automagically handle file separators afaik
so will do extra work? did i understand correctly?
extra work yeah
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "item/empty",
"layer1": "malikaset:armor/malika_chestplate_icon"
}
}
how do i give myself this item?
uhh id assume thats to create a model data, so like do that
create an itemstack then assign the model data value that bit of json is assigned to
probs in itemmeta or smth
Bruh
In the newest versions you can't get the player in InventoryPickupItemEvent
;/
read the deprecation note
because no player is involved in that event
Called when a hopper or hopper minecart picks up a dropped item.
read the deprecation notice
how
with your eyes
π
oh bruh
its entitypickup event now
Look at this
Oh
This confused me
@minor summit Sorry
Thanks
ate
QUESTION, when making a discord bot that has an sql db, when having a table with auto incrementing ids, is having a unique table per guild to allow the ids to be unique a bad idea
Is there a way in my TabCompleter class for a command to only suggest the player names of online players when the player hits tab? The same way that chat works
For example I dont want this to show up until the player hits tab
If I am understanding you correctly, I would just do one table that is just guilds and then each row being a guild
just have a "id" field in the columns for the guild id
very bad idea imo
this will leave you having to make a brand new table for every additional guild
also making a unique table for each guild is going to do the opposite of allow the ids to be unique - rows in different tables may end up with the same id this way
definitely better to just have a single table with an extra guild column
MySQL can easily handle many millions of rows, but a few thousand tables, i dont know
yeah its definitely not designed to scale the number of tables
fair
composite primary key if you really care
or use a UUID key, or just have an auto incrementing + another column of like guildname_id that is unique globally
okay thank you for input!
no problem
TabComplete or something like that and you apply it to the command.
I know how to make tab complete work, I was asking how I can make it so that the tab complete recommendations donβt show up until the user hits tab
The same way the vanilla chat works, you type in chat and it doesnβt suggest anything, but if you press TAB it starts to suggest player names
you don't
that's pretty much entirely controlled by the client, and the client does not tell the server when they press tab
Damn, alright Iβll just keep it where it recommends player names every line lol
idk what /g yo is but for ex in a /msg command, I think it'd be better to have the player names show up without pressing tab or anything because that's what the command expects
whereas in chat, it's not expecting you to always type a player's name
Β―_(γ)_/Β―
g for greply
The /g is my global chat command, I have normal chat set to proximity based
/g (msg)
Yeah lmao
uh I mean, you can suggest nothing for /g
Yeah I could, but I have a player mention system built into the chat plugin and I think itβs QOL to be able to tab complete a username versus having to type it out
Especially if someoneβs name is something wack such as 1_to0_gre4t or something
I guess you could do, like, if they type two or three characters and they match the beginning of some player names then suggest those, but under that threshold keep it to nothing
Hmm thatβs a good idea actually, I might try that when Iβm home
So i am having a little trouble with nodejs/javascript.
I am trying to create a prisma client and then use it as a test.
This is my prismaClient.js file:
const { PrismaClient } = require("@prisma/client");
const logger = require('utilities/logger');
let prisma = null;
async function initialize() {
prisma = new PrismaClient();
logger.setPrefix('DATABASE').level('INFO').log('Created new Prisma Client!');
}
module.exports = { initialize, prisma };```
This is how i am trying to use it:
```javascript
const { initialize, prisma } = require('lib/prismaClient');
app.listen(process.env.PORT, async () => {
await initialize();
const user = await prisma.user.create({
data: {
email: "testFF@gmail.com",
username: 'Rawr',
password: '123',
first_name: 'Test',
last_name: 'Faar',
pterodactyl_id: 500,
proxmox_id: 100,
messages: []
}
});
console.log(user);
});```
This is the error / startup log: https://paste.helpch.at/aqujobamam.less
(It worked before when i used it like this, all in one file: https://paste.helpch.at/kiyenayaci.php)
Edit:nvm, misread error π₯²
Actually
I'm new to js so I'm assuming some stuff here with knowledge of other languages
But what if you export a getter function
Instead of prisma itself
Oh cmon
I'm 6 hours late
i want to strike fake lightning at an armor stand but it doesnt appear
stand.getWorld().strikeLightningEffect(stand.getLocation());
stand.getWorld().strikeLightningEffect(stand.getLocation());
ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
stand.getWorld().dropItem(stand.getLocation(), item);
stand.remove();
this.cancel();```
im using this
using strikeLightning does work for me but it destroys the item
maybe try this
Location location = stand.getLocation();
World world = location.getWorld();
// Create lightning effects at the armor stand's location
world.strikeLightningEffect(location);
world.strikeLightningEffect(location);
world.strikeLightningEffect(location);
// Drop the item near the armor stand (slightly offset to avoid removal with the stand)
ItemStack item = new ItemStack(Material.DIAMOND_HELMET);
world.dropItem(location.clone().add(0, 0.5, 0), item);
// Remove the armor stand
stand.remove();
this.cancel();
this can wrong but just give it a try
how would this fix the lightning effect not appearing?
huh its just working now with the old code
thanks anyway though
so, i tried to use a getter function now but now its stuck at '.create' instead of '.user',
Here is the updated file:
const { PrismaClient } = require("@prisma/client");
const logger = require('utilities/logger');
let prisma = null;
async function initialize() {
prisma = new PrismaClient();
logger.setPrefix('DATABASE').level('INFO').log('Created new Prisma Client!');
}
async function getPrismaClient() {
return prisma;
}
module.exports = { initialize, getPrismaClient };```
And i tried using it like this:
```javascript
app.listen(process.env.PORT, async () => {
await prisma.initialize();
const user = await (prisma.getPrismaClient).user.create({
data: {
email: "testFF@gmail.com",
username: 'Rawr',
password: '123',
first_name: 'Test',
last_name: 'Faar',
pterodactyl_id: 500,
proxmox_id: 100,
messages: []
}
});
console.log(user);
logger.setPrefix('SYSTEM').level('INFO').log('Server started up in ' + (Date.now() - timeElapsed) + 'ms!');
});```
But when i try the code to create a user in the Prisma file itself it does work, i don't know what to try now
https://uploadir.com/82530/Ytc1VcZagW
Code: https://pastebin.com/vy7UiZJpDoes anyone know how to show the last action? π What i'm doing wrong?
tried also directly with:
cloneInventory.setContents(event.getClickedInventory().getContents()); Main.getLive().getBot().openInventory(cloneInventory);
still not working, same issue
Shouldn't it be getPrismaClient()?
is there a way to get ItemStack drops from a Material?
Itemstacks don't have drops
If you mean block, then you can just set a block to that material, get drops, and just revert it back using BlockState#update(true, false) I think
Or you can look in nms or cb to see how it works internally
But I'm not home so
I tought so to but it gives the same result
Hello people, any idea why failing to connect to a database server takes sooo long? I connect successfully almost instantly, but whenever I input a wrong database server IP, it takes around 2 minutes to tell me that it failed..
Console:
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.```
Plugin code: https://gist.github.com/technyk/cf3681c25c06df535580e9a955e3add3
I followed the tutorial from here https://www.spigotmc.org/wiki/connecting-to-databases-mysql/ and therefor added this to my `pom.xml`:
```xml
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
<version>8.2.0</version>
</dependency>
e.: if there are any other solutions better than this, lmk
this solution unfortunately makes my plugin have 4 MB more than it's original size without the mysql connector
you probably have a very long timeout
there should be a way to shorten it somewhere so it doesnt try to connect to a nonexistent db for too long
I thought the validation was where the timeout is set, but I set the timeout to 1 second..
idk for sure but maybe there is a different timeout for the initial connection
also while you're starting to work with SQL you may as well get used to working with a connection pool
something like HikariCP
I thought that was some advanced thing
it's advanced in that it makes your life easier
I'd like to start out slowly and then move onto the "advanced" stuff
working with it is honestly easier than working with a regular sql connection
that being said no pressure since you're just starting to mess with it all
of course, just tryin to solve this issue first before I move on
there seem to be some timeout setters
dataSource.setInitialTimeout();
dataSource.setConnectTimeout();
dataSource.setLoginTimeout();
yeah try playing around with those
yup, thanks for the help
π
Thanks. BlockState#update(false,false) worked
wait what are you doing
I meant that to revert the block
but if you use false, then it won't change the material back
π€ π€
oh wait
yeah
ohhh
I seeee
yeah your solution is better than what i was thinking of
I didn't know you could get drops from BlockState
let me try this
it works without executing the update method as well
CraftMagicNumbers has a getBlock method with a material parameter.
Also pretty sure updating the state is server side so relogging or other updating events would display that updated state.
its not server side but update there doesn't do anything unless the block is already a SNOW_BLOCK
oh then this is the best solution here imo
@stuck canopy
Β―_(γ)_/Β―
I don't really know much about nms
It's craftbukkit
forgot that was cb
ye but you either have to do reflection or mess with version stuff
and it's a bunch of work/risk for something simple like this
btw I am using papermc. how do I import nms?
Could always make your own π€·
You could use their user plugin or whatever it's called.
https://github.com/PaperMC/paperweight/tree/main paperweight-userdev
then you run reobfJar instead of shadowJar most of the time
... you could always just supply the block then lol
isn't that what he's already doing?
I use maven
oh ok then nvm π₯²
xD
you can still use like the server jar but nms will be obfuscated I'm pretty sure
and you have to manually download sources or smth
He wants the drops though. For example DIAMOND_ORE drops DIAMOND
And if you use the itemstack parameter it can use enchants like silktouch.
thats right
I assume he already tested this - but a better solution wouldn't hurt
It would yeah
yea I did test it
and it seemed to work
Are you sure about modifying the state though? Pretty sure it is server sided.
he doesn't want to actually modify the block itself
I know