#development
1 messages · Page 119 of 1
?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
if action != null je uplne zbytecne
plus myslim ze bys mel misto equals pouzit ==
pouzij InteliJ a ne eclipse, ten ti poradi spoustu veci ci je to jen theme
error: https://paste.helpch.at/ojewoyeneb.cs
class: https://paste.helpch.at/unewelawuk.java
problematic line: p.openInventory(inventory);
(i used checkpoint debug msgs)
I printed the name of the thread to make sure it was main thread and server thread is literally "Server Thread"
intellij používám
a už je to fixed
Is Player p = player.getPlayer(); null?
Idk what threads have to do with it
Does anyone know how to disable monster collision damage?
I have damage methods overriden with empty body but its still there
no, both inventory and player werent null in debug msgs
It's not an NPE, it's a CancelledPacketHandleException
but they cut off the stacktrace :p
How can I compare a set based on size for comparable? Kinda like this
@Override
public int compareTo(@NotNull Set<IPlayer> iPlayers) {
return players.compareTo(iPlayers);
}
use the size() method?
primitives don't have methods
Oh yeah ofc, got any other idea how I can do this then?
try Integer.compareTo(int1, int2) or Integer.valueOf(int1).compareTo(int2) if that doesn't work
I guess this works
@Override
public int compareTo(@NotNull Object o) {
return Integer.compare(players.size(), (Integer) o);
}
uhh not sure if casting is going to work
use Integer.valueOf
Oh yeah, also this would work btw
ye, thats what i suggested, I think java auto boxes it to Integer
if not then u have to use that ig
public static Integer valueOf(int i)```
Returns an Integer instance representing the specified int value. If a new Integer instance is not required, this method should generally be used in preference to the constructor Integer(int), as this method is likely to yield significantly better space and time performance by caching frequently requested values. This method will always cache values in the range -128 to 127, inclusive, and may cache other values outside of this range.
1.5
i - an int value.
an Integer instance representing i.
There is, but wouldn't that be the same as I did before? I need to parse that object to int anyway
oh wait thats an Object
Yeah
what type of object 😮
you might just want to return 1 if the object is not an instance of Integer
uh
@Override
public int compareTo(@NotNull Object o) {
if(!(o instanceof Integer)) {
return 1;
}
return Integer.compare(players.size(), (Integer) o);
}
?
yes
yes
basically, if we are the right type, then we are greater than them
Yeah makes sense
If o is a set, that won't work
Saying that because of this ^
I add content to a HashMap, and I want it to see with a command, but it is empty 😦 ```java
public HashMap<UUID, PermissionAttachment> playerPermissions = new HashMap<>();
public void setupPermissions(Player player) {
PermissionAttachment attachment = player.addAttachment(Main.getPlugin(Main.class));
playerPermissions.put(player.getUniqueId(), attachment);
permissionsSetter(player);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(sender instanceof Player) {
Player player = (Player) sender;
player.sendMessage(playerPermissions.toString());
return true;
}
return false;
}```This is my code, the setupPermissions() function it is executed in the JoinEvent
When I execute the command the HashMap is: {}, and must have informatio
Yeah I'm just using the size instead
Way easier
Found a way better solution actually, I can just parse Integer as the Comparable parameter so Comparable<Integer>
error: https://paste.helpch.at/ojewoyeneb.cs
class: https://paste.helpch.at/unewelawuk.java
problematic line: p.openInventory(inventory);
(i used checkpoint debug msgs)
I printed the name of the thread to make sure it was main thread and server thread is literally "Server Thread"
How do I get server TPS? People keep telling me to use Bukkit.getServer().spigot().getTPS() but it does not exist for 1.18?
There's no p.openInventory
Thats a paper only method, and it is from Server class
yes there is lmao. player.openInventory
d;paper Server#getTps
@NotNull
@org.jetbrains.annotations.NotNull double[] getTPS()```
Gets the current server TPS
current server TPS (1m, 5m, 15m in Paper-Server)
i use it all the time for guis
player.openInventory is not the same as p.openInventory
And, show the full exception
p is Player, player is CratePlayer
that is the full excetion
it doesnt print a stack trace
this is one of the annoying ones
player vs p are just variable names
Ok
any ideas?
ok so i'm always using eclipse and i really can't switch to any other IDE because i'm not professional and only do recode/update/fix stuff when i need
i wanted to ask, what is alternative to org.jetbrains.annotations.NotNull?
Can I use @NonNull instead?
I don't know the differences and i can't get precise answer online
thank you in advance
ok i just now realized that i can use org.jetbrains.annotations.NotNull in eclipse(?)
It is just a library
few months ago i tried using it in eclipse and it didn't work
maybe because i updated JDE now it works, however thanks
Hi, I get this error once I try to register custom placeholders.
https://paste.helpch.at/hojusiwezi.md
This is my code:
getConfig().getStringList("connected-servers").forEach(server -> {
sqlModules.addServer(server);
new PlaceholderExpansion() {
@Override
public @NotNull String getIdentifier() {
return "adminutils_" + server;
}
@Override
public @NotNull String getAuthor() {
return "Waterbroodje";
}
@Override
public @NotNull String getVersion() {
return "1.0.0";
}
@Override
public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
return String.valueOf(getSqlModules().getOnlinePlayers(server));
}
}.register();
});
Cause I'm guessing you're running this on bungee?
I'm now running it on bungeecord
You don't have papi on bungee, so it doesn't find it, also papi doesn't work on bungee so
Oh sorry, I said something wrong. I wanted to say that I'm not running it on bungeecord, but on spigot..
@high edge
maybe make it load after placeholderapi does
placeholderapi is a depend om my plugin
so..
@hushed badge can you maybe help?
can you share the whole server logs/latest.log @vale spindle
Can you send me a fr?
can't you just send it here ?
There is sensitive information in the logs
bruh alright, dms open
what's the best way to kill an entity (mob) for it to drop items on death?
.damage(999) or smt?
for (Player vanishedPlayer : VanishModule.vanished) {
if (vanishedPlayer == player) {
continue;
}
if (vanishedPlayer.hasPermission("vronsky.lobby.vanish.see")) {
vanishedPlayer.sendMessage(ChatColor.DARK_AQUA + player.getName() + " has joined vanished and silently.");
}
}
Why am I getting this message 2 times?
I assume it's on join?
yes it is in the playerjoinevent
@vale spindle make sure you aren't shading papi (should be a compileOnly dependency if you're using gradle, or have <scope>provided</scope> if you're using maven)
uh, how can I get the killer on a death event? we used to have .getKiller...
there is now a #getPlayer and a #getEntity
what's the function of each, and is one of them the killer?
wait, I am stupid.
omfg .-.
lol
legit stupid, ignore me
best way for solution to a problem is to type it out
happened to me too, I asked and then I realized lol
@lyric gyro The error is gone now, but it won't work when I type /papi parse
does it register fine? is it in /papi list?
aren't you supposed to return true with the persist & canRegister methods?
so, ik that there is alr a lecture on chat hoverings, but i want to add a hoverable to a msg from asynchatevent and dont want to send the player a new msg. is there any way to do that?
val distance = 50.0
val original = Location(null, 0.0, 0.0, 0.0)
val new = Location(null, 100.0, 0.0, 100.0)
val angle = atan2(new.y - original.y, new.x - original.x) * (180 / Math.PI)
val newX = original.x + (distance * cos(angle)).toInt()
val newY = original.y + (distance * sin(angle)).toInt()
println("x: $newX, y: $newY")
```anyone know why this prints out `x: 50.0, y: 0.0`?
I'm trying to get a point (starting from `original`) and 50 blocks away towards `new`
right
uh
x y z
YHGASDGHYHGADIDSAHDHAIWSD_ _ _ _ _ _
okay but
its still not working 😦
val distance = 50.0
val original = Location(null, 0.0, 0.0, 0.0)
val new = Location(null, 100.0, 0.0, 100.0)
val angle = atan2(new.z - original.z, new.x - original.x) * (180 / Math.PI)
val newX = original.x + (distance * cos(angle)).toInt()
val newZ = original.z + (distance * sin(angle)).toInt()
println("x: $newX, z: $newZ")
x: 26.0, z: 42.0
🤔
oh nvm fixed it
was using degrees
not radians
wat lang is that
kotlin
o
😌

Isnt there
Help
ok
What do you need help with?
Is there a command that will send the message annoucer?
I wanna make sure i did it right
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.
ope im sorry
Contact Discord for help. We aren't Discord.
How
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com/
It's funny that discord doesn't provide support on discord any more.
tbf it would be better if they did lol
Yeah they had a server for it but it's gone.
the owner's account probs got banned lol
or it got nuked
imagine that
official discord server getting nuked
They also had a "feedback" server. But now it's got a picture of a leaf and has no channels.
I tried it did not have nothing to help me
well we arent discord support so we cant help you
guess you will have to suffer ¯_(ツ)_/¯
i had the same problem
discord didnt do anything about it
had to change my number anyway so ehh
can anyone help me with this?
|https://paste.helpch.at/nogakirara.css
ah
Method invocation 'getConfig' will produce 'NullPointerException'
its giving warns in intellij
Good, now go ahead and fix that
how do i do that
i added correct path
database:
host: localhost
port: ''
database: minecraft
username: root
password: ''
ssl: false
What does that warning mean?
when a variable does not have any data
Good, now assign a value to that variable
private final String host = plugin.getConfig().getString("database.host");
the warning is happening here but i added it a value
The problem is not database.host but the object on which you are calling getConfig()
oh
Lol i got the problem
the issue is i didnt use saveDefaultConfig();
Ive this now,
getConfig().getStringList("connected-servers").forEach(server -> {
sqlModules.addServer(server);
new PlaceholderExpansion() {
@Override
public @NotNull String getIdentifier() {
return "adminutils_" + server;
}
@Override
public @NotNull String getAuthor() {
return "Waterbroodje";
}
@Override
public @NotNull String getVersion() {
return "1.0.0";
}
@Override
public @Nullable String onPlaceholderRequest(Player player, @NotNull String params) {
return String.valueOf(getSqlModules().getOnlinePlayers(server));
}
@Override
public boolean persist() {
return true;
}
@Override
public boolean canRegister() {
return true;
}
}.register();
});```
It shows on the /papi list, but when I try to use `/papi parse me %adminutils_event%` it shows `%adminutils_event%`.
try %adminutils_event_a%
doesn't work
Timo, you are using papi wrong
Register a single expansion and onRequest() check if the provided params are one of your servers and then call getSqlModules().getOnlinePlayers(params)
So this is correct right?
getConfig().getStringList("connected-servers").forEach(server -> {
sqlModules.addServer(server);
servers.add(server);
});
new PlaceholderExpansion() {
@Override
public @NotNull String getIdentifier() {
return "adminutils";
}
@Override
public @NotNull String getAuthor() {
return "Waterbroodje";
}
@Override
public @NotNull String getVersion() {
return "1.0.0";
}
String r = "";
@Override
public String onRequest(OfflinePlayer player, @NotNull String params) {
servers.forEach(s -> {
if (servers.contains(params)) {
r = String.valueOf(sqlModules.getOnlinePlayers(params));
}
});
return r;
}
}.register();```
if (servers.contains(params)) {
return String.valueOf(sqlModules.getOnlinePlayers(params));
}
return "Unknown server '" + params + "'";```
alright thank you
hi,just need some info on sql
Is BIT the correct field type for boolean field in java sql?
if yes,when i retrieve the value do i use getBoolean(fieldname)?or getInt()?
you need to add NMS packages
These packages are not present in the spigotAPI..you need to basically add NMS for that
You need the mojang authlib
(Paper)
Yes
You can find it on here
?
?
?
https://mvnrepository.com/artifact/com.mojang/authlib/1.5.25
I don't know their latest version tho
<dependency>
<groupId>dev.triumphteam</groupId>
<artifactId>triumph-gui</artifactId>
<version>3.1.1</version>
</dependency>```
If (player.write_sign.text = "Hi") {
player.sendMessage("Hello)"
}
Something like this
I tried to make event listeners that check if player write Hello in sign it would response back to player
and where is the issue?
I don't know how to
do it
I already tried many times
Material.SIGN_POST doesn't work anymore
I'm using Spigot 1.18.1
I am getting this error
with papi
posting here because it is not letting me to write in placeholder-api room
The plugin beasttokens is formatting a parses Double number(1513,812) with commas...
Has anyone here worked with the CooldownMap feature on Lucko's Helper library, I've been having a problem where it's been sending multiple messages once a single block is broken:
CooldownMap<Player> cooldownMap = CooldownMap.create(Cooldown.of(10, TimeUnit.SECONDS));
Events.subscribe(BlockBreakEvent.class)
.filter(event -> {
if(cooldownMap.test(event.getPlayer())){
return true;
}
Players.msg(event.getPlayer(), "You're on cooldown, please wait " + cooldownMap.remainingTime(event.getPlayer(), TimeUnit.SECONDS) + "s");
return false;
})
.handler(event -> {
Player player = event.getPlayer();
Block brokenBlock = event.getBlock();
hi there, some of my plugin user got this error when the server closes, and I see that many people complains about this kind of error from public plugins. Can someone explains me what can cause this error or how can I fix it ?
karma is registered to PAPI on startup, and the message error appears when my plugin send some datas into database just before my plugin disable. I don't use PAPI at this moment.
Many thanks for your attention
you cannot start tasks in your onDisable
Tasks, not functions that's it ?
OOooh I see. yes I do some Tasks inside. I'll remove them
Thanks
Hi there
I'm trying to re-create a combat logging system.
https://www.spigotmc.org/threads/combat-log.414491/
However my question is in regards to the first few answers of the topic vs the last few answers of the topic.
I can see why in terms of memory usage and other reasonings, you'd rather not have a timer/tick 24/7 running and checking things if it's not necessary. Correct?
However
If you want to improve the performance of the plugin, just store the System.currentTimeMillis() of the last hit (update it each time the player gets hit) and compare it to the actual System.currentTimeMillis() each time you want to check if he is out of combat.
compare it to the actual System.currentTimeMillis() each time you want to check if he is out of combat.
I'm having issues realising when you would put checks for something like this.
on hit, update last damage time
if player leaves and last damage time is less than pvp cooldown, he's escaping from combat, punish
ezpz
Yes, great suggestion.
However, I wish to notify the player after 20 seconds that they're safe to log out.
That's where my issue arrives
I've fixed it by using a PlayerMoveEvent for now, but I feel like there are different options.
Next, I have another question.
ChatColor.WHITE + ChatColor.BOLD + "Proto" + ChatColor.GRAY + ChatColor.BOLD + "Type" + ChatColor.DARK_GRAY + ChatColor.BOLD + " >> " +
I'm going to be constantly copy-pasting this 24/7
I'd like to make a final value and use it in all my classes. What would be the best way going about it?
hey, i feel stupid asking this, but anyone know why the "World.getHighestBlockAt" method is spamming my console with an out of bounds exception even though the coordinates i put in are a random int between -500 and 500?
(I have a megabyte's worth of text just spamming this error) https://paste.helpch.at/dobedufike.sql
Index 293601592 out of bounds for length 315
show some code
p.teleport(world.getHighestBlockAt(0, 0).getLocation());
thats all the code for that method
Is that line 27 from your CommandManager class?
wait, now it works, when i changed it from random -500 500, to 0
so its something to do with my random class,
line 27 invokes that method
yes
so... whats wrong with this randomint function?
return min + (max - min) * r.nextInt();
wait, i think i just figured it out
let me test
Depends what you're using the outcome for. You're being a bit vague when it comes to giving information as of how you're doing things :s
sorry, p is a player, world is the world, minimum is -500 and max is 500
🤯
but i think i just fixed it,
i was multiplying 500, with a random int between all possible int values
instead of a double between 0 and 1 and then rounding it
there's nextInt(min, max)
is that exclusive or inclusive bounds?
[min, max)
yea, but is the max exclusive?
yes
ok, ill add 1 to max then, tysm!
np
Move event? Cant you simply use a bukkit task? 
What do you mean exactly?
I want the plugin to perform as best as possible. (performance wise)
So, as long as the player is in Combat, it will get a task.
When this expires, it cancels the task itself.
https://bukkit.fandom.com/wiki/Scheduler_Programming
Is that correct? @shell moon
I'm adding hover event to chat messages and to do it I cancel event and broadcast a New Message but it breaks gangchat, is chat etc. What should I do?
not always the best option tho
I dont get what you are trying to do exactly. For countdown to prevent players disconnecting in combat i've always used a task
i mean, why would i use move event for that?
why exactly move event?
Anyone familiar with maven modules? I've got a project setup like parent -> core | 1.16.5 classes | 1.17 classes | 1.17.1 classes -> dist. Dist uses maven shade plugin to shade everything into one .jar. Trying to figure out how I can generate a separate javadoc .jar with the maven javadoc plugin but just can't seem to get it to work.
This is the project setup: https://github.com/BlackBeltPanda/Transport-Pipes/tree/MultiModule
Any help is much appreciated. 🙂
I've been trying for hours today and have tried for days before. Maven, jars etc... I can not get 1.18 to properly allow me to use NMS and API. I can get the code to not give errors using NMS but the server will error saying methods don't exist. I use the API and then the code errors.
I've tried mapped, remapped, original etc... None of the jars or maven dependencies (or configurations) have worked. This one plugin I have doesn't use reflection so unfortunately I'm stuck with spigots shitty excuse for a 1.18 version.
I've had multiple users say "depend on this jar", "depend on that jar", "read the spigot post for the maven configuration" and more. None of these worked either. So if someone has a working NMS/api jar and can detail how to get it let me know. I can use maven too but would prefer jars.
@hoary scarab i just ran buildtools with java -jar BuildTools.jar --rev 1.18.1 --remapped and after it had built it i went to my intellij and added to my projects pom.xml the md5 plugin for compiling the remapped jar and changed my artifactId from spigot-api to spigot.
Tried that too. But Ill rerun build tools and try again. one sec.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
thats my pom.xml
👍 Just copying from https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/ first and I'll try yours after.
well i copied from there and it worked for me
Its funny how they don't just release a downloadable jar now since they aren't including minecrafts source in the actual source of the jar now.
NVM Forgot I commented out the imports 🤦 Testing now.
With the md plugin in my pom maven errors.
Adding inheritance <hidden-path>\.m2\repository\org\spigotmc\spigot\1.18-R0.1-SNAPSHOT\spigot-1.18-R0.1-SNAPSHOT-remapped-mojang.jar
java.lang.IllegalArgumentException
at org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:249)
at org.objectweb.asm.signature.SignatureReader.acceptType(SignatureReader.java:140)
at org.objectweb.asm.commons.Remapper.mapSignature(Remapper.java:207)
at net.md_5.specialsource.CustomRemapper.mapSignature(CustomRemapper.java:63)
at org.objectweb.asm.commons.MethodRemapper.visitLocalVariable(MethodRemapper.java:243)
at net.md_5.specialsource.RemappingClassAdapter$2.visitLocalVariable(RemappingClassAdapter.java:183)
at org.objectweb.asm.ClassReader.readCode(ClassReader.java:2571)
at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1491)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:721)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:401)
at net.md_5.specialsource.JarRemapper.remapClassFile(JarRemapper.java:289)
at net.md_5.specialsource.JarRemapper.remapClassFile(JarRemapper.java:268)
at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:205)
at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:178)
at net.md_5.specialsource.mavenplugin.RemapMojo.execute(RemapMojo.java:214)
<Removed rest because of char limit.>
do you use java 17?
yes
ok one sec
since they aren't including minecrafts source in the actual source of the jar now
errr... the jar build by buildtools does contain the modified server which cannot be distributed.. as it always did
I can't check on the spigot discord but it was stated that the mc source was downloaded and bundled as the server starts now.
that's basically paperclip and would render buildtools 100% useless now if that was the case for spigot
if your using the md5 remap plugin then you need to set your ides java version to the same as its required version i found that out when i tried to compile using java 14
exactly my point lol
buildtools still builds the same jar as it always did tho, but with the new bundling system
it extracts the already patched jar(s) from inside itself, it doesn't download them and patch them on the fly
"Build success" 🤞 hope it actually works though.
👍
🤦 nope still didn't work. Caused by: java.lang.ClassNotFoundException: qr
The remapped jar added random casts to the methods and objects.
if your using the remapped jar then they wont be found
since they no longer use obfusicated code
eg: NBTTagCompound is now CompoundTag
all previous obfusicated methods will now use the mojang method, class, etc names
i believe variables are still obfusicated as var0, var1, etc but its definitly alot better to work with
Well there is remapped-obf and remapped I tried both and both error still.
Remapped-obf adds the random casts and causes the qr not found error that i posted above.
Remapped says EntityArmorStand.setLocation(Double, Double, Double, Float, Float) doesn't exist.
i cant find anything relating to EntityArmorStand
or any of the entities
i believe your looking for net.minecraft.world.entity.decoration.ArmorStand
@hoary scarab
Nope. net.minecraft.world.entity.decoration.EntityArmorStand
I strongly suggest switching to gradle and use paperweight-userdev
it's literally drag and drop and it works
Some people will want to kill me but...
I am having an issue, I added the jar directly as a dependency (FAWE from this version AKA Legacy), all imports work perfectly, but when I build the project, I get this:
E:\Plugins\PrivateMines\we-1-8\src\main\java\me\bristermitten\privatemines\worldedit\LegacyWEHook.java:4: error: package com.boydti.fawe.object.schematic does not exist
import com.boydti.fawe.object.schematic.Schematic;```
For context, trying to build/update this privatemines plugin that got abandoned
Its paper though. I don't really support forks (aside from spigot)
unless you use paper exclusive methods (in both internals and api), it will work on spigot just fine
I'll look into it then. Thx
the thing is that the runtime jar has spigot mappings for class names, but everything else is reobfuscated (field/method names), packages are mojmapped
and it's not really suited for developing against it either as the actual server jar + libs are inside (which is then extracted.. blah blah)
it's a mess
So I shouldn't use it?
Why can't spigot just go back to the old jars. 1 jar contains all we need with no issues.
because
Like I'm lazy and don't want to recode 17 classes into 1 reflection class so I always kept the same code.
Now it might just be easier to use reflection.
rip 
I think you also need the WE API, afonso
with the proper tooling now it's easier than ever to use internals (and it being easy to adapt between versions, at best you wouldn't even need to recompile!)
but yeah
spigot
proper tooling

Didn't know discord had a limit until I left that discord xD

I have it. In my gradle.build, not as a jar dependency
and I am importing both fawe and we
no errors or whatsoever.
Hm, is it located above fawe?
same 
I think the official mc discord is the only "big" mc community server I never joined
and with the emojis it has... I have no intentions of doing so
I am unsure why this is happening tbh lol

agree.
we should all do a fortnite dance
maybe it will suddenly work
xd ¯_(ツ)_/¯
giving me headaches
besides the fact I can't even find similar issues in the internet
just confirmed if it wasn't gradle removing it but it can't be since I am compiling it too
compileOnly files('lib/FastAsyncWorldEdit-bukkit-Legacy.jar')
okay wait, discovered it isn't importing it afterall
but the question now is why, the location is right...
bruh
logic be like
oh wait
actually got an error this time when reloading the gradle
the sad part is, I have no idea why it isn't taking it as a dependency
yeah files should work then
don't they.. like.. have a repo and a published artifact you can add instead?
this is a legacy version
ok...?
it had, but it used jenkins and apparently it isn't working anymore
well I would get the same errors before
at least.
well, it wouldn't even import
it was using https://ci.athion.net/job/FastAsyncWorldEdit/ws/mvn/ as repo
which apparently doesn't work anymore
hm
I legit can't find any way to solve this lmao
in general, I know ray tracing is fairly expensive. Is there enough negative stigma with it in spigot development that it should be avoided or used spairlingly?
I'm trying to test if a block can at least part of a block another and it seems like the logical choice. But I need to test several rays for the potential block pairing
cool. When I find a working fawe version that I can use, it strikes again:
Okay, so... how can I prevent gradle from modifying my dependencies?
in other words, how can I prevent this?
so I have this folder, with a deconstructed minecraft plugin in it. How would I use a console command to compile it into a jar, with the bukkit library aswell? cause i tried jar -cf pl.jar * which compiles it to a .jar, but that dosn't have the bukkit library, and it throws errors when i put in it my server. Is there any way to do this?
Use a build tool to shade whatever you need
Would also help if you showed code, shared what errors, etc
Is there a way to set an item to an inventory without changing its reference? the current methods, setContents and setItem, create a nms copy of the item so it loses the reference :/
I'm trying to use send webhooks to Discord, does anyone have any idea as to why I'm getting this error?
deleted the code and error ignore this message
I aslo copy and pasted the webhook url directly from Discord to my ide so I know that it's correct
https://discord.com/developers/docs/resources/webhook I can't see anywhere in here just a POST for https://discord.com/api/webhooks/{webhook.id}
there is one for /webhooks/{webhook.id}/{webhook.token} so make sure it has the token i guess
It has the token on the end, I just didn't include it in the stacktrace that's my bad
HTTP 400 means you did something wrong, so malformed header or something
Do you have at least one of content embeds or file in the JSON?
I had an invalid url in the json, I noticed when you pointed this out. Thanks 
runTaskAsynchronously runs a task a single time on a separate thread to the main server thread, so whenever the scheduler decides to slot it in. It's different every time, but generally pretty quick
I'm trying to figure out an algorithm which searches blocks in such a manner (in a 3d plane tho ofc, since it's minecraft).
I got this so far
But that doesn't exactly work, since it starts from the highest Y value and ends at the lowest Y value (And I need it to skip between values so it does
0, 1, -1, -2, 2, 3, -3, -4, 4, 5, -5)
that sounds highly inefficient
I don't think he's path finding, probably for some in game animation
ik the gif was path finding
but I'm guessing he was just using that site to demo what he actually wanted
it's inefficient in every case
It wouldnt be inefficient
If I find a way to not keep going over the same blocks over and over again
And I am doing this for a mob AI
I need it to check one block per tick around itself, but these blocks have to be from closest to furthest
If I do a normal search it'd start from the bottom left corner of a cuboid area and end at the top right corner
I'd need it to check blocks at distance 1 first, then blocks at distance 2, then at distance 3 and so on
what's wrong with a simple flood fill like approach?
So that as soon as a valid block is found, the loop stops
If the block is next to the mob it'd loop through hundreds of block
Since I need to get the closest block to the mob
I COULD loop through all the blocks and check the distance for each but that's extremely slow and inefficient
Hence I'd need to check in an increasing radius around the mob
I agree with SirYwell; flood fill approach is probably the easiest here. Just add the locations that are check to a list to avoid checking them again. Start at the center location and it should roughly move from the inside out. Can set a limit on the size of the location list, as well, to limit the looping.
Adding the location to a list = creating a new location object, then I gotta compare two location objects together every single time the loop is ran (which is ~1000 times)
that's also inefficient
It is called flood fill algorithm
At least I know what it's claled
Sounds like micro optimization
I mean i'd be avoiding creating 1000 location objects
Or adding to a list up to 1000 times
That ain't micro
Only 1000? That's pretty micro, IMO.
Location objects and comparisons aren't so heavy that 1000 of them would have much of an impact
Idk I've been told in the Minecraft Mod Development discord that it gets heavy if there is like 20 of these mobs that do this check like 20 times a minute
Oh yeah, if you're doing that every tick, then that's gonna be heavy
Oh, misread; thought you said 20 per second lol
Unless I give all of them a shared brain to see where all the instances of that block are stored
Either way, I'll look into the flood fill algorithm
🙂 👍
Nah never mind
how can I send a player to a other server with a bukkit or spigot plugin
As in, in your own Bungeecord/general proxy network?
yes
d;bungeecord ProxiedPlayer#connect
void connect(ServerInfo target, Callback callback)```
Connects / transfers this user to the specified connection, gracefully closing the current one. Depending on the implementation, this method might return before the user has been connected.
target - the new server to connect to
callback - the method called when the connection is complete, or when an exception is encountered. The boolean parameter denotes success (true) or failure (false).
like that ^
yeah but he wants to do it from a spigot plugin
yes
public void connect(Player p, String server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
try {
out.writeUTF("Connect");
out.writeUTF(server);
} catch (Exception e) {
// the sending failed
}
p.sendPluginMessage(this, "BungeeCord", out.toByteArray());
}```
this will be the plugin btw
thanks 🙂
ye
#general-plugins @tight robin
im currently figuring out protocollib, im using Play#Client#WINDOW_CLICK and im not sure how to get the item on the cursor when i click
im wanting to allow players to put items that arent helmets on their head
I have PAPI dependency included in build.gradle, as well as it's repo, tho it's not imported, what
What
repositories {
maven {
url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'
}
}
dependencies {
compileOnly 'me.clip:placeholderapi:2.11.1'
}
???
Did you click the reload button?
¯_(ツ)_/¯
uh tried.. restarting ij?
there's a new "fix" button or whatever
ah, File -> Repair IDE
😵💫
Bintray lmao
oh lol
yeah
that was the issue
isn't it read-only now tho
and should still work
Not latest version afaik
How would I spawn a fake player with the skin of an online player? I am able to do it with textures and their signature.
Just spawn it xD
i found this for mc 1.7 (nms)
Hi. so I am trying to build this project: https://github.com/knightzmc/PrivateMines
And I am running into an issue where gradle is building the project but is creating seperate jars instead of one single one.
This is the "main" AKA Project build.gradle: https://paste.helpch.at/udoketezek.cs
I am also including everything in the main settings.gradle.
Any ideas? Ping if you can help.
No, I need to get the skin of an online player
Not sure if this helps but I'll send it anyway https://github.com/CitizensDev/Citizens2/blob/48a2763a1b68d9c76f576265b07a1c8df748d52f/main/src/main/java/net/citizensnpcs/npc/skin/Skin.java
That's not a problem, the plugin jar is the one you actually need
The thing is... it isnt building a plugin jar... its building 3 different jars
Show me
Can it be in a few hours? Kinda at school right now. But if you check the source code, you will see base, compact and plugin folders each with their own build.gradle
yes, that's correct
and the plugin/build/libs should be where the plugin jar builds to
And well, it’s generating a jar for each one of them
It isn’t… there is o lot a plugin-VERSION of 4kb
Which Isn’t the whole plugin
try building with gradle plugin:shadowJar
Can i have event listeners in papi expansions?
is there a simple null check when checking config file?
null check for the value of config.getX() ?
plugin.getlangConfig().getString("savechestlog");
ok, get the string, put it on a variable and then do a null check
So I'm using reflection and trying to generate a ChatComponentText object
chatComponent = beforeSeventeen ?
Class.forName(nms+NMS_VERSION+".ChatComponentText") : Class.forName("net.minecraft.network.chat.ChatComponentText");
```I see `chatComponent.newInstance()` but I can't add parameters to it. I need to replicate `new ChatComponentText(String)`
d;jdk Class#newInstance
@Deprecated
public T newInstance()
throws IllegalAccessException, SecurityException, InstantiationException, ExceptionInInitializerError```
Creates a new instance of the class represented by this Class object. The class is instantiated as if by a new expression with an empty argument list. The class is initialized if it has not already been initialized.
This method propagates any exception thrown by the nullary constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that would otherwise be performed by the compiler. The Constructor.newInstance method avoids this problem by wrapping any exception thrown by the constructor in a (checked) InvocationTargetException. The call
clazz.newInstance()
can be replaced by
clazz.getDeclaredConstructor().newInstance()
The latter sequence of calls is inferred to be able to throw the additional exception types InvocationTargetException and NoSuchMethodException. Both of these exception types are subclasses of ReflectiveOperationException.
IllegalAccessException - if the class or its nullary constructor is not accessible.
SecurityException - If a security manager, s, is present and the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class.
InstantiationException - if this Class represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
ExceptionInInitializerError - if the initialization provoked by this method fails.
a newly allocated instance of the class represented by this object.
Didn't see that let me reread. Thank you.
Np
I'm blind I see it now lol.
yeah it has some Class<?> params
Damn... what do I use under java 9?
d;javadocs
Javadocs that don't fit into other categories.
• caffeine • gson
• commons-cli • guava
• commons-codec • guice
• commons-collections4 • helper
• commons-compress • helper-sql
• commons-configuration2 • javacord
• commons-crypto • jda
• commons-email • processing
• commons-io • snakeyaml
• commons-lang3
• commons-logging
• commons-text
• configurate-core
• configurate-hocon
• configurate-json
d;jdk8 Class#getDeclaredConstructor
public Constructor<T> getDeclaredConstructor(Class... parameterTypes)
throws SecurityException, NoSuchMethodException```
Returns a Constructor object that reflects the specified constructor of the class or interface represented by this Class object. The parameterTypes parameter is an array of Class objects that identify the constructor's formal parameter types, in declared order. If this Class object represents an inner class declared in a non-static context, the formal parameter types include the explicit enclosing instance as the first parameter.
JDK1.1
parameterTypes - the parameter array
SecurityException - If a security manager, s, is present and any of the following conditions is met: the caller's class loader is not the same as the class loader of this class and invocation of s.checkPermission method with RuntimePermission("accessDeclaredMembers") denies access to the declared constructor the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class
NoSuchMethodException - if a matching method is not found.
The Constructor object for the constructor with the specified parameter list
Oh ok. Thought the method was only added in java 9
Just copying the code to reflection as much 1:1 as possible.
aight
And yes NMS is needed because spigot still has no API for packet based entities.
Nothing new 🤣
I think they added particle packets to send to individual players but if that is the case thats the only packet based feature you can use via the api.
Of course.
Wasn't my plugin. I took it over.
ah, alright
I would have done reflection if I made this originally xD
I hate this process tbh xD
I sometimes wish that mc was one of those games that force you to play only the latest version xD
I don't, each version has its purpose. I'm actually forced to use reflection because 1.18 fucked up the api and nms methods/classes. (Still haven't gotten it to work)
Or, you know, 1.8.8 ( 😅 ) or latest, nothing in between, maybe just 1.12.2
The minecraft protocol makes me wanna rip out my hair cause i am clearly missing something
listen to Play#Client#WINDOW_CLICK
send a Play#Server#SET_SLOT packet that should place an item on the players head.
1.8.8 for performance. 1.9 for combat, 1.10 - 1.11 for bug fixes. 1.12 for legacy, 1.13+ for wasting time 😉

performances are better now, if that's what you are talking about, Yapp
Hey, wonder if discord shachst will. E supported on psn now that you can link them
Is it worth to put @Contract on a kotlin method?
For example, this
@Contract("!null -> !null")
inline fun <reified E: Enum<E>> String.test(default: E? = null): E? {
return Enums.getIfPresent(E::class.java, this.uppercase()).orNull() ?: default
}```
no
Legacy versions still preform better cause they don't have all these new useless features.
yeah but why would you play survival on 1.8 ?? I see your point, but that doesn't mean the new stuff are 'useless'
if (e.getPacketType() == PacketType.Play.Client.WINDOW_CLICK) {
ItemStack item1 = p.getItemOnCursor();
ItemStack item2 = p.getInventory().getHelmet();
if (packet.getIntegers().readSafely(0).equals(0)) {
if (packet.getModifier().readSafely(2).equals(5)) {
p.getInventory().setHelmet(item1);
p.setItemOnCursor(item2);
}
}
I have this, WINDOW_CLICK does get sent out every time i click but this only changes the helmet and cursor if i double click which makes no sense to me
never had any problems with newer versions of the game
Thats why I said. Different versions of their purpose lol
it's more likely a you problem
LMFAO Sure bud. Sure.
Still not release and not fully function but Kotlin has its own contracts, that for example would be
public inline fun <reified E: Enum<E>> String.test(default: E? = null): E? {
contract {
returnsNotNull() implies (default != null)
}
return Enums.getIfPresent(E::class.java, this.uppercase()).orNull() ?: default
}
ah so that's how you use it
Anyone that knows a library that can set blocks with nms
i don't want to use worldedit
ProtocolLib?
Anyone have any idea what packets are sent when you try to put a helmet or pumpkin on your head but isnt sent when you try to place a regular block on your head?
i know that WINDOW_CLICK is sent but have no idea what other packets are or arent sent
Thats because the class doesnt have an empty constructor
use chatComponent ?
chatComponent is already a Class
Also, the reason getDeclaredConstructor has Class<?> params is to tell it what constructor you want to get
I'm here writing this shit and I miss that SMH.
And it your case it would be getDeclaredConstructor(String.class).newInstance(text)
👍 thank you.
Np
any ideas on how I can convert a material to a List<ItemStack>?
What do you mean?
Well, let's suppose I have a command that takes a material as argument
but the method I want to execute only accepts List<ItemStack>
I need to convert it
I suppose I could create a list, turn the material to an itemstack and then add it to the list?
Arrays.asList(new ItemStack(Material.getMaterial(arg)))
yeap
ty
x()' in 'net.minecraft.world.entity.EntityInsentient' clashes with 'x()' in 'net.minecraft.world.entity.EntityLiving'; attempting to use incompatible return type
``` this error keeps popping up and I honestly have no clue to fix it and i've been trying to for a while.
Guys does anyone knows how to fix this issue "An existing connection was forcibly closed"
thats a wifi thing i think
is there a fix though?
i do everything but keeps showing up
How can I turn off statistics for my server? I dont want the player able to go Menu >> Statistics and see things
does anybody know the client bound version of PacketPlayOutNamedEntitySpawn
hello
i have a channel, the roles for my coleaders and admins. The are not able to kick, add roles or any permission i set them to do and i have everything activated. Need help, why cant they have their powers when the permissions are allowed?
org.spigotmc:spigot-api:txt:remapped-mojang:1.18-R0.1-SNAPSHOT was not found in https://hub.spigotmc.org/nexus/content/repositories/snapshots/
This error pops up and i honestly dunno what to change, its stopping me from exporting jar
something in your build.gradle is off, maybe a misspelling, maybe a missing repo
idk where that specific jar is located at
im using maven
Anyone know in 1.8 how i can repalce a bunch of blocks fast?
Im having an issue with NMS and ghostblocks, and im trying FAWE, but there isnt many docs on 1.8
you misspelled 1.18
LOL
How do I import a plugin into intellij, I only know how to create fresh projects and apply spigot or paper to them.
Like when I open them, I get errors in all my classes, https://gyazo.com/4ac8e66f09f16fe04c81075a11c20b21
So my question is how to open a project up in spigot
i figured it out fuck yeah
using protocollib i figured out how to put blocks not normally allowed on players heads on their heads through the inventory interface
what would cause getLogger().info not to work on a command?
command is not registered (in code or plugin yml)? like if you do something else than log info its working?
how? someone else has been having an issue where they can't put blocks on armorstand head slot (using packets - EntityEquipment), maybe its similar? 🤷
idk
command works fine, just can't get getLogger.info to work
#showcase message
You can look how I did it if you would like
I fixed it, still don't know why Intellij wouldn't add the import
iterate thru every element out of list and writeString into the output stream
Hello people, im trying to show images with particles (dont ask, ik its not good for FPS), but when spawning the particles, only a part of it actually stays and is visible :( https://upload.skyslycer.de/javaw_vPBcMSmXVf.mp4
Code: https://haste.skyslycer.de/ajabanuduj.coffeescript
Probably client limiting the amount of particles? ¯_(ツ)_/¯
That's controlled by the speed parameter
Can you guys recommend a pagination lib that works with JDA 5.0.0? ty
I know you should not access bukkit async (in many cases), but how it is when you only want to check blocktype on x location (no modifications in the world)?
It will get angry if you try to load a chunk
it should not load the chunk ether, but I perhaps can not avoid it? I use (location are from cache).
Location below = location.clone().subtract(0, 1, 0);
below.getBlock().getType()
how do you know if the chunk is loaded?
d;spigot Chunk#isLoaded
boolean isLoaded()```
Checks if the chunk is loaded.
True if it is loaded.
race condition!
chunk may technically unload before the next call, although it's unlikely
in this case i don´t need to know it really, but if that method also load the chunk i also need check that to.
I can also say #isLoaded will make big hit on the plugin tick usage (if you have close to 5000 entity's in the cache) 🙂
yeah it load the chunk when you get the block. That was really interesting, thanks for the info.
» Give the helpers some details
» Ask suitable questions
» Be polite
» Wait
no, we cant, we dont know what the issue is
What's the best way to teleport a player to a different server & location?
using bungee api
PluginMessaging?
yea im using it already but what if the player isn't on the server yet?
but at the same time I don't want it to seem too delayed
oh wait
isn't there a join event-
🤦
Thats the only downside is the server requires a player.
i'm trying to make it so that a player can warp other ppl to their location
so it'll always have a player anyways
:))
👍
😃
that type parameter gets erased iirc
What can I do about it?
@EventHandler
public void onItemCraft(CraftItemEvent event) {
if (!event.getRecipe().getResult().getType().name().endsWith("_SHULKER_BOX")) return;
ItemMeta meta = event.getCurrentItem().getItemMeta();
if (meta instanceof BlockStateMeta) {
BlockStateMeta blockStateMeta = (BlockStateMeta) meta;
if (blockStateMeta.getBlockState() instanceof ShulkerBox) {
System.out.println("It's a shulker box");
ShulkerBox shulkerBox = (ShulkerBox) blockStateMeta.getBlockState();
shulkerBox.getInventory().setItem(0, new ItemStack(Material.WHITE_DYE));
}
}
}
Any clue why this doesn't work?
the It's a shulker box message is printed
but the white dye is never added
event.getRecipe().getResult().getType().name().endsWith("_SHULKER_BOX")
aaaaaaaaaaaaa
Tag.SHULKER_BOXES.isTagged(blah.blah.getType())
wait wtf how long has this been a thing
proooobably 1.13
wtf
news to me
and I only learned java in like 1.16 era
anyway, that's not important lmao
lol
team.addEntry(player.name)
Bukkit.broadcast(Component.text("Added entry to ${team.name}:${
NamedTextColor.NAMES.key(NamedTextColor.nearestTo(team.color()))
}"))
```anyone know why this broadcasts the correct color but my glow color (using Player#setGlowing) is still white?
uh quick question, you can't create GUIs with a bungee plugin right?
(wouldn't make sense if you could but just making sure)
you can
well
it works without TAB
but how do I make it compatible?
does anyone know of a way to control and ride an entity through 1.8.8 with NMS? I cant find any tutorials or forum posts on this
depends what entity
ty
uhm this is correct right? I can't just understand how in.readUTF() is returning 2 different things? ....
@Override
public void onPluginMessageReceived(String channel, Player player, byte[] message) {
if (!channel.equals("BungeeCord")) {
return;
}
ByteArrayDataInput in = ByteStreams.newDataInput(message);
String subchannel = in.readUTF();
if (subchannel.equals("GetServer")) {
String servername = in.readUTF();
}
}```
(this was legit basically taken from https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/#getserver)
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Basically the data is "queued"
Impurity!
lol okay, tysm
ProtocolLib? 
Which variable is the right one, packetClass or pClass?
d;jdk Method#invoke
public Object invoke(Object obj, Object... args)
throws IllegalArgumentException, InvocationTargetException, NullPointerException, ExceptionInInitializerError, IllegalAccessException```
Invokes the underlying method represented by this Method object, on the specified object with the specified parameters. Individual parameters are automatically unwrapped to match primitive formal parameters, and both primitive and reference parameters are subject to method invocation conversions as necessary.
If the underlying method is static, then the specified obj argument is ignored. It may be null.
If the number of formal parameters required by the underlying method is 0, the supplied args array may be of length 0 or null.
If the underlying method is an instance method, it is invoked using dynamic method lookup as documented in The Java Language Specification, section 15.12.4.4; in particular, overriding based on the runtime type of the target object may occur.
If the underlying method is static, the class that declared the method is...
This description has been shortened as it was too long.
obj - the object the underlying method is invoked from
args - the arguments used for the method call
IllegalArgumentException - if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
InvocationTargetException - if the underlying method throws an exception.
NullPointerException - if the specified object is null and the method is an instance method.
ExceptionInInitializerError - if the initialization provoked by this method fails.
IllegalAccessException - if this Method object is enforcing Java language access control and the underlying method is inaccessible.
the result of dispatching the method represented by this object on obj with parameters args
The first argument should be an instance of PlayerConnection, not Class<PlayerConnection>
pcClass is the PlayerConnection class I get from the player. packetClass is the packetClass lol
the pcClass is right. The issue is the parameter in the method. Packet<?>
No
It literally says why IllegalArgumentException is thrown
And in your code, you call playerConnection.getClass() which give you a Class<?> and you need an instance of PlayerConnection to call sendPacket on
Oh. 🤦 let me test that then.
if the method is an instance method and the specified object argument is not an instance of the class
Even if I use just playerConnection it has the same error.
Whats playerConnection?
PlayerConnection
If i have multiple arrays that look something like:
new byte[][]{
{0, 0, 0},
{0, 1, 0},
{0, 0, 0}}
```how could I combine them so that the final array looks like:
```java
new byte[][]{
{0, 0, 0, 0, 0, 0},
{0, 1, 0, 1, 0, 0},
{0, 0, 0, 1, 1, 0}}
You're right. give me a sec. It returned Field for some reason.
Object pc = getHandlePlayer.invoke(craftPlayer.cast(p)).getClass().getField(fieldName);
🤦
I guess a better way to phrase it is if i have two 2d arrays that are 3x3 how could i combine it to make a 2d array thats 6x3
ohh
no he isn't trying to add two arrays together
@dense drift got that fixed thank you.
Yeah, im trying to make a sort of layout for room generation
and that's what you linked?
public static byte[] concat(byte[]... arrays)```
Returns the values from each provided array combined into a single array. For example, concat(new byte[] {a, b}, new byte[] {}, new byte[] {c} returns the array {a, b, c}.
arrays - zero or more byte arrays
a single array containing all the values from the source arrays, in order
simple and easy
oh that works ill try that
I think it doesnt take 2d arrays :/
(Deleted cause will use hastebin)
Yes, it doesn't
So should I call that method for each 1d array inside the 2d?
Yes
Uhm soo... trying to work with bungee plugin messaging channel... this is my:
Main goal: The main goal is to get the current server, if it doesn't start with "lobby", get the list of all the servers, add all the servers that start with lobby to a list, get the player count of each server and send the player to the server with the lowest player count.
Issue: It's not passing from the command, I added several debugs and it onlys sends the first one, which means the PluginMessage isn't being sent or there is an issue with channels, or idk.
What I tried: Tried changing the channel, but didn't work, unsure where the issue is.
Extra question related to this: If I use the Bungeecord channel, if I use GetServer, any plugin in that channel will listen to it right?
- PluginMessageListener: https://paste.helpch.at/yutubefati.js
- Command: https://paste.helpch.at/ihecuyisib.java
- Main: https://paste.helpch.at/ejozavahuw.java
In the respective order.
public static byte[][] combine(byte[][] first, byte[][] second) {
if (first.length != second.length) {
throw new IllegalArgumentException("Arrays must be of equal length");
}
byte[][] array = new byte[first.length][first[0].length + second[0].length];
for (int i = 0; i < first.length; i++) {
System.arraycopy(first[i], 0, array[i], 0, first[i].length);
System.arraycopy(second[i], 0, array[i], first[i].length, second[i].length);
}
return array;
}
```here ya go :))
A player has to be online on both servers @worn jasper
Thank you very much that saves me a lot of time 😄
wdym?
I could probably tweak it to extend the array of lesser size if they aren't the same size right?
You need a player on one of these lobby servers for the message to be sent
uh? I think you misunderstood what I am trying to do.
or wait, maybe you didn't
You are sending a pluginMessage and for that to happen, you need players on all servers you want to receive the message
what if I don't have any player on those servers?
what's the fix/solution to it?
Bungee has methods to get the servers of your network
Yes but that would involve using a bungee plugin in that case?
And the ProxiedServer or whatever has a method to get the player count
Well and sounds like a better idea to me
Especially that you want to send the player to the server with the lowest player count, which can be 0
But with PluginMessaging, the message wont be sent to those servers
If the system was only sending the player to the lobby with the lowest count, yes it would be the issue is it isn't just that, if the player is in a lobby, and he does /lobby it should display a list of all lobbies in a GUI, if he is in a game server, it would send him to the lowest count server, is that possible with bungee plugins?
I mean, those send you directly to a specific server.
it's a bit different in this case?!
Its all handled by bungee
The connect message is sent through the Bungeecord channel or using bungee specific methods
public static byte[][] combine(byte[][] first, byte[][] second) {
// get highest array size
final int length = Math.max(first.length, second.length);
// create the combined array
byte[][] array = new byte[length][first[0].length + second[0].length];
// loop to fill the array
for (int i = 0; i < array.length; i++) {
// make sure that the array is large enough in case the second is larger
if (first.length > i) {
// copy the first array into the combined array
System.arraycopy(first[i], 0, array[i], 0, first[0].length);
}
// make sure that the array is large enough in case the first is larger
if (second.length > i) {
// copy the second array into the combined array, but skip the first array size (to avoid overwriting)
System.arraycopy(second[i], 0, array[i], first[0].length, second[0].length);
}
}
return array;
}
```i also commented it since it might seem confusing
but would I need in this case to have a plugin for bungee, another for the lobbies and another for game servers?
Wow, thank you
@dusky harness or, you know, an byte[n][m] array and then use Guava to combine the arrays :)
I was doing a less efficient way
that sends the player to the server with the lowest playercount, but could I then override it in the lobbies? since in lobbies I want it to display a gui with all the servers.
You can do whatever you want
i just wanted to give a method then he (or myself) could optimize it later since i couldn't think of how to ¯_(ツ)_/¯
fair enough.
wait wdym byte[n][m]
n = number of rows
m = number of columns of both 2d arrays
Can guava do that?
but this method just combines all the array contents into one array
i mean i sorta think i get what you're saying? but my brain is unable to understand lol
idk
a
create a 2d array where the others will be set
use a for loop from 1 to n, get the arrays from first and second array located at position i, combine them, and set them in the array created before
well i mean thats basically what im doing in that above method
except im setting it 2 times instead of combining -> setting
i understand what u mean now tho
byte[][] destination = new byte[n][m];
for (i from 0 to n) {
destination[i] = Bytes.concat(a[i], b[i]);
}```
ye
is using like var bad practice?
example: var servers = plugin.getProxy().getServers();
why would it be
I see it as a method for lazy people to code, but is it bad practice?
no idea why it would
hence why I am asking lol
you mean var in java or kotlin
java
its ok to use it
k then
btw how come ur using NMS for it?
Because spigot doesn't have per player packet api's for entities
ah
But they like to complain and say use the api even though this doesn't exist lol
also iirc nms entities still persist on server restarts so make sure to test that
they don't
but they still have uuids and stuff
hm
like if you do /minecraft:kill @e does it remove the armor stand?
I've tested it before when I attempted to find out how many entities the server can actually store lol
nope
huh
interesting
then why have I been using entirely based packet armorstands this whole time 😩
i thought it stayed
ill have to retest sometime again 🤔
hmm
Depends on the reason you need the entity.
well since it doesn't stay on server restart there isn't a reason to use packet armorstands
(which is what ive been doing)
When the chunk loads it adds the entities into the list. I learned that when it was changing the entity object of my minions.
wait wdym?
So when the chunk unloads it unloads the entities from the list. When the chunk loads it will grab the entities from that chunk and readd them.
but then wouldn't it also be saved onto the world file?
it is but not saved in memory if the chunk is unloaded.
oh
then im prob better off using packet based ones then
|| might want to rebump ur question ||
yeah lol
uh... getting this error when building:
Executing Gradle tasks as part of a build without a settings file is not supported. Make sure that you are executing Gradle from a directory within your Gradle project. Your project should have a 'settings.gradle(.kts)' file in the root directory.
The funny part is... the god damn file exists
no
wasnt talking to you
any one help? UwU
u//w//u
Maybe delete the project and clone it again from your VCS (you can commit the changes, if there is uncommitted ones)
sheep
Did you mean replace a section? Like //set?
FAWE uses method 4
no main manifest attribute, in clippy.jar```
Any idea why Ptero would suddenly complain about this, even though the jar has a manifest file and the `Main-Class` property?
you need to dig in nms
Anyone know how I could use the bukkit scoreboard API while another plugin (ex TAB) is also installed on the server?
so that I could set player's glow colors
uh, hi, can I use methods from a Bukkit plugin API in a Bungeecord plugin?
(In this case, I want to use a method only present on a bukkit plugin, when executing a command in a bungee command)
I believe that would result in a NoClassDefFoundError
Just updated my project to JDK17 and now I'm getting class file has wrong version 61.0, should be 55.0 when compiling. All regarding the papermc API. Anyone has an idea how I can resolve this? Built fine with jdk 11 before
ByteBuf rewrittenBuf = Unpooled.buffer()
Does anyone know if I'm suppose to do ByteBuf#release(); after I did something with it?
My plugin is using a lot of memory, trying to figure out why xd
No clue if the additions are necessary, PluginMessage is a packet from VelocityPowered
How to set deluxe menu that the nether star will be in our last inventory slot
Hey, im very very stuck here. Im trying to create a 1.8 mod, but im constantly getting a error even trying to make a workspace...
Idk why it marked it as CSS
The line in the gradle file thats apparently the issue:
mappings = "snapshot_20141130"
Anyone know a good API for making custom mobs?
i believe the best way is using nms
atleast thats what ive heard from alot of youtube videos relating to making custom mobs
ok
MythicMobs?
never thought about mythicmobs, might be worth using
The villager trade deny sound
do you use plugin messages?
nope i just use redis to handle communication
i was using bungee channels before but that was bad for certain stuff
Is mythic mobs standalone?
i believe so
Ok
Rn im getting this error idk why https://www.toptal.com/developers/hastebin/exuviracoh.properties
Anyone know of a guide for custom mobs in 1.18? I cant find much anywhere
Have you even looked at the plugin name?
your using remapped right?
cause if so you need the md5 plugin to compile
Any idea how much it would cost to get a simple chrome extension custom made?
Sorry if Im just jumping in, but is there ANY way to change the tick rate update from every tick to like every second in Placeholders?
PAPI doesn't do updating or caching, that's up to the provider plugin
okok!!
Hey guys so I have never used the actual plugin on a server but I have made an expansion for it. When I register a placeholder will they be able to use it in configs of other plugins?
b % a
wait
you can just divide?
cant
ah
um
what if you subtract b%a from b/a
if you want to find how many times a fits into b then as tom said you just divide b by a
you're always special to me 😳
if you want it to always round up first make sure it is cast to a double so you don't invoke integer division
and then call Math.ceiling or whatever to round up
||Math.ceil(...);||
hi im very confused on what im doing wrong but I think im checking wrong and I dont know how to fix. heres my code
https://paste.helpch.at/kelubafini.coffeescript
(Also no errors its just sending message on whether or not the player is exsistant or banned)
I am trying to figure out how to create textures and custum model data for my server ive read many guides watched msny videos they were all very unhelpful and/or very specific to being for a world and not a server
Add debug messages in your code
Hello so im making a Minions Plugin that Mine While in a GUI can anyone help explain how i could do this dont need the code just explain how i would do it much appreciated
"Minions plugin", "Mine while in a gui" What do you mean?
So i could put a Minion in a GUi it will spawn a NPC that will Mine for me and store How much the Specific Minion has mined in x Time then auto sell them after x amount of time
Gonna need NMS to spawn the NPC. And make your own pathing methods.
ok
Is it possible for a minion t9oo mine while in a GUi
I mean if you code it lol. Just continue to check the gui for the item
Thats all i need thank you@hoary scarab
np
Am I the only one who is spooked as hell about switching branches in intellij using github
I feel like I might lose a bunch of shit when I do
Btw
Is there any way to merge changes from one branch to another
In case I got a release branch and a dev branch, and I made changes to the release one that I need also on the dev one
sure
target.getPlayer() will always return null
getPlayer
@Nullable
Player getPlayer()
Gets a Player object that this represents, if there is one
If the player is online, this will return that player. Otherwise, it will return null.
Returns:
Online player
@dense galleon Yeah
IntelliJ has an awesome interface
But also it does a great job keeping changes between them
so your method wont work.
Like when I had my forge and fabric bisupported mod it was not problem swapping between the two
what you could do instead is instead of modifying the player on pardon, modify the player on join to change its maxhealth
so have a Set of revived players and then when a player joins see if the player is on that list and if so change their max health to 6 and remove them from the list
save the list to file or database so you dont loose them
how can I add a dependency to my build.gradle with a local file? (located in libs/JAR)
fileTree(dir: 'libs', include: ['*.jar'])
inside the dependencies {}?
cause it appears like it didn't work
^^ with didn't work I mean that I still can't import anything. For context: I am trying to use Statz's API
make sure you add compileOnly before
Hey, a quick question about CompletableFutures
I have this chained future with 3 parts.
The first part maps maps an event in a wrapper, where I have a lot of utils methods, used later on.
In the second step, I acknowledge I received the event, before starting working on the event.
Then in the third step, I should start to work on the event.
However, I need access to the data the first part returns, not the data the second part returns.
Is there a way to access the returned data from the first future in the third stage?
(The second stage returns a CompletableFuture, which I need to wait on)
public void onButtonClick(@NotNull ButtonClickEvent event) {
optionsHandler.getSettings(event.getGuild()).thenApply(options -> {
Ticket ticket = ticketStore.getTicket(event.getChannel().getId());
return new GuildButtonInteractionImpl(event, options, null, ticket);
}).thenCompose(Interaction::deferReply)
.thenAccept(interaction -> {
ButtonId buttonId = ButtonId.decode(event.getButton().getId());
Ticket ticket = interaction.getTicket();
// Do stuff with ticket
switch (buttonId.getType()) {
}
});
}
The hacky solution I can think of, is to store the variable in a final array
public void onButtonClick(@NotNull ButtonClickEvent event) {
final GuildButtonInteraction[] interaction = new GuildButtonInteraction[1];
optionsHandler.getSettings(event.getGuild()).thenApply(options -> {
Ticket ticket = ticketStore.getTicket(event.getChannel().getId());
interaction[0] = new GuildButtonInteractionImpl(event, options, null, ticket);
return interaction[0];
}).thenCompose(Interaction::deferReply)
.thenAccept(aVoid-> {
ButtonId buttonId = ButtonId.decode(event.getButton().getId());
Ticket ticket = interaction[0].getTicket();
// Do stuff with ticket
switch (buttonId.getType()) {
}
});
}
hm
ok ill look at that
so should I just make an array list and just check if the name is in there correct?
how difficult is it to set up to check for update feature in plugins?
There are some utils that you can just copy and it should work straight away
I forked a plugin and it has it working already, just need to to see my Spigot page
any idea on how to spawn a NMS Entity? I have a class that extends EntitySheep and I cant seem to figure out how to get it to show up in the world. It says it is there, with this.getBukkitEntity().getLocation().
how are you spawning it now?
I am not
that is the issue
from what i found
just doing new EntitySheep(World world); is supposed to work, but it doesnt
eh yeah that's the thing, it's not
first you create it, then you add it to the world
addEntity or whatever, i don't know spigot mappings
yeah that is what I was thinking
so im checking with
if (deadnames.contains(args[0])) {
(deadnames declaration)
public static List<String> deadnames = new ArrayList<>();
and im turning the player's name into a player with
Player target = Bukkit.getPlayer(args[0]);
if(target == null) {
player.sendMessage("something is wrong");
return false;
}
But if i run a command which adds the player's name, then I run this command it just sends nothing and gives no error nor does target if sends a message so im confused.
a revive system
like when you do /revive <name> and if the player is "dead" then it removes the player's name from the list and it allows them to rejoin
id recommended a HashSet over an ArrayList cause a Set cannot have duplicate entries while an ArrayList can.
also id recommend that you dont store all dead players, since when they die they are banned.
which stores the players already
storing a set of players waiting to be revived is something you should store.
he is probably doing that
i mean, if player leave, then player is removed ( i guess)
at least thats what my plugin do
is there a way to make a hologram (aka a armor stand with a nametag) have the nametag static, like not move with the player?
maybe with NMS?
doesnt seem to be working

