#development
1 messages · Page 19 of 1
but in that specific instance above, they were literally just told learn english and learn java
literally nothing else
how to recode built plugin
well, not knowing the two required languages to receive help regarding a specific programming language is quite the barrier
if the plugin is not open source, then you can't just edit the plugin code since it's already been converted to bytecode
cough decompile cough
well you can decompile it, but you will have to most likely change quite a bit of stuff
its a pain in the ass tho
this +
I'm not gonna defend the dude above but you're extrapolating the situation as if it was every single case
^
this the hill you wanna die on?
generally people will give some sort of help
I gave them the actual code xD
imho quite an appropriate response after the exchange, they are nowhere near the level to code it nor to copy it from someone
Spoonfeeding is the better learning experience in my opinion because its up to them whether or not they learn from it.
nah, it works with some people but with majority they just come back with the same concept lacking
🤷 I don't mind
pseudo code is the best way imho, as long as they understand the logic
I still have people coming back to me asking the same questions after years lol
imo, if they are willing to accept that coding is not as simple to learn as 1 + 2 = 3, then it's fine to help them even if they aren't an expert on java
but if they know pretty much nothing about java and just want the code...
literally all of you are wrong
I'm not.
kotlin 
yes because you're literally writing the code for them
voluntary slavery
its up to them whether or not they learn from it.
its not slavery if it's voluntary
it really depends on the level
like, an example can help if you already know java and just need to figure out a good way to work with the spigot api
if you know literally nothing, you're just going to copy paste and have no idea what it's doing or hwo to modify it
i just dont understand the expectancy of being able to jump into it today and make something quite complex
^ such as editing another plugin
in a plugin that i was trying to modify to fix a lag issue before i became a dev, i thought that player.sendmesssage() was causing lag, now that i have some sort of understanding of whats taxing or not i now know it was another function that was causing the lag, its called a shit backpack prison plugin
it was a paid plugin too
The site for hacktoberfest is sick
Best way to check if player interacts with nether portal? (I mean like when it start receiving the nausea effect). Something like detecting when player "touches" a nether portal
checking the block they're standing on I guess?
I imagine you stand on obsidian more than just for portals
d;Material%NETHER_PORTAL
public static final Material NETHER_PORTAL```
BlockData: Orientable
EntityPortalEnterEvent
public class EntityPortalEnterEvent
extends EntityEvent```
EntityPortalEnterEvent has 1 extensions, and 4 methods.
Called when an entity comes into contact with a portal
Someone remember if thats available 1.8.8? Xdd
d;1.8.8 EntityEnterPortalEvent
public class EntityPortalEnterEvent
extends EntityEvent```
EntityPortalEnterEvent has 1 extensions, and 4 methods.
Called when an entity comes into contact with a portal
@shell moon

hi, im trying to remove all bossbars that end with a certain phrase (jugg), how can i do it?
Bukkit#getBossBars() doesnt include ones that were made using Bukkit#createBossBar, so i cant use that
Is it from your plugin or a different one
yes
my plugin
I guess just keep track of them into a map/multimap of some sort, and remove them when you don't need them anymore
oh seems like Bukkit#removeBossBar doesnt work for bossbars created using Bukkit#createBossBar either 
ig ill just have to removeall players from the bossbar, but its annoying cause their temporary so i dont just want them sitting around not used, its alr tho
Maybe try using Kyori/Adventure for your bossbars?
Bossbar#bossbar
im not a huge fan of adventure
its a pretty good api lmao, why not?
😦
yk what, get to fuck.
i love the api but hate that its in paper / velocity by default
makes it a huge pain to do 1 jar setups for velocity + spigot at the same time
If you're lazy, you can't expect to learn a language like java
Or even python if you don't put that much effort
and the spigot api at the same time
Spigot api is still in spigot; you shouldn't be using paper api in a spigot plugin
Unless u mean that velocity uses adventure
I haven't used velocity api before
yes velocity also has adventure
which normally wouldnt be an issue, but velocity api is completely different from bungee
Does anyone have experience with https://github.com/DevNatan/inventory-framework? More specific with PaginatedView
how can i get on which bungeecord proxy subserver the ProxiedPlayer is?
I'm using Player#removeBossBar and it works just fine in my plugin
I think that’s the same as using BossBar#removePlayer(Player) (or whatever it is)
d;spigot BossBar#removePlayer
void removePlayer(@NotNull Player player)```
Removes the player from this boss bar causing it to be removed from their screen.
player - the player to remove
I found that armorstands being duplicated for some reason and I'm trying to find the way to prevent it
I create armorstands on loading the server and after few hours suddenly they being duplicated for no reason
maybe there's something to do with chunks load but i can't figure what exactly
you would need to show code
If you're checking if armoratands no longer exist, that's why
They "don't exist" when chunks unload
So I'm trying to send a login plugin message request packet via protocollib, however, I have a hard time setting the data
Here's the code:
var container = new PacketContainer(PacketType.Login.Server.CUSTOM_PAYLOAD);
container.getIntegers().write(0, 0); // Mesage ID
container.getMinecraftKeys().write(0, channel); // Channel
container.getByteArrays().write(0, new byte[0]); // Data
When I attempt to execute it, it fails when writing the byte array: com.comphenix.protocol.reflect.FieldAccessException: No field with type [B exists in class PacketLoginOutCustomPayload.
When I do some debugging, the field appears to be of the following type: PacketDataSerializer
How am I supposed to write the bytes?
Assuming this is latest version
https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerCustomPayload.java
They use ```java
public void setContentsBuffer(ByteBuf contents) {
if (MinecraftReflection.is(MinecraftReflection.getPacketDataSerializerClass(), contents)) {
handle.getModifier().withType(ByteBuf.class).write(0, contents);
} else {
Object serializer = MinecraftReflection.getPacketDataSerializer(contents);
handle.getModifier().withType(ByteBuf.class).write(0, serializer);
}
}
public void setContents(byte[] content) {
setContentsBuffer(Unpooled.copiedBuffer(content));
}
So basically: ```java
public void setContents(byte[] content) {
ByteBuf contents = Unpooled.copiedBuffer(content);
Object serializer = MinecraftReflection.getPacketDataSerializer(contents);
container.getModifier().withType(ByteBuf.class).write(0, serializer);
}
also for the channel, it appears that it uses MinecraftKeys
gonna try, will need to add netty as a dependency first tho
yes, as you can see I use it
what mc version btw
ohhh I misread
1.18.2
hahah, it was my first mistake (I tried to write it as a string), however I was able to figure out with debugger that it is a MinecraftKey
gradle
In the future, https://github.com/dmulloy2/PacketWrapper is like 99% correct
epic
wait so if you try ```java
import io.netty.buffer.ByteBuf;
yes, however I do not have the packetwrapper thingy included in my dependencies
ye u dont need to
(didn't know it existed till now)
i mean you can look at how it works (basically an example for every packet)
you don't have to include all of it
and for the actual docs, use https://wiki.vg/Protocol
I am using it
👍
Yep
interesting
Oh I see, so the packetwrapper is supposed to replace manual field setting?
yes
I personally just copy parts of it instead of shading it, but it's preference
Is there a maven repo including it?
You can use PacketWrapper as a dependency if you wish, although it is highly recommended that plugin authors simply copy and paste the classes they need into their project. This helps guard against future changes in PacketWrapper and makes it easier on the end user.
You can use jitpack
Understandable, copy pasting will be the better solution ig
didn't know that it wasn't recommended until now lol
just looked in readme for the dependency
@hazy nimbus gradle kts or groovy
or have you got the netty stuff figured out already
groovy
aww alr
still better than maven tho 😌
nope, was just going to do it, do you have the "correct" version?
1 sec lemme see which dependency has the bytebuffer since theres a trillion
will io.netty:netty-buffer:4.1.82.Final do?
yes
and make sure you compileOnly
Downloading...
👍
👍 lmk if it works
Seems to be stuck at downloading maven-metadata.xml
ah nvm
it downloaded (finally)
@dusky harness So, the packet appears to have been sent successfully, however the proxy doesn't register it. Might be an issue in Velocity tho
I use the login plugin message to communicate between proxy <-> backend server
Well it doesn't intercept it
at all
Well the ServerLoginPluginMessageEvent does not fire
I will probably try to put pakkit in-between to verify whether the packet is actually sent
Ok, well that didn't work out due to modern forwarding
https://imgur.com/a/QOAu3iH
I'm using Javascript PlaceholderAPI extension to make a shop in deluxemenus, but it goes to a negative number when i click many times on remove 64 or other, in my javascript file i set when is under 0 set to 1 but it doesn't work, can someone help me pls :))
@dusky harness I think I see where the issue is 
I send the custom payload packet for the play state
not for the login
// Cannot find type for b
// Cannot find type for b
oh no
Ok, so copypasting things from the play packet seems to have worked
does anyone know what parts of world generation (nms) is safe to do on another thread? i was hoping the objects that you can generate manually would be safe to do, but apparently they call other internals in their constructor
what do you mean with "the objects that you can generate manually"? Also, are you referring to a custom world generator?
stuff that you can instantiate yourself without any server stuff
and no, not generator
internal ServerLevel object
aka net.minecraft world
for example, this should technically be safe to instantiate on another thread
then pass it with callback, but apparently not
well creating a ServerLevel instance isn't really part of world generation. Not sure what exactly is the problem in your code snippet, but some things might access whatever internal registry
there is no problem
im just asking if anyone dabbled in this and already know what parts are thread safe
otherwise, i need to check the source on each so trying to cut some work
I still don't understand your use case. Is it like a regular world or is it separate?
i mean use case doesnt matter for the question does it?
i implement custom file saving for instancing purposes
it does, as it matters if e.g. the world will be ticked during generation and stuff like that
nah, i register it manually once i generate it
there are no default mechanisms involved
okay that should work then. Running generation on a different thread should be fine, you probably need to suppress entity generation
and if you want to parallelize it, it gets a bit more tricky
yes i know, turns out they still call internals
so my question was if anyone dabbled in it before and already know which ones need to be called on main
I mean I don't know what you're intending to call, there are a lot of methods
also depends on if you only want to use the default generator or if you want to support any custom generator etc
im trying to make a scalable placeholder (so if i create a new team, such as GREEN, it will auto-add it to the sb), but i cant use new lines, what do i do (or is there an easier way to do it)? im using TAB btw https://media.venox.network/java_QPSW6TTXSW.png
to do that i'd have to make multiple placeholders like %team1%, %team2%, etc..., which isnt scalable/dynamic
unless ur saying something else?
What would be the equivalent type of Java's Map<String, String> in TS?
Variable 'playerInv' might not have been initialized
how to fix
help
Variable 'playerInv' might not have been initialized
help me
can someone help me?
Can some admin help me on a channel issue? PM me
just send over a list with all
why not use multiple lines though
if you want a dynamic scoreboard, then using a prebuilt plugin to do so is probably not the best idea
since i know of no scoreboard plugin that allows for dynamically adding lines
what's different than using multiple score entries? instead of putting \n create a new score entry
you can add more lines to a scoreboard by just doing \n? is that actually a thing?
no, that is exactly what does not work
proposed solution is to use multiple score entries
given that each entry is its own line
effectively a working newline
oh i thought they wanted them side by side
and were asking how to do the placeholder to support it
im trying to get a list of online players but the array is empty even when there are players on
public void execute(CommandSender sender, String[] args) {
Object[] playersOn = {};
ProxyServer.getInstance().getPlayers().toArray(playersOn);
for (Object players:playersOn) {
sender.sendMessage( new TextComponent( "List:" + players.toString()) );
}
}
what proxy is this?
bungeecord, velocity, etc?
bungee
why are you creating an object array when getPlayers() returns List<ProxyedPlayer>?
also the for loop looks kinda pointless aswell since that would just make a new line of every player rather then a list of all players online
ohhh
yeah im aware of that, i just did something quickly to test
Couple things
playersOn is an array of Objects, not ProxiedPlayers
second, playersOn's size is only 0, so toArray returns a new array which you can store in a variable
Also read the Javadocs of toArray if you want to know why it behaves like that
id say do something like sender.sendMessage(new TextComponent("Count: "+ProxyServer.getInstance().getPlayers().size()))
oh yeah you never actually redefine playerOn so it would always be 0 cus you never changed it
updated it, you get the point
cant believe i only just realized that
if (this.lastDeadPlayer != null) {
final Player playerUUID = Bukkit.getPlayer(this.lastDeadPlayer);
if (playerUUID != null) {
Bukkit.broadcastMessage(ChatColor.AQUA + playerUUID.getName() + " was the last man standing!");
Bukkit.getScheduler().scheduleSyncDelayedTask(instance, () -> playerUUID.giveExpLevels(1), 40L); //this is the line not running
}
}
Anyone know why the commented line above would not be running? No errors appear in console
try not setting the player object as final
🤨
How do you know it's not running?
Players level is not increasing by 1 in game but the message above it saying who was the last man standing is running
im using TAB, so it'd probably break
is it a set number of lines
or does it change
if it's a set number just make a placeholder for each line
if not then technically you still can do it with TAB but its messy and wouldn't really work as a public plugin
ive done the exact same thing as you and after 2 seconds, it gives the xp
can 2 spigot plugins & bungeecord use the same custom messaging channel? for some reason only 1 server is receiving the data between the channel, even though the 2 servers are identical
nvm
scalable placeholder (so if i create a new team, such as GREEN, it will auto-add it to the sb)
so no
oh I didn't see that part
so anyone got a solution?
make your own scoreboard impl
scoreboards are simple enough honestly
ig im doing this, but if anyone has a better idea lmk
ok nvm, i use too many of TAB's scoreboard features and i dont rly wanna remake all of em
gonna try asking NEZNAMY (TAB author) if he can make it so \n will parse to an actual new line
Fastboard
im checking the api for tab
cant you just edit the list?
on here
worst case, you can just resend the scoreboard
on line count change
I’ll try this
alr i got it (altho very scuffed and i hate it)
hi
I'm confused on creating configuration sections, I'm trying to store a list, but the following code creates two section titles, so I'm trying to figure out, what is the correct way to define a configuration section?
https://cdn.discordapp.com/attachments/968239967836987414/1025271673169117274/unknown.png
https://cdn.discordapp.com/attachments/968239967836987414/1025271733646807050/unknown.png
usually I just get the config and .set it (to a list/map/whatever), never using createSection
you're making a section, then setting the value TNTLocations to be the location
it isn't making 2 sections
the value of TNTLocations is all that location information
You most likely want to take it apart and store the information you want/need (x/y/z/world)
ah, that makes sense thank you. When you store them like that, how would you go about accessing them then?
minerConf.set("miners", new HashMap<>());
for (Entry<String, AutoMiner> e : autoMiners.entrySet()) {
String s = "miners." + e.getKey() + ".";
AutoMiner a = e.getValue();
Location loc = a.getLoc();
minerConf.set(s + "world", loc.getWorld().getName());
minerConf.set(s + "x", loc.getX());
minerConf.set(s + "y", loc.getY());
minerConf.set(s + "z", loc.getZ());
minerConf.set(s + "yaw", loc.getYaw());
minerConf.set(s + "pitch", loc.getPitch());
minerConf.set(s + "region", a.getRegion());
if (a.getSign() != null) {
s = s + "sign.";
loc = a.getSign();
minerConf.set(s + "world", loc.getWorld().getName());
minerConf.set(s + "x", loc.getX());
minerConf.set(s + "y", loc.getY());
minerConf.set(s + "z", loc.getZ());
minerConf.set(s + "yaw", loc.getYaw());
minerConf.set(s + "pitch", loc.getPitch());
} else {
minerConf.set(s + "sign", new HashMap<>());
}
}
Utils.save(minerConf, "miners.yml");
saving data 
retrieving data
if (minerConf.getConfigurationSection("miners").getKeys(false) != null
|| !minerConf.getConfigurationSection("miners").getKeys(false).isEmpty()) {
for (String s : minerConf.getConfigurationSection("miners").getKeys(false)) {
ConfigurationSection t = minerConf.getConfigurationSection("miners." + s);
Location loc = new Location(Bukkit.getWorld(t.getString("world")), t.getDouble("x"), t.getDouble("y"),
t.getDouble("z"), (float) t.getDouble("yaw"), (float) t.getDouble("pitch"));
String reg = t.getString("region");
AutoMiner a = null;
if (!t.getConfigurationSection("sign").getKeys(false).isEmpty()) {
t = t.getConfigurationSection("sign");
Location sign = new Location(Bukkit.getWorld(t.getString("world")), t.getDouble("x"),
t.getDouble("y"), t.getDouble("z"), (float) t.getDouble("yaw"),
(float) t.getDouble("pitch"));
a = new AutoMiner(s, reg, loc, sign);
} else {
a = new AutoMiner(s, reg, loc);
}
miners.put(s, a);
}
}
it's a mess
ngl
older code, but it does the job
try {
String sql = "INSERT INTO Profiles(world, name, type, members, ex_members, ignored_players, island_size, minion_slots, guests_limit, coop_slots, coins_allowance, ender_chest_pages, accessory_bag, sack_of_sacks, magic_find, bazaar_flipper) VALUES ('?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?');";
PreparedStatement stmt = connection.prepareStatement(sql);
stmt.setString(1, profile.getWorld()); // Set the first "?" to "Something"
stmt.setString(2, profile.getName());
stmt.setString(3, profile.getType().toString());
stmt.setString(4, profile.getMembers().toString());
stmt.setString(5, profile.getEx_members().toString());
stmt.setString(6, profile.getIgnored_players().toString());
stmt.setInt(7, profile.getIsland_size());
stmt.setInt(8, profile.getMinion_slots());
stmt.setInt(9, profile.getGuests_limit());
stmt.setInt(10, profile.getCoop_slots());
stmt.setInt(11, profile.getCoins_allowance());
stmt.setInt(12, profile.getEnder_chest_pages());
stmt.setInt(13, profile.getAccessory_bag());
stmt.setInt(14, profile.getSack_of_sacks());
stmt.setInt(15, profile.getMagic_find());
stmt.setInt(16, profile.getBazaar_flipper());
stmt.executeUpdate();
}catch (SQLException e) {
e.printStackTrace();
}
}```
what am I doing wrong here
remove the ' ' from around the ?s
thats hypixel skyblock isnt it haha
yea but whats funny
looks like its the island profile
it is
AHHHHH
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
Hello, I went into a problem while making Npc's and I can't seem to fix it.
The following link is the console error: https://paste.helpch.at/uqowowafup.css
This link is the code: https://paste.helpch.at/alofugusut.java
yo it seems as if the autosellevent doesnt trigger when using 1.18..... idk if im tripping or something lol. added debug messages and everything but doesnt seems to work...tried same method on a 1.16.5 server and it works so idk
yeah. by autosell
Spigot Account Linking
To get support for a premium plugin owned by Clip or Glare you will need to verify your spigot account using /spigot in the #bot-commands channel. After you have successfully linked your spigot account you should ask your question in the coresponding channel for that plugin. If you have already linked your account and want to update your roles, run this command /spigot check.
@stray kernel 
Hey,
Is it possible to access a file in the plugins "internal" resources folder?
I just want to have a second config to declare some stuff, but without creating it in the plugin's folder
im not the one that bought it tho im working for a server
@broken elbow so i cant get support if i didnt buy it?
They'll have to link and then confirm that you work for them
Not the owner of the server?
If you're not the owner of the server and you're the one requesting the support you'll need to first get the owner who purchased the plugin to join and run through the verification system listed in #spigot-linking, once linked they just need to give us the thumbs up that you're with them.
you can read more here 
o ffs they sleeping 😭 ... alright guess ill wait
Does anyone already have an answer on this?
i think you are maybe forgetting to reObf your code?
the class thats missing def exists, but chances are you didnt obf it back
Do you mean this one? <remappedClassifierName>remapped-obf</remappedClassifierName>
Hi, how can i add a number to an item (maybe a nbt tag) ? After that a want to read it and edit it...
ah, i am not familiar with the maven reobf method
been a while since i touched maven alltogether
honestly
So the problem is to reobf the project, right?
im willing to bet thats what it is
Alright thank you, then I'm going to dive into it
Hi, how can i add a number to an item (maybe a nbt tag) ? After that a want to read it and edit it...
you san store an integer on the item meta's persistent data container
How can i do that
ItemMeta meta = item.getItemMeta();
meta.getPersistentDataContainer().set(new NamespacedKey(pluginInstance, "number"), PersistentDataType.INTEGER, intValue);
item.setItemMeta(meta);```
on the PDC you can then use the .get(namespacedKey, dataType) method
when setting data, make sure to set the item meta back on the item stack
hopefully that explains it
Ok thanks I'll try it
How can i get the number when i want to edit it?
Here's a nice guide on PDH. https://www.spigotmc.org/threads/a-guide-to-1-14-persistentdataholder-api.371200/
Thanks
With what program can I encrypt a plugin, I have its source code
you mean build? Turn the code into a .jar file
I have the source code, but I want to add some things and fix its duration system
are you trying to turn the source code into a plugin?
So I'm fine, but when I select the plugin folder and then convert it to .jar it doesn't convert as it should
what do you mean "convert"
you gotta compile it
open class ConcurrentSingleLazyMap<K : Any, V: Any>(
private val lazy : suspend (K) -> V?,
private val valueCache: ConcurrentHashMap<K, V> = ConcurrentHashMap()
) : Map<K,V> by valueCache {
fun invalidate(key: K) = valueCache.remove(key)
suspend fun getOrFetch(key: K): V? = valueCache[key].let { lazy.invoke(key)?.let { valueCache[key] = it; valueCache[key]} }
}
is there a better way to make a lazy map with one generating function?
holy damn it doesnt even fit one line formatted a bit
you gotta use either maven or gradle to compile. intellij afaik can use either by default
well. you don't have to
id say compile using whatever compiler the plugin source uses as its usually easier then switching
buttt
its probably better to start people on that then exporting and having the plugin be plugin jar + plugin code size
that was not fun
Thank you ❤️

I'm following a CodedRed tutorial to figure out how to do TAB stuff (https://youtu.be/WYXVypbVVOs?t=472) but when I try and put in PacketPlayOutPlayerListHeaderFooter it just goes red without saying anything
I'm trying to do
PacketPlayOutPlayerListHeaderFooter = new PacketPlayOutPlayerListHeaderFooter();
I mean sorry yea I'm trying to do ```js
PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
doesn't auto-import? says it doesn't exist?
Yea
how do you have your sources setup
I think codedred uses direct jar files no maven/gradle/anything
Might be happening because I think that's NMS, spigot-api doesn't include nms
ya i just have no idea how to import from spigot not spigot-api
otherwise I could help ye with that
Anyone know why my plugins are not working
I do have a plugin folder with all plugins inside
Did it generate the plugins folder itself?
No
delete everything, and start the server with just the server jar itself
So it generates everything needed
because you dont use platform supporting plugins
vanilla doesnt support plugins, Bukkit and its forks do (Spigot, Paper, Purpur (use Paper/Purpur))
Vanilla one
by Mojang
Vanilla doesnt support any external modification except datapacks
use Paper/Purpur, just google it
if you r new to this you can just use paper, you wouldnt benefit from purpur ig
i am guessing its here, kinda hard to debug due to coroutines
java.lang.IllegalArgumentException: Callable expects 2 arguments, but 1 were provided.
at kotlin.reflect.jvm.internal.calls.Caller$DefaultImpls.checkArguments(Caller.kt:20) ~[orbital-demo-1.0.0.jar:?]
at kotlin.reflect.jvm.internal.calls.CallerImpl.checkArguments(CallerImpl.kt:15) ~[orbital-demo-1.0.0.jar:?]
at kotlin.reflect.jvm.internal.calls.CallerImpl$Method$Instance.call(CallerImpl.kt:112) ~[orbital-demo-1.0.0.jar:?]
at kotlin.reflect.jvm.internal.KCallableImpl.call(KCallableImpl.kt:108) ~[orbital-demo-1.0.0.jar:?]
at dev.peopo.orbitaldemo.sql.SQLKt$fetchBalance$$inlined$fetch$1.invokeSuspend(Table.kt:114) ~[orbital-demo-1.0.0.jar:?]
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) ~[orbital-demo-1.0.0.jar:?]
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) ~[orbital-demo-1.0.0.jar:?]
is it some weird interaction with function overloading and inline functions?
turns out its just me missing to add a variable to a reflection part
apparently property setters on kotlin reflect take varargs, instead of instance - value pair so it compiles fine with 1 value 
to beable to use packets like this, you need to change the spigot dependency in your pom.xml from spigot-api to spigot
you also need to run buildtools and create a jar of the version your wanting to make for
so for example, if you wanna use 1.19.2, then in buildtools you would generate a spigot jar of that version
the reason you have to do this is that when making the jar with buildtools, it creates some files in the .m2 folder on your pc, which intellij can use to compile your plugin from
you dont need the output jar thats made in your buildtools folder
basically,
download buildtools from https://hub.spigotmc.org/jenkins/job/BuildTools/
create a folder for buildtools,
create a bat file that contains java -jar BuildTools.jar --rev yourversionhere (change yourversionhere to a version like 1.19.2)
run that bat file and itll generate a spigot jar file,
then in your project, open pom.xml, scrolldown and in your dependencies change artifactId from spigot-api to spigot
then you should beable to use craftbukkit and nms classes.
You need to add --remapped if you want the unobfuscated class/method names
Is there a method to check the playerinventory size without the slots for equipment? (I know I can just use int size = 36;) Just curious.
storageContents does not include offhand and armour slots
so uh I guess you could fetch the size from that
yep, player.getinventory.getStorageContents().length
actually, might be length
Ah ok thanks. Was just curious.
how do I convert a direction -> (normalized) Vector?
to be used in World#rayTraceBlocks
or basically my main goal is that I have 2 points, let's say point A and point B
point A spots point B and modifies its direction by a couple degrees and then runs rayTraceBlocks to see if it hit point B
"direction" being?
so point A looks at point B - that direction
bVector.subtract(aVector)
but then I also have to modify it a little bit
so that it doesn't always look directly at point B
using a configurable degree amount
.add(rng.nextDouble())
💀 yea I wonder why vectors and locations are mutable
those should be immutable, I think
wait a minute
i would normalise after performing all the operations that reorient the vector tho
val a = Vector(5, 5, 5)
val b = Vector(10, 5, 5)
val subtracted = b.subtract(a)
val added = subtracted.add(Vector(90, 90, 90)) // only add(Vector) exists
println(added.normalize())
```you mean like this?
since that prints out ~0.6, ~0.56, ~0.56
the subtraction results in the vector from a to b
I believe bukkit Vector has specific methods to apply rotation on x/y/z axis, i'm not sure
also 90 is a lot lol
oh
oh yea
I just did 90 to test
so there's ```kt
val a = Vector(5, 5, 5)
val b = Vector(10, 5, 5)
val subtracted = b.subtract(a)
val added = subtracted.rotateAroundY(90.0)
println(added.normalize())
you sure it's in degrees?
neat
Thanks emily
public LaserTeam getWinner() {
LaserTeam winner = null;
for (final String teamId : ControlManager.teams) {
final LaserTeam team = getTeam(teamId);
if (winner == null || team.score > winner.score) winner = team;
}
return winner;
}```im sleep deprived and i need to check if all teams have the same score and if they do then return `null` (tie), and if they dont, calculate highest scoring team (and return it)
*ping me if u reply, im going to bed 💤*
it dont :(
cause when it loops thru the first team it sets winner to that team, so the method wont return null
the only possibility of the method ever returning null is if ControlManager.teams is empty
ohh I didn't see the tie part
😭
if all teams? or if at least 2 teams have the same score then return null?
all
so if you have 3 teams with the scores of 10, 10, 4, do you return null or...
the first thing that came to my head was the saying "throw a hashmap at it." the more i think about it, the more i feel like that would simplify things. just an idea
i hadnt thought of that 😭, null probably
ok i'm back
lets see
public LaserTeam getWinner() {
LaserTeam winner = null;
int highestInvalid = Integer.MIN_VALUE;
for (final String teamId : ControlManager.teams) {
final LaserTeam team = getTeam(teamId);
if (winner == null || team.score > winner.score) {
winner = team;
continue;
}
if (team.score == winner.score) {
highestInvalid = team.score;
}
}
return highestInvalid == winner.score ? null : winner;
}
```this should work
hear me out, put all of the data into a TreeMap<Integer, List<LaserTeam>> and then you can check the highest scoring team(s) and see if the size of the list is bigger than 1. if it is, then you return null, if there is only one team in the list of teams with the highest score, then you know that there is no team that scored higher than that. if the highest scoring team list has more than one team, then you know that multiple teams tied.
actually, my solution is over complicating it
ignore me
ty i will try this tomorrow 🙏
why i get this error on AsyncPlayerChatEvent?
format: '%vault_rank% &8| &7{player}: &f{message}'```
this is the format i set
Your %vault_rank% is not being replaced with your actual rank
@EventHandler
public void onAsyncPlayerChat(AsyncPlayerChatEvent event) {
String format = plugin.getSettings().getString("default.format")
.replace("{player}", "%s")
.replace("{message}", "%s");
format = PlaceholderAPI.setPlaceholders(event.getPlayer(), format);
event.setFormat(translate(format));
}```
this is the code
oh
and what i need to do?
make sure it is replaced. Or don't use percent signs in your format at all.
did you register your extension?
I didn't make my extension, I just wanted the placeholders to work in my plugin and work, but when it is on the server, the placeholders work only in it
what is that supposed to mean even
wait
you have placeholders and they dont work when used by other plugins?
is what i understood
sure
wait
@merry knoll
https://youtu.be/qm1bssDMi6I
now you can watch
placeholderapi works in my plugin, but not in others when it is mine
you need the expansions downloaded
each placeholder comes from an expansion
find which ones you need
and download them
see that I have a viaversion extension and they work on /online and not on tab anymore
thats for your tab plugin to fix
you can test it using
/papi parse
if they show up there then its set up properly
on another plugin on the scoreboard I have the same, but when my plugin is not, everything works normally
how to use it?
/papi parse <player|me> <string>
commands are listed here
I can see it already, but it still doesn't work on the tab and the above-mentioned one does
would you like to test it yourself? I'll give you these two plugins and you can see for yourself what happens
on another plugin this is also the case
my plugin breaks something
wait
ItemStack gracz = new ItemStack(Material.PLAYER_HEAD);
SkullMeta gr = (SkullMeta) gracz.getItemMeta();
gr.setOwner(all.getPlayer().getName());
gr.setDisplayName(PlaceholderAPI.setPlaceholders(all, plugin.getConfig().getString("head-name-prefix") + all.getDisplayName() + plugin.getConfig().getString("head-name-sufix")));
ArrayList<String> lore = new ArrayList<>();
for (String msg : plugin.getConfig().getStringList("description")) {
lore.add(PlaceholderAPI.setPlaceholders(all, msg.replace("<tp>", plugin.getConfig().getString("tp"))));
}
gr.setLore(lore);
gracz.setItemMeta(gr);
description:
- "§bPing:§6 %player_ping%"
- "§bGame time: §a%statistic_minutes_played%"
- "§bGamemode: §a%player_gamemode%"
- "§bMinecraft version: §a%viaversion_player_protocol_version%"
- "§bRegion owner: §6%worldguard_region_owner%"
- "%discordsrv_user_name%"
- ""
- ""
- ""
- "§b*Right click to get Player head"
- "§b*Click to teleport*"
- "<tp>"
for example
and here it works but in other plugins when mine is on the server it does not work, when I remove my plugin everything works normally
what is "all" here?
for (Player all : Bukkit.getOnlinePlayers()) {
int ping = all.getPing();
for (Integer it : plugin.getConfig().getIntegerList("GRAY_STAINED_GLASS_PANE")) {
ItemStack empty = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
ItemMeta s = empty.getItemMeta();
s.setDisplayName(ChatColor.BLACK + " ");
empty.setItemMeta(s);
inv.setItem(it, empty);
}
ItemStack gracz = new ItemStack(Material.PLAYER_HEAD);
SkullMeta gr = (SkullMeta) gracz.getItemMeta();
gr.setOwner(all.getPlayer().getName());
gr.setDisplayName(PlaceholderAPI.setPlaceholders(all, plugin.getConfig().getString("head-name-prefix") + all.getDisplayName() + plugin.getConfig().getString("head-name-sufix")));
ArrayList<String> lore = new ArrayList<>();
for (String msg : plugin.getConfig().getStringList("description")) {
lore.add(PlaceholderAPI.setPlaceholders(all, msg.replace("<tp>", plugin.getConfig().getString("tp"))));
}
gr.setLore(lore);
gracz.setItemMeta(gr);
another code
another code
but this code working
my plugin works, but if it is different, it doesn't display placeholders
if the server has my plugin, the placeholders only work in my plugin in none of the others,
how to fix it?
anyone knows why is this happening?
That would be a question for #placeholder-api
(did not mean to ping, apologies) 🤦♂️
@pulsar ferry he's coding it
Okay I think I am slowly loosing my mind, but: is there a way to make an npc with skin, thst is able to walk to certain locations. Like actual walking not just teleportint
(without lib disguise, just protocol lib and nms)
you have to send move packets
teleport and move packets are different
@marble nimbus
So the position packet is an equivalent to the walk packet?
effectively
Will that also actually display the animation?
you need to send it every tick
yes
Only if the npc is supposed to move correct?
yes
its for updating position
thats the exact packet the server sends
when a player moves
How big does the change in xyz have to be? Is it enough to call it every tick with 1+ block?
can i get help with the bluetooth audio that drops in terms of quality when i open discord?
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
👍
the NMS EntityPlayer does not have a Pathfinder / Navigation right?
EntityPlayer is only used for players, so no pathfinding or anything like that
maybe EntityHuman might
atleast ithink its entityhuman
but then again probably not
ive heard you need to send movement packets and stuff to the humanentity to get it to move
either to or from the entity
one or the other
GSON question:
I have some stuff stored as json and I'm using GSON to deserialize using the GSON#fromJson(String, Class). I have added a new property to the object this json gets deserialized into and I want to be able to still deserialize the json without having to write my own deserializer.
The new property is a simple boolean and has a default value. Should I be able to just set the default value in the class and Gson will just know that? I don't have the enviroment to test this.
Thanks.
How to show player name in Deluxe menu gui
%player_name% Placeholder, next time, go into #general-plugins
hey, i am trying to learn how to code plugins in java right now, and i have encountered this warning, 'org.bukkit.event.player.PlayerPickupItemEvent' is deprecatedi am really new at this so any help will be appreciated!
here is my code: ``` @EventHandler
public void OnItemPickup(PlayerPickupItemEvent event) {
Player player = event.getPlayer();
ItemStack type = event.getItem().getItemStack();
player.sendMessage("Hey you have pick up a " + type);
}```if you need the full code ask me
Means the event is marked for removal/replacement, if you Ctrl + Click on it, it usually has a comment attached to let you know what it's being replaced with
i cant send an image but it just sent me to PlayerPickupItemEvent.java and highlighted the PlayerPickupItemEvent Class
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.
What version you using?
Also, it does not work in-game. could you tell me whats wrong with it?
Did you register the listener?
i think so... like this ? Bukkit.getPluginManager().registerEvents(new HelloWorld(), this);
i have this method in the same class and it works fine: @EventHandler public void onBlockDestroy(BlockBreakEvent event) { Material type = event.getBlock().getType(); Player player = event.getPlayer(); player.sendMessage("Hey you have breaked a " + type); } but the PlayerPickupItemEvent isn't
Which version are you on
of intellij? latest i think i downloaded it the day before yesterday
spigot/paper
Ah okay yea so the event is deprecated, and it was replaced with EntityPickupItemEvent
what can i do about it?
Switch over to the new event
first I didn't knew about the PlayerPickupEvent so i used the entity one and i checked if the entity type is an instanceof Player
but i couldn't get the player
ill try it again and see what happend
If you checked the entity type, then that's why it didn't work, just check if the entity is an instanceof player
Since a player is an entity
oh ill try tysm!
ok, i fixed it (i think, i haven't tested it yet) but if i can ask you something, could you tell me what the (Player) means in this line: Player player = (Player) event.getEntity();?
it's a cast
what does that mean?
The entity variable is "casted" to a player
it basically turns the entity into a player
it changes the static type of an expression, in that case event.getEntity() has the static type Entity, but with the cast, it becomes the static type Player
oh alright, will i get an error when i cast a cow for example to a player
that only works if the dynamic type of the returned value actually is Player (or a subtype)
do you guys have tutorials that I should watch?
how did you learn? just trial and error?
yes
i just came up with ideas on plugins and try shit until it works
but the key to doing that is also paying attention to how experienced developers work
Anyone still using ConfigMe? How the hell do I create a list property that holds integers? Seems like they only support string collections.
Nevermind. I was supposed to use the PropertyBuilder to create my own property. PropertyBuilder.ListPropertyBuilder(PrimitivePropertyType.LONG).build()
Is it possible to get the outer class object from a non-static inner class without passing it in as a parameter?
how to make gems like mmoitem?
nvm, found it :>
help
What do you mean "How to make gems like mmoitem"? What do you need help with, we won't give you a big chunk of code that just works
gems socket
like this
That gem dragged into the item will increase the feature for that item
Do you even have a system with items and stats to increase?
yeah
Then whenever an item is applied to the item, save it in a list or smth and when you get the stats check if the item is in the list
Once the gem is pulled in, it will count the levels one by one, from 1 to 50 (50 is the maximum)
Yeah?
Sure
and have a command
ex: /gems give <Player> <type>
but I don't know how to code like this, can you give me a sample code?
@queen plank if you can help me, dms with me
Don't know how to code what? Commands? File Saving?
So InventoryClickEvent.setCursor(ItemStack) is deprecated but the javadocs don't mention a replacement.
When I cancel InventoryClickEvent the item the cursor is holding is removed. Any counters to this?
Probably get it's initial position and set it back?
tbh the inventory stuff is kinda wack
The item the cursor is holding not its position
Yea I mean the items previous position
...
See how I'm holding water in the cursor? When I click and cancel the InventoryClickEvent it changes the cursor item to the item I clicked.
And what is the behavior you're looking for?
(Slightly confused as to what you're trying to do)
It doesn't change the item the cursor is holding because the event was cancelled lol
Great now WindowsKey + Shift + S isn't screenshotting xD
Fuck it. Just imagine the above image the water bucket turns to stone
Still confused as to what the issue is here
And what's the goal you wish to achieve? For the water to stay or
Yes, if the InventoryClickEvent is canceled why is the cursor changing its item?
And InventoryClickEvent.setCursor(ItemStack) is deprecated so looking for another similar method.
That's been deprecated for a long time, still works tho
I believe it's not actually deprecated, but marked as deprecated as a warning
thats like almost all spigot methods
Its annoying coding with latest methods/api's and java version and having to use a method thats deprecated for no reason lol
Deprecated.
This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.
Yea it's just a warning
Yeah. And its still a bug on spigots part anyways to change the cursor when the event was cancelled.
yeah doing that.
Probably looks horrendous tho right?
Well its 2 extra lines of code lol
@SuppressWarnings("deprecation") and event.setCursor(cursor);
Not what I meant :3, I mean it probably changes to stone, then changes back to water right?
Or does it not do that
Doesn't even do that. Might have to delay which means more useless code xD
you can tag the fields you want serialized with @Expose
not sure if someone answered on phone atm
Huh even when delayed by 0-3 ticks its not setting the cursor
Yeah its seeming like you can't change the item in the cursor.... (Atleast in InventoryClickEvent)
are you cancelling inventory drag event?
InventoryClickEvent
yes but you need to cancel both
For a single click?
yes
I'll test that one sec
yeah even thats not giving me an output...
Looks like it only runs in survival
Oh look at that! InventoryClickEvent being cancelled works properly in survival but not creative
creative mode makes a lot of client sided assumptions about inventory interactions that simply do not query the server
Yeah attempting to make use of InventoryCreativeEvent
Seeing if that will give me the outcome I want
I think with what you're doing you just need to listen to InventoryClickEvent and make sure the action is SWAP_WITH_CURSOR
Many things in creative mode simply do not send packets to the server
It's a road full of potholes
yea def when testing anything inventory related it's best to be in survival lol
creative is super wonky
Its not that.
What emily said above.
oh its creative?
i just read the later parts of the convo
Me too 
moral of the story don't test in creative 🙏
Aside from the fact that no one in survival would be using the methods I'm making... it would be annoying to have to continuously switch back to creative after testing what I am making.
I'm unsure why it's still so buggy it's been like this forever afaik at least I remember it also being a problem back in 1.8
Well... Looks like InventoryCreativeEvent has issues too...```java
@EventHandler(ignoreCancelled = true)
public void onCreativeInventoryClick(InventoryCreativeEvent event) {
Inventory inv = event.getInventory();
Integer slot = event.getSlot();
if(inv == null)
return;
ItemStack item = inv.getItem(slot);
Output.debug("Item == null: "+Boolean.valueOf(item == null));
}
```Outputs Item == null: true Whether I click on a slot with an item or not.
yeah because it's not an inventory known by the server
Player's hotbar*
the creative inventory is pain
the only thing thats sent when in creative is SET_SLOT
Hello
How do I do 2 completely different plugins in 1 intellij project?
I don't want to create for each plugin a new project
im coding my own minecraft server and i want everything in 1 project so I can change them faster
you should create different projects unless you have a specific reason I guess
create different projects and add them as modules
i want to have them all sorted in 1 project so I can edit them faster
how?
learn gradle and add through there
its quite simple just check its documentation
as an added bonus they get to share build settings
if you want that is
alr thanks
huh?
i feel like i keep naming them bogus names like "handler" etc
ew
yeah i would say that
takes permission, does the function on deny
also instead of null
yeah makes sense
you can default to {}
nah its intentional
its setting a parameter that can be null on java
that part aint my code so
but ty, dunno why it never came up on my mind
yw
This it item
Drop to armor or weapon
And give stats
@queen plank
Hmm why can't I set a launched arrows shooter to the player on entityshootbowevent?
I did Arrow arrow = player.launchProjectile(Arrow.class, player.getLocation().getDirection();
then arrow.setShooter(event.getProjectile().getShooter();
but in my EntityDamageByEntityEvent (Which I checked damagaer instanceof Projectile & cast projectile to Arrow then Player from arrow.getShooter)
It doesnt seem to account for projectile launched
anyone know why?
nvm changed noDamageTicks and it works
Hello,
how can I turn BungeeCord (ProxiedPlayer) into variable
So i basically want to target only and only "Test" player?
This is what i tried
ProxiedPlayer player = ProxyServer.getInstance().getPlayer("Test");
This gives me errors:
java.lang.NullPointerException: Cannot invoke "net.md_5.bungee.api.connection.ProxiedPlayer.getServer()" because "player" is null
I know this is not the proper way to do this
But i never used to make BC plugins and i only need this for debugging (to get specifically 1 player name like "Test")
if the player is not there then it will give you a null pointer
not sure what you are trying to do
ok sorry
this works, i joined with my premium account usernaqme (TheJoshua) and not the Test one
it actually works, i was unsure if my code works because it usually works 5th time when i try out things i didn't code before... sorry and thank you very much @merry knoll !
just do a null check after getting the player
if its null, means they are not connected
hey, does someone knows what is wrong with this? Objective obj = board.registerNewObjective("Scoreboard", "dummy", "Test"); it says that registerNewObjective is deprecated and its marked with a line. im really new to coding in java so any help will be appreciated!
here is the full code: public void createBoard( Player player) { ScoreboardManager manager = Bukkit.getScoreboardManager(); Scoreboard board = manager.getNewScoreboard(); Objective obj = board.registerNewObjective("Scoreboard", "dummy", "Test"); Score score = obj.getScore("Player:" + player.getDisplayName()); }
yes yes, that doesn't really mater to me i just wanted to try next:
- send 2 different title messages (from bungeecord proxy) to 2 different players each on different subservers
i came up with for loop at first but it seems like some strings (especially the string i called currentServer that will for each ProxyServer.getInstance().getPlayers() get player.getServer().getInfo().getName()) do not cache properly
deprecated means that its marked as old and possibly for removal in the future
so i am thinking of moving to something like java Maps
so i can still use it?
like to get all players on whole proxy
player Aplayer Bplayer C
then to get their subservers respectivelyplayer A's subserverplayer B's subserverplayer C's subserver
and then put all this in Map (the problem here is that i need to learn again how to use maps ok)
for your current version yes, but it usually means that there is a more modern version of the method you are using
does anyone have better idea for this?
sometimes not the case for spigot but in general, you want to avoid deprecated stuff
and use their alternatives
do you know what should i do then?
you will have to check the javadocs and see whats the replacement
or if there is a replacement

why do you want to cache regardless
do you know if there is a replacement for getDisplayName or should i check?
no idea, it depends on what .getDisplayName gets called from
but just check the javadocs, it should tell you whats the alternative
if there is no alternative(usually the case in spigot)
then just keep using it

alright
Well, i can't think an idea of doing this
*I will write down my exact goal:
- every 5 seconds execute
/command Text Text Text <CustomSubsrverName>where title will be sent replacing<CustomSubsrverName>with subserver the player is currently connected to but if it's found in the config it will replace it with custom one so let's say i am onlobbyit will replace it with config one (for example&6&lLobby&r)
Now i figured out that this works but it will always use the subserver name of first player that is listed online (Using alphabet so if there are 2 players with usernames A and W, it will always replace <CustomSubsrverName> to subserver name from player whose username starts with A)
I hope you understand
if not let me know i will try shortening it
Now i figured out that this works but it will always use the subserver name of first player that is listed online (Using alphabet so if there are 2 players with usernames A and W, it will always replace <CustomSubsrverName> to subserver name from player whose username starts with A)
this is the only part that i am struggling with, everything else is already solved
So I don't know why it uses always the same subserver name for every player (or the first player's subserver ALWAYS) even though 2 players are on 2 differently named subservers
and i do use for loop
can you share your code instead
yes
probably easier to understand there
?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
here
ok i hope you don't mind my spacing because it's really a mess because i have A LOT commented code but i will delete it and not include it into paste
(part of) config
alert-prefix-chat: '&6&lAlert &7'
server-names:
wlobby: "Hello!"
exclude-servers:
- "wselector"
alert-prefix-chat actually doesn't matter that is different part of code but i included it because i used it in code to not use it in specific (this code snippet i sent above) situations
Now i figured out that this works but it will always use the subserver name of first player that is listed online (Using alphabet so if there are 2 players with usernames A and W, it will always replace <CustomSubserverName> to subserver name from player whose username starts with A)
just a reminder i will sent this again.
<CustomSubserverName> = i used <server> in the code above sorry
okay so, from what i am gathering you want to exclude some servers and use a placeholder coming from your config
there are some small convention issues btw in the code
stuff like message_subtitle etc are wrongly named
oh right
messageSubtitle is the correct naming
however
thanks! however, this is not really a problem neither i have issues with this
so the problem is that i have 2 accounts on 2 different servers
i use for loop as you see
ok i forgot to add stuff
this is my server config
there is no issues with the way you are handling it
server-names:
_default_: "this currently isn't coded inside of plugin"
selector: "&b&oDirect product previews"
wlobby: "&6&lWICKED&r&f✕&r&6&o(Proxy)Lobby&r"
wlobby16: "&3&lWICKED&r&f✕&r&3&oLobby&r"
player A is on wlobby
player B is on wlobby16
when we execute the command, it does send title, everything is ok until you realize that both player has same <server> placeholder
it ALWAYS uses player A's subserver name replacement
i figured out why
becuase A goes before B in alphabet
i tested this with multiple accounts
it's always like that and i can't figure out why
so when both players are connected to wlobby16 it will send server-names.wlobby16 instead of <server>
but then i send player B to wlobby, and wait for auto-command to execute from bungee and send this title again -> guess what? both players get title where <server> is replaced AGAIN with server-names.wlobby16
then i push player A also to wlobby and then it sends correct <server> (the wlobby's one)
it's so weird
so i do not reload plugins or anything
it just fixes itself but it always looks for first player in the list alphabet-wise (or however to say it ok)
i will fix this thanks
ah, got your issue
hm?
should i move that into for loop?
you want to do this instead
moved your excludeServers to the top as well
no point calling that each loop
honestly you probably want to colorize etc
outside as well
here
forgot to rename message_title and subtitle inside TextComponents
but you should get the idea
there is also no point creating multiple title instances i think, javadocs say you can send both title and subtitle
from 1 builder
im finding that hard to believe, check your config maybe?
or print out what currentServer is
the armorstand is named, what would be the way to increase the nametag's height? this is a nms armorstand
so IT LITERALLY SAYS in debug messages that matchedServerDisplay is INDEED correct to the current server
only the title is problematic
i don't understand sh1t
ok
literally the messageSubtitle is faulty
mount multiple on top of each other maybe?
i looks like thats what decentholograms does atleast
i mean it makes sense
tho they remove the headstalk and im not sure how thats done
@merry knoll so basically what happens is that there are Test, Test2 and W1CK3_D usernames online.
the messageSubtitle will ALWAYS use the server name from Test because he is the first in the list (alphabetically)
Although i really don't understand why matchedServerDisplay is indeed changed like it's shown in chat debug messages but in the messageSubtitle it doesn't change
had a quick look at what hypixel does and from a bit of testing they just teleport the armorstand above the head of the mob every tick
i kinda doubt, that causes the nametag to lag behind
its most likely mounted on the player
and multiple lines are made by mounting on top of the armor stand mounted on the player
etc
well from testing, moving the mob with sneaking the nametag does lag behind
oh then yeah
also
you dont really need the nametag entity in that case though
you can just send the packet for it to all nearby
kinda hard to see but it is above the head of the mob.
also i was going to change to packet armorstand instead of using actual armorstand
its quite simple if you use the remappings
hmm, i think you can name the mob as well no?
and force its name to be constantly visible through the tag?
you can do it with item entities afaik
so should work the same im assuming
that would cause issues if i wanted to jeb_ or dinnerbone the mob
thats true
altho maybe just add fake coloring to break that possibly?
not sure if it would work but something like
d&innerbone should fix?
as in the reset char
i cant remember what it was
the main issue you will run into will be intercepting all "spawn" packets
for the player if you go with this route
since the teleport and spawn packets are different
you will have to couple your own with the one thats being sent for the mob
basically, im going to have fun
yeah.. i was fiddling with a hologram api of my own
and doing it properly is a huge pain
decentholograms lowkey skip this by doing distance checks afaik
and resend constantly on a timer
fun
get out

😦
Does anyone now of a good library for Junit testing a plugin. more specifically for testing methods that contain JavaPlugin.getPlugin(MyPlugin.class)
not sure what you mean by the last part but the "standard" solution for unit testing plugins is MockBukkit
You've encountered a major reason that people encourage you to stay away from static. Using DI, you can pass in a mocked instance, whereas the static getter isn't going to be accomodating for testing/mocking purposes
The plugin instance is not mocked (that would be incredibly stupid), that getter should work fine and there are a few libraries that make use of it too
does anyone know when jdbc / hikari commits when you have autocommit = true?
depends on the driver impl i suppose
apparently it commits on each statement
so im guessing you could not lock a row with that implementation
Thank you
Is there a better way of doing this? I havent done SQL in a long long time and feel like theres definitely a much better way of doing this
fun insertVariance(variance:Variance){
if (exists(variance)) return
val statement = connection.prepareStatement("" +
"INSERT INTO `wastage` (" +
"`product`, `date`, `amount`, `percent`)" +
" VALUES (?, ?, ?, ?)")
statement.setString(1, variance.product)
statement.setDate(2, Date.valueOf(variance.date))
statement.setFloat(3, variance.amount)
statement.setFloat(4, variance.percent)
statement.executeUpdate()
}
private fun exists(variance:Variance):Boolean{
val statement = connection.prepareStatement("SELECT * FROM `wastage` WHERE `date`" +
"='${Date.valueOf(variance.date)}' AND `product`='${variance.product}'")
val resultSet = statement.executeQuery()
return resultSet.next()
}```
I followed your advice and changed around a few things and now have working test
Thank you so much
why would that be stupid?
'bebrasmell':
material: barrier
slot: 53
display_name: ' &6↑&d Следующий уровень &6↑ '
priority: 0
click_requirement:
minimum_requirements: 1
stop_at_success: true
deny_commands:
- '[close]'
- '[sound] BLOCK_ANVIL_DESTROY'
- '[message]'
- '[message]&cУ вас недостаточно глины!'
- '[message]'
requirements:
perm1:
type: has permission
permission: k.1
perm2:
type: has permission
permission: k.2
click_commands:
- '[sound] ENTITY_PLAYER_LEVELUP'
- '[givemoney] 600'
hello, is there any mistakes?
it is deluxe menu
Wrong channel
is there a way to get a custom inventory's title in 1.19.2?
Inventory.getView().getTitle()
I dont see the getView() method anymore
nvm its a method in player.getOpenInventory()
My bad its the events that pass .getView() not the inventories.
=paste
Hello! Its been a while since ive worked with SQL and dont recall much. I feel there is many inefficiencies in this code, and was just wondering if anyone could help reduce the amount of queries/make more efficient
https://paste.helpch.at/kamoxixone.kotlin
insert variance is being called for each item in a list, so if theres a way to insert all the items at once can someone please let me know. Thanks!
(tag on response pls)
if you are doing bulk operations
you might want to insert multiple at the same time
with one query
I see
INSERT INTO class_result VALUES (1,’John’,’A’),(2,’Elsa’,’D’),(3,’Sophia’,’B’),(4,’Paul’,’B’),(5,’Saira’,’A’); <- like this
ah ok
copy pasted from a website
but if you google <yourdatabase> bulk <insert|update> etc
you should get the exact syntax for it
alrighty cool thanks
Does anyone know how I would select all the dates since the current date and the last tuesday?>
Here are a few solutions.
I dont have the start date tho
And I need to do it in just SQL now, no java/kotlin
Ah. My bad. I didn't realise this was a continuation to another conversation.
True. Well I was going to give you this link https://stackoverflow.com/questions/12783102/how-to-get-the-last-sunday-before-current-date but considering it's not java, it won't really help you.
i am not sure how you would get "last tuesday" but you can select using <> operators
but if its through java, then you can calculate it ^ like @broken elbow sent, then put them in the prepared statement
for timestamps i think the syntax is BETWEEN
WHERE columnName BETWEEN timestamp1 AND timestamp2 <-
you can also put in yyyy:mm:dd hh:mm:ss i think
not sure about the exact syntax of it
Idk if you can get the last Tuesday directly in SQL. You might have to calculate it in JAVA, then convert it to timestamp and then use what Aki gave you.
ah its possible apparently
Easily calculate SQL weekdays with the DATEIFF function, where you can calculate the most recent Monday, and previous Sunday and Monday.
found this
Hi, I tried to code a scoreboard for a minigame (with a countdown and some other stats which are personalized for the Player) But it always flickers or doesn´t get set right. Does anyone know a good API for something like that or at least a good tutorial because i just can´t find anything helpful and i have no idea how i should even start now because of things like scoreboard teams which i dont understand.
set the group prefix and suffix
instead of setting the lines directly
but how do they update then?
you update the group prefix and suffix
Uhm had an idea, to avoid DI, I have a reload method which basically updates an object to the values of the config file. It has checks to see if anything is wrong in the config, so what I did was create another class called ErrorInfo, which would contain the action done, player, and the error. So this reload method, if an error occurs, it returns that, if not, it would return null, is it a good idea?
I personally like it and find it organized, but I am unsure if it's the right approach or if it could cause any issues.
using static access?
its a bit of an anti-pattern
and effectively a singleton i am guessing
but for the case of the config, its kinda fine
nop
makes writing unit tests hell though
then dont you have to DI the config object?
without static abuse, you will have DI one way or another
I mean, yes, sure the config yes, but I really don't wanna have to DI the message handler (I have a method that parses the message and logs it into the console)
let me paste what I have rn, maybe it explains better what the idea is
it can probably be designed much better honestly
probably can
but I don't see how
uhm for context, I will have several objects of this
each being a gui
that getOrDefault 🥲
not personally glad of that one
effectively does what you want to do and thats what its for
good point......
although that still doesn't fix one issue
which is that I would have to DI the class that has the method that formats and logs the error
if (name.equals("-/-")) throw new InvalidConfigException(message)
done
ah
for logger classes
you probably want static access
using a singleton
Logger.getLogger() is a good example
oh so static wouldn't be an issue then?

