#help-development
1 messages · Page 916 of 1
I think it’s just CommandSender in bungeecord.
ConsoleCommandSender != CommandSender.
consolecommandsender isnt a method
thats why im asking
that wouldnt narrow it to only console tho
like any other string
^
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
whats the string
1 sec
Oh? What else does it include?
if (value instanceof Map && mapJson) {
Map<String, List<String>> stringMap = new LinkedHashMap<>();
for (Map.Entry<String, List<Object>> e : ((Map<String, List<Object>>) value).entrySet()) {
stringMap.put(e.getKey(), convert(e.getValue()));
}
}
return new Gson().toJson(stringMap);```
oh crap
you cast and it works fine, but thats not that clean
wdym
Would anyone be able to have a look in the thread I created, I have ran out of things to test/change/update to try and solve the issue
one solution is also to just assume something to be of type Type in the variable declaration, and then use a getter to cast it
Hi md_5
Cool to see you 😄
If an api depends on another api do i need to add that into my pom?
normally, no
not if it uses maven
anyone?
sender == ProxyServer.getInstance().getConsole()
Yep
true. forgot i could use ==
mb
You're defo doing something wrong, but I cannot say what without having a look at your jar
also @sullen marlin question. is there cmd label in bungee?
no, because a command shouldnt vary based on the alias used to execute it
what does that mean
what are you trying to do
i have my own cmd api that im converting to bungee from bukkit
and i need label for it
i could prob make my own label system but idk
there are aliases
but you dont get which alias was used in .execute because that is unecessary
theres no usage or description
why tho
how is this always true when reached
| '_" doesnt do what you think
that sets the lowercase bit doesnt it?
You could always Character.toLowerCase() 👀
^
It's waaaay more readable
and works with non-ascii
and underscore is ascii 95 so would definitely blow everything above z, I dont think ascii is bitwise at all
if java had call site inlining sure, but then i might be wondering why im using java in the first place
bruh you're not coding the moonlander in 1965
I was about to say, why be so precise xD
call the method rather than write shit code
are there any strings that are disallowed as PDC namespacedkey ID's? Specifically wondering if 'id' might upset something, below being what I mean
meta.getPersistentDataContainer().set(new NamespacedKey(MLcore.getInstance(),"id"),PersistentDataType.STRING,ID);
no but has to be 0-9a-z_ or thereabouts
that makes no sense why there isnt
like i thought it would be a thing
also arent you really just checking if the char is a-zA-Z, so just do char < a, char > Z rather than the weird uppercasing
hmm, idk whether its a bug or what, but if I set that key to be "id" the item refuses to let any BlockDamageEvent be fired, if I change that single line to just use "item_id" it works fine
also can u not set aliases?
I already told you there's aliases
MLCore.getInstance()? why not use dependency injection >.< and pretty sure using any identifier is fine
can u not setAliases()
oh
Wdym with the String#toCharArray?
there are characters between uppercase az and and lowercase
I shall have a look at that, but for now, I am tryna figure out why on earth the key "id" is so influential
That's one of the fastest methods
anyways said enough
can u unfinal the final?
well use 4 conditions then
It just copies a char array
no
sob
Sup maximus
hi
I do setAliases in my constructor... what is the problem? yes I know harded coded values are ehw
is that a custom cmd api?
Yes my custom cmd api
I made a simple system for that
For spigot
It just directly accesses the command map
Honestly I do not really recommend writing your own when there is this resource but if you want to really make it custom to your liking then surehttps://github.com/aikar/commands
And then synces the commands
If you want an example of how I did it then you can look at my github linked to my discord profile but I am not going to spoon feed :/
Since setAliases is broken
how is it broken?
It doesn't work
are you extending command? what are you extending?
wdym
this is for bungee but yes i extend
I haven't really touched bungee except for TextComponent
to javadocs or builtin commands? PR it yourself
bungee doesnt have a help command so its not really useful
how would i get the amount of damage an itemstack does
Is there a way to make it so player's do not do a sweep attack?
I saw something about generic_attack_speed but that dosent do anything when actually hurting the mob.
does somebody know how i can ensure read - modify - write atomicity with rliveobjects in redisson?
I cant really find the reason but when im using /kit reload it sends "the plugin has may misread the config" and i cant see whats the issue in my code
Config: https://paste.md-5.net/aforutitaz.bash
Reload command: https://paste.md-5.net/kigagivaga.js
What's the stacktrace say?
This is everything thats being sent:
issued server command: /kit reload
[00:37:35 WARN]: [Kits] Default system encoding may have misread config.yml from plugin jar
how would i get the facing of a player but its just
west north east south instead of of the extra things
public static String getDirection(Player player) {
double rotation = (player.getLocation().getYaw() - 90.0F) % 360.0F;
if (rotation < 0.0D) {
rotation += 360.0D;
}
if ((0.0D <= rotation) && (rotation < 22.5D)) {
return "W";
}
if ((22.5D <= rotation) && (rotation < 67.5D)) {
return "NW";
}
if ((67.5D <= rotation) && (rotation < 112.5D)) {
return "N";
}
if ((112.5D <= rotation) && (rotation < 157.5D)) {
return "NE";
}
if ((157.5D <= rotation) && (rotation < 202.5D)) {
return "E";
}
if ((202.5D <= rotation) && (rotation < 247.5D)) {
return "SE";
}
if ((247.5D <= rotation) && (rotation < 292.5D)) {
return "S";
}
if ((292.5D <= rotation) && (rotation < 337.5D)) {
return "SW";
}
if ((337.5D <= rotation) && (rotation < 360.0D)) {
return "W";
}
return "";
}```
thanks
its a pain in the ass finding the proper values lol
okk
isn't there a getDirection() ?
and from there you could get cardinal directions?
eh that's not really scalable code
I remember I once made a lil plugin that just had a list of directions and it used the list size and some math to get what direction you were looking at
That way you can add more directions and it'll just work
whats the difference with getDirection
thats just a vector
you'd still have to discriminate by yaw
thats a very elegant solution
you should be able to get cardinal direction player is facing with the api
there is a total of 8 cardinal directions
public static final BlockFace[] axis = { BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST }; public static final BlockFace[] radial = { BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST };
public static BlockFace yawToFace(float yaw, boolean useSubCardinalDirections) {
if (useSubCardinalDirections) {
return radial[Math.round(yaw / 45f) & 0x7];
} else {
return axis[Math.round(yaw / 90f) & 0x3];
}
}
}```
thsi seems nice
that's cool if you have like
block faces
mine's exclusively for like a placeholder or whatev
don't see how, getDirection will return a float point vector,
seems its not in the api for cardinal directions
must have been removed or something but I am pretty sure you used to get the cardinal direction a player was facing
all well, guess your solution is the next best or illusions
4 years ago
many forget I been here since nearly the beginning of bukkit
im surprised its not a thing with the player's dir on F3 being cardinal
it used to tell you in F3 the cardinal direction
still does
that's prob clientside though
p sure nms has a yaw to blockface method somewher
my car broke down in the highway and somehow I just know it's illusion's fault
I replaced your oil with chicken grease
I think he snuck into my car in the middle of the night~ day and ruined the transmission
I knew it
see you in 15 years in court
lmfao
mark your calendar for my repayment in 40 years
im still waiting for my "come check out the army" letter
ah yeah that would make sense
that's fine if you skip it you go to jail and I can live with that
I also went to my bank like a month ago and asked for physical letters on the mail and they still havent sent me shit
lmao I can already picture the PSP showing up at your door with handcuffs
if you don't do the army day you go to jail
bet you they'd still put you in there
we have a very competent system
you'd be one of the few people who might actually get a better diet behind bars than as a free man
what's wrong with eating one meal every 35 hours
it was fine when I did it for 10 years but now I'm not doing it anymore so it's wrong again
too bad for you
the new hotness is having a nutritionist
why tf are people trying to download literally thousands of versions of kotest
I have a teleportation plugin and when I teleport players they are getting kicked for "flying is not enabled". I know the easy fix is enabling flight on server.properties, but is there a way to do this via code?
// Used to stop console spam of "MOVED TOO QUICKLY"
Bukkit.getScheduler().runTaskLater(
plugin,
() -> player.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN),
1
);
^
Version?
1.20.4-R0.1-SNAPSHOT
U doing other sketchy stuff?
Sketchy? 😭
sussy
;^; sketchy as in like bad or
something we can hold you accountable for
It's an RTP plugin ;-;
What do you guys recommend for dependency injection, guice or just classic old pass in via the constructor
classic
why would you need guice for such things?
Well my project is going to become larger every week and I am just not sure what is the best pattern. I am currently doing a Provider kind of pattern
https://pastebin.com/1tT8Ff3X Example...
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.
Aren't the first and last the same
Idk I just code whatever
If the first and last are the same then why does Guice exist o.O
Well aren't the first and second the same then
There’s only 2
mainly exists for google
anyways the purpose of guice is so that you didn't have to specifically depend on various stuff, and instead it was more centralized.
eh
you're doing this kind of patterns but you still can't follow naming conventions
or follow decent beginner habits like avoiding static
Example?
public static boolean teleport(Player player) {
World world = player.getWorld();
if (safeLocations.get(world).isEmpty()) return false;
Location location = safeLocations.get(world).remove(0);
// Used to stop console spam of "MOVED TOO QUICKLY"
Bukkit.getScheduler().runTaskLater(
plugin,
() -> player.teleport(location, PlayerTeleportEvent.TeleportCause.PLUGIN),
1
);
if (safeLocations.get(world).size() <= getMinLocationsCount())
populateLocations(settings.getAllowedWorlds());
return true;
}
methodsAreNamedLikeThis
CONSTANTS_ARE_NAMED_LIKE_THIS
OnlyClassesAreNamedPascalCase
Oh you mean the static functions should be methodsAreNamedLikeThis
wdym
hm ok
Is it ok to prefer inheritance over composition for only holding data
There's no actual behavior or anything
my code is so good you just can't contain it
also none of it is trash so get that garbage collection out of here
in bukkit u can set them. i dont see why u cant here. i dont wanna do it in the constructor as i have a check
perfect way of saying it's full of memo leaks
you say memo leaks, I say l + ratio + ram dif
just buy more RAM
Just download more ram
just mine raw materials, process them and turn them into ram at your home forge
that kid is probably dropping out of college by now
LMFAO fr
is there a way to tell if a player clicks a display entity
not getting any response from EntityInteractEvent
They have no hitbox, so no.
You could try setting up an interaction entity to be the same size as the display entity, but its kinda hacky.
How do you plan on doing that?
can you tell I'm progressing?
isn't there an interaction entity?
doesn't that have a hitbox?
that's what I was planning to do in a little bit
pretty sure you can't detect clicks in the air though it doesn't send any packets afaik
unless the player has an item in their hand ig
Simply force the player to always hold a pineapple

real question now is there any way to detect keystrokes while passengered on an entity
🥲 looks like I need packets I really wonder if this could just be an event
I think I might actually do it today guys
after like 5 years of having this stream deck I might actually bother to put some programming shortcuts on it
hot reload would be nice to have
... actually I might start this project by printing my own custom stream deck mount first
pretty sure you can since sometimes you can steer ?
yeah but its not a bukkit event it seems
unfortuantely
luckily packet events is so easy
cbf with packets tbh rn just tryna fuck around lmao
One was proposed a long time ago. Not really sure why it got stuck in limbo https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/pull-requests/355/overview
I think it never got updated to provide a clear and sensible API as opposed to just dumping packets into an event
@sullen marlin sry to ping again, but i did this
KEY:
red: old method
green: new method
what are you asking
will the new one work
I feel like this is a TAS moment
whats tas
I'm not here to tell you whether random snippts of code work
?tas
hmmm are you sure I always assumed that's why you were here.
should probably just spam ping forums staff instead 
[07:00:16 WARN]: [ZyptrikBoard] Task #11 for ZyptrikBoard v1.0-SNAPSHOT generated an exception
java.lang.IllegalArgumentException: Cannot translate null text
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:143) ~[guava-32.1.2-jre.jar:?]
at org.bukkit.ChatColor.translateAlternateColorCodes(ChatColor.java:356) ~[paper-api-1.20.4-R0.1-SNAPSHOT.jar:?]
at me.hothifa.zyptrikboard.Utils.color(Utils.java:10) ~[ZyptrikBoard-1.0-SNAPSHOT.jar:?]
at me.hothifa.zyptrikboard.tasks.BoardTask.createBoard(BoardTask.java:37) ~[ZyptrikBoard-1.0-SNAPSHOT.jar:?]
at me.hothifa.zyptrikboard.tasks.BoardTask.run(BoardTask.java:55) ~[ZyptrikBoard-1.0-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftTask.run(CraftTask.java:101) ~[paper-1.20.4.jar:git-Paper-430]
at org.bukkit.craftbukkit.v1_20_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:482) ~[paper-1.20.4.jar:git-Paper-430]
at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1636) ~[paper-1.20.4.jar:git-Paper-430]
at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:447) ~[paper-1.20.4.jar:git-Paper-430]
at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1515) ~[paper-1.20.4.jar:git-Paper-430]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1216) ~[paper-1.20.4.jar:git-Paper-430]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[paper-1.20.4.jar:git-Paper-430]
at java.lang.Thread.run(Thread.java:833) ~[?:?]```
wtf does this mean
the config file is not empty
it says null
wait are configs case-sensitive?
ye
wait isnt that why youre here?
:kekw:
i debugged and it just broadcasts line 0
show code
?paste
which one?
assemble
does it update itself with the teams thing so no flicker or i have to make it?
it updated
// Set Interval (Tip: 20 ticks = 1 second);
assemble.setTicks(1);
assemble.setAssembleStyle(AssembleStyle.MODERN);```
i changed line 0 into 1 and made 1 into 0 and now it broadcasts the new 0
use assemble :D
i create a map, then loop over the lines in config and add them to the map, then i loop the map and put the line with its key (the score line)
😦
?
Fastboard better
fastboard is aids
how
Fastboard is still updated too lmao
I smell skill issues too
fr
hey all, I'm currently trying to figure out how to detect when a villager is "looking for a job" in order to let them check for a new custom block for a custom profession
Don't you love it when you can't figure out why something isn't working for a good chunk of time, just to then realize that you didn't format a string correctly? 💀
Ahh yess
is it possible to use @EventHandler in BukkitRunnable?
Yes. BukkitRunnable is an abstract class that implements Runnable. And Runnable is also just an interface like all Java functional Interfaces.*
I don't need to register it somehow?
You do ofc
You have to register the events of your runnable
And make sure they're removed once your runnable ends. Otherwise it could produce memory leakage
how do I register it?
I am curious, roughly what is the case where you want this?
Through the classic way?
but Listener?
Bukkit.getPluginManager().registerEvents(bukkitRunnable, plugin)
You have to extend BukkitRunnable
In your class where you want to add the listeners
So you end up with a class that extends BukkitRunnable
That class you have to allocate an object of, that you can then register
how do I un-register the event handler, or will it do it itself after this.cancel();
[11:44:02 INFO]: sumeru2 died
[11:44:04 INFO]: UnloadChunkEventx: 39z: 62
[11:44:04 INFO]: §b§lArcade
[11:44:04 INFO]: UnloadChunkEventx: 40z: 61
[11:44:04 INFO]: §6§lOITC
[11:44:04 INFO]: have npcs
[11:44:04 INFO]: LoadChunkEventx: 40z: 61
[11:44:04 WARN]: net.minecraft.server.v1_12_R1.CancelledPacketHandleException
[11:44:04 INFO]: §6§lOITC
[11:44:04 INFO]: have npcs
[11:44:04 INFO]: LoadChunkEventx: 39z: 62
[11:44:04 WARN]: net.minecraft.server.v1_12_R1.CancelledPacketHandleException
[11:44:04 INFO]: §b§lArcade``` https://pastes.dev/hZNRJA5oBi please help when a player teleports between worlds with command or dies through / kill, the NPCs disappear, although events are triggered in the logs, if the the player rejoin, or if he teleport through the portal of mini-games to another world, they will also be visible
They don;t really exist so you have to send their creation packets to the player again
When does a player change the world and respawn?
send packets again?
if the name of the NPC is written in the logs, then they exist
[11:44:04 INFO]: have npcs```
If they are packet based NPC's the server does not know about them
that's why I use npcmanager
so what should I do to solve the problem?
and thats why you have to send the right packets as needed
I already told you how to fix it
I don't understand, I already sent the packets when loading/unloading the chunk.
if the player dies, respawns or teleports you shoudl send the add player/entity data packets
ok. thanks
by the way, why did you say dies, respawns. maybe only when respawn?
looking back on some old code and this is just...wow. ```
if (executor.isForPlayer() && executor.isForConsole())
executor.execute(sender, args);
else if (sender instanceof Player && executor.isForPlayer())
executor.execute(sender, args);
else if (sender instanceof ConsoleCommandSender && executor.isForConsole())
executor.execute(sender, args);
probably what happens when you code for too long without breaks
something tells me one of these isn't quite right
my guess is the first one
what in holy god does this even achieve
lmfao
lmao
How slow will reflection be if there are more than 20 created annotations in class fields?
when it comes to creating large plugins, is there any real value in splitting it up into multiple projects/plugins? I have the main plugin, and I want some functionality on the side that will listen for rabbitMQ messages and triggers functionality within the main plugin. Is there any real reason to have this queue listener in another plugin and have the main plugin as a dependency, or is it generally easier to just bundle it all together
If its a very large scale plugin, yes it's 100% worth splitting it up.
Firstly, if one thing in your plugin breaks, your whole srver breaks. Maintenance is a lot easier with multiple plugins as well as testability
If it's just going to be messaging the main plugin it might as well just be in it. The only reason to make something 2nd party is if it's standalone.
you don't necessarily need them as separate plugins. There is value to separating stuff though into their own modules or projects to shade into one plugin though
however, the benefit though if you could split into another plugin, is if its something that can function on its own
the benefit is not having everything else with it for that one thing
SRP principle definitely is applicable here
yes, now that I think about it, it won't work without the main plugin, so I think it makes sense to just leave it all together
I ran into such a problem that it finds NPCs only in the chunk where you teleported or died and not in the chunks around where the npcs are . I have a working method for getting chunks around a player in a certain radius, but is it too unproductive to get all the chunks around player?
when the player respawns, I don't need to send packets right away, right?
I need a runtasklater
otherwise it won't work
and do I need to do this when an player dies or only when respawns?
respawns
i have to check if player is under specific Y and better to use is task or move event?
I have a runtasklater with 40 ticks right now. maybe a schedulesyncdelayedtask is better?
Tepends on how granular you want this. But checking an integer for a limit is done in a few micros, if not a few hundred nanos.
So dont worry about it.
I am confused
linux
fucks up
my characters
but windows does not
what the hell
On windows
On Linux
👍
(it should be noted that this happened when I stored every line and then wrote it back in alongside new lines)
like this
CHARSET is utf8
now I know
uhh, but I also need to read an InputStream
so I can't change it since it only accepts a Path
what other types of input streams do u accept?
tis
only this
I'm mostly confused as to why it only happens on Linux
lemme try this
Sometimes it’s literally just the thing you are using to view the file
Yea well, in any case, zipfilesytem is rly nice
Cat the file and see if it’s the same
that too ^
I see you’re using notepad so im assuming you’re ftping into it
cat filename just prints the content on the linux terminal
ah you mean the viewing application?
that's not it
I made sure
it affects minecraft messages as well
and it shows up polish characters normally in files I don't read and then rewrite
Oh thats very strange
you ensured notepad was using utf8?
because generally it uses ANSI
because its for the latin character set and the windows default
its always been like that as far as I can remember
anyways, just tell notepad to read it as utf8 lol
well another mystery solved

well I just changed the characters to polish
ah another knowledge to bestow on you then
and it now does this
yeah so, if you edit files on windows, it changes the line endings and what not and causes the lines to technically not be correct
so you need to fix that on linux side
uh
what
yeah, fun games with windows and linux you know
anyways, there is a program on linux you can use to change it back
so install dos2unix
uhhhhhhhhhhhh
just so I could read an utf8 file?
yeah, so you also copied the line endings
ooh
windows and linux disagree with these things, its dumb
uh, idk if notepad lets you see hidden characters
can't I just change something here?
probably could I suppose
I wouldn't want others having the need to install programs just because they use linux
most even can't
so first things first
you need to detect which type of OS they are using
Windows, Linux, and Mac
because all three have different line endings 🙂
what about this?
Windows uses \r\n Linux is \n and Mac is \r
why do you have a method name ends with 0...
I like it
it's what the java devs do all the time
so, all you have to do is once you detect which OS they are using, replace all the line endings with the OS appropriate ones
it's old thing and it was being used for native private methods, not public static ones?..
like Reference
SHHHHHHH
uhhhh
I'll check this out first
public static void setBlockInNativeChunk(World world, int x, int y, int z, int blockId, byte data) {
net.minecraft.server.v1_12_R1.World nmsWorld = ((CraftWorld) world).getHandle();
net.minecraft.server.v1_12_R1.Chunk nmsChunk = nmsWorld.getChunkAt(x >> 4, z >> 4);
BlockPosition bp = new BlockPosition(x, y, z);
IBlockData ibd = net.minecraft.server.v1_12_R1.Block.getByCombinedId(blockId + (data << 12));
nmsChunk.a(bp, ibd);
org.bukkit.Chunk bukkitchunk = world.getChunkAt(new Location(world, x, y, z).getBlock());
world.refreshChunk(bukkitchunk.getX(), bukkitchunk.getZ());
}
for (int platformRow = 0; platformRow < 4; platformRow++) {
for (int platformCol = 0; platformCol < 4; platformCol++) {
for (int rowIndex = 0; rowIndex < 16; rowIndex++) {
for (int colIndex = 0; colIndex < 16; colIndex++) {
DyeColor randomColor = colors.get(random.nextInt(colors.size()));
PartyUtils.setBlockInNativeChunk(Map.party, (int) (Data.firstPlatformBlock.getX() + (platformRow * 16) + rowIndex), (int) Data.firstPlatformBlock.getY() - 1, (int) (Data.firstPlatformBlock.getZ() + (platformCol * 16) + colIndex), 35, new Wool(randomColor).getData());
}
}
}
}``` why are the players not visible?
that should work
I'm making a colormatch mini-game, and settype is too slow, so I had to resort to this method, which works faster, but the players are not visible
it may not be worth updating the chunk on each block?
can someone tell me why the players may be invisible?
did the file encoding change?
o.O
because bufferedreader readline should be able to handle the line breaks regardless of OS
it's still recognized as ansi by the notepad
probably because the file didn't change
notepad always defaults to ansi
cuz the error was thrown before it could
it
ye
I can't read that
this just means: "Error loading file: (...) with the usage of UTF-8. Return to 1250 ANSI."
interesting
probably the issue then
yeah, and the messages are still being turned into gibberish
I don't use winscp
I always use filezilla
mainly because you can tell filezilla to automatically fix your files
so, like if I am on windows it will temporarily change it for windows and then when saving back to linux it reverts it etc
it crashed whenever I tried to delete a world
or rather it just refused to work
you seem to have some rather bad luck
or just terrible at using software >>
anyways, you can't delete files that are in use
then perhaps a permissions issue? Or you thought the server was off but really it wasn't
The only reason I switched from filezilla to winscp is because filezilla burns my eyes with that light theme
I tried it several times
on seperate days
making sure it was always off
and it always just refused to work after that, so I had to restart the app
I'm a root user
now it just
uh
the plugin isn't building
wtf
you really are unlucky
cuz the error was on a catch (Exception e) { line
I guess you are never short of work I suppose
wtf
very much
probably shouldn't be catching Exception
that is a generic type
it will literally catch everything
does somebody know where i can find my meta-inf in intellij?
that is generated by the compiler
well, not errors
I used to do catch Throwable
uh so
good news
the plugin now loads
why does cmd say my jar has no meta-inf?
what cmd?
bad news is that the text is still turned into gibberish
You have to configure it inside your build tool
Anyone know how to stop a Written_Book from displaying its generation? I tried to set it to null using BookMeta but it didn't seem to do the trick
Don't think its possible to stop it from displaying its generation
maybe ItemFlag HIDE_ATTRIBUTES?
highly doubt it tho
?
java is weird
a char is an int and all non-decimal numbers are ints by default
wait its overflowing its byte range
was optimizing a lookup table from 65k bytes to 122
hmm are these javadocs a bit understandable?
https://paste.rs/a75ic.java
paste.rs is a simple, no-frills,
command-line driven pastebin service powered by the Rocket web
framework.
its kinda difficult explaining complex data layouts
full class, im also thinking about a better name for ValueHoldingNode, its not really a leaf node as it still has children
https://pastes.dev/OQqbS67RKA
guys does some1 know how i can make my own annotation that works like the @eventhandler so i can habe my own eventsystem?
no :(
annotation processor 👅
Yes
@young knoll You have time for a PR which exposes getMatrix() in the bukkit Transformation?
I have to manually convert them currently and im too lazy to setup the spigot project rn 🙂
Reflections should be enough for that. You need to read all methods from a Class<?> object, and only get those with an annotation.
how do i make is so the method get blue too?
Intellij usually suggests you something along the lines of "treat methods annotated with @Whatever as implicitly called"
okay
Give me an hour
Seems like a long time to make a simple PR :p
No pressure. I got it working and im not touching any matrix transformations as soon as they work.
lol
Thx copilot. Now we are both confused on what my code does...
:P I just woke up
In a runTaskTimer that does something every 60 second, how can i do that it stop doing it?
just cancel the task
how?
does this work ?
https://paste.md-5.net/uyefomenaz.coffeescript
Code it
i mean for saving the player items, do i use the persididietent (idk how to spell it) data container, or a file
or both
what do you think is best I mean its your plugin.
omg no way is that the contributor of Totem
I mean I'd probably use PDC but that doesn't mean a File is bad
ur a bit weird for wanting to use pdc there
not really its how the player inventory is stored
and enderchest
ill bookban a player with a playervault
I'd store it in NBT though
im new to this, idk whats good and whats not xD
Is there a way to know whether a GUI was "forceclosed" or closed by the player (e.g. by pressing ESC)?
I know paper has it but is there a way to find out in spigot?
huh
Well if the player dies, a new inventory is opened or a plugin calls closeInventory() that's what I'd consider a forceclose.
save what gui was closed, and wait for 5 seconds and if player dies within that time do stuff
no you'd have to check the events that would do that
Hmm guess I'll just store the GUI session until the player either dc's or starts a new one then
is there an event for when you have mouse on the inventory slot then you click any of your hotbar's number on the keyboard and it moves the item on that slot
InventoryClickEvent
check the action or the clicktype or whatever it was, iirc it also gives you the tapped number
i already have listener for that. when i click the item with a normal mouse click the code in the listener works. if i do it with keyboard numbers it doesnt
i don't think it'll send a packet if the slot is empty could be wrong tho
it only does if its classified as a quick move. It'd be hard to quickmove nothing into nothing so Its probably just a nice shortcut
it should still fire in survival mode
if both are emlty
but even then, the click event is the one that fires
How can I make it when water flows and if it breaks a block (seeds for example) it won't drop the block if it can actually drops it (when u put water on wheat seeds it just drops seeds)
im trying to learn how to make plugins but ran into this issue, does anyone know how to fix it? https://i.imgur.com/90dccc3.png
i used this code:
Inventory inv = Bukkit.createInventory(p, 27, Color.RED + "Benny's gui");
ItemStack items = new ItemStack(Material.DIAMOND_BLOCK, 1);
inv.setItem(13, items);
p.openInventory(inv);```
but the gui title doesnt become red it becomes whats in the image instead
ChatColor*
do you know what Color is for then?
declaration: package: org.bukkit, enum: ChatColor
Hi , uhh iam getting a weird bug so i made a levels / rewards system with gui and ..
when user click on it , it is claimed ..
and that works just fine
ty btw
The Color you're using is probably from the java standard library, it has nothing to do with text coloring in spigot
oh alright thanks
my problem is with the levels that user didn't get yet
i can still click on it , and get the reward but how is that ? user didn't get to that level just yet!
you should probably put it in one message next time
sorry
im not sure how to help but im guessing theyll also need the part of your code thats managing this stuff
I have a question about the mechanics of minecraft why the nether armor is repelled
the lore said this is level 1 lol
nvm about it , its copy paste from lvl 1
it have a config for levels and i didn't have time to change the lore for every level ..
Bump
How can I make it when water flows and if it breaks a block (seeds for example) it won't drop the block if it can actually drops it (when u put water on wheat seeds it just drops seeds)
just asking if my sql part is wrong?
ideally you only need the uuid to find data as the uuid should only exist once
and you dont need to twr the result set
so how the system is working rn is :
player get exp , and he lvl up lets say from lvl 1 to lvl 2
in database it will instert :
uuid , 2 , false
which means user did get to lvl 2 , but didn't claim the rewrard ,
in the reward lvls gui , when a user click on the lvl he reached it will change false to true , so :
uuid , 2 , true
means player claimed it and can't claim it again
idk if its the best aproch
oh nvm fixed it
somebody help
I'm going insane
all of my polish characters are getting
GIBBERISHED
only on linux
it shows this
instead of like this
when I read and then write it
weird
it works just fine on windows
private static final Charset CHARSET = StandardCharsets.UTF_8;
Can you send the file? I want to test it with my setup and compare it with some polish language files I already have.
public static void readLines(File file, Consumer<String> consumer) {
try {
readLines0(file, consumer);
} catch (IOException e) {
throw new AlixException(e);
}
}
public static void readLines0(File file, Consumer<String> consumer) throws IOException {
readLines(Files.newInputStream(file.toPath()), consumer);
}
public static void readLines(InputStream is, Consumer<String> consumer) throws IOException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, CHARSET))) {
//Files.readAllLines(
String line;
while ((line = reader.readLine()) != null) if (!line.isEmpty()) consumer.accept(line);
}
}
public static void write(File file, Collection<?> lines) throws IOException {
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file, CHARSET))) {
for (Object data : lines) {
writer.write(data.toString());
writer.newLine();
}
}
}
oh
well you could just try
ąęłóśżź
pretty much all special polish chars
does anyone know how to avoid nullpointerexceptions? im trying to make a gui for my plugin but
if (e.getCurrentItem().getType() == Material.DIAMOND_BLOCK)
gives nullpointerexception if its an empty slot that the player is clicking
does anyone know how to avoid this?
if (e.getCurrentItem() != null && e.getCurrentItem().getType() == Material.DIAMOND_BLOCK)
This is what I get when I run this code.
like I said
oh alright ty, i tried getcurrentitem.gettype != null didnt think about this
.
I am on linux.
wat
my testing server is on fedora linux
What java distribution do you use? OpenJDK? Azul?
try writing a duplicate of what you read from the file
oracle
so prolly openjdk
What's java --version ouptut?
Soo, slightly modified. Same results though.
uhhh
well when I open the file
where the messages are stored
it says "ANSI 1250 Central Europe"
And when I change it to UTF-8 it says that
the file could not be loaded
and must be changed back to this
like in the created file on linux
on windows it shows utf8 tho
What's the output of file -i <your-txt-file>?
how i can change the help message on aikar?
what's the file seperator on linux again
doesn't seem to find the file
wut?
Is that where the file lives?
public class CustomEntity extends EntityZombie {
public CustomEntity(Location location) {
super(((CraftWorld) location.getWorld()).getHandle());
this.setPosition(location.getX(), location.getY(), location.getZ());
Zombie craftZombie = (Zombie) this.getBukkitEntity();
this.setBaby(true);
ItemStack itemStack = new ItemStack(Material.WOOD_HOE);
this.goalSelector.a(0, new Goal(this, location.add(10, 0, 0), (float) 1));
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setUnbreakable(true);
itemStack.setItemMeta(itemMeta);
craftZombie.getEquipment().setHelmet(itemStack);
craftZombie.setSilent(true);
craftZombie.setInvulnerable(true);
craftZombie.setAI(true);
craftZombie.setCustomName(ChatColor.translateAlternateColorCodes('&',"&4&lCustomEntity"));
craftZombie.setCustomNameVisible(true);
craftZombie.setRemoveWhenFarAway(false);
}
public void spawn() {
this.getWorld().addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM);
}
protected void initAttributes(){
super.initAttributes();
this.getAttributeInstance(GenericAttributes.ATTACK_DAMAGE).setValue(10.0D);
this.getAttributeInstance(GenericAttributes.maxHealth).setValue(100.0D);
this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED).setValue(1.0D);
}
}
public static void registerWithoutID(String name, Class<? extends Entity> clazz) {
MinecraftKey key = new MinecraftKey(name);
EntityTypes.b.a(key, clazz);
if (!EntityTypes.d.contains(key)) {
EntityTypes.d.add(key);
}
}
registerWithoutID("Custom", CustomEntity.class);```please help, my custom nms entity is not visible
1.8.8?
1.12.2
You should be able to convert it using iconv -f ISO-8859-1 -t UTF-8//TRANSLIT input.file -o out.file
how do I make this stuff compatible?
can I somehow do it in java?
i think you need id
I would like to solve it for all users that could encounter this issue
fr33styler, did you leave spigotmc discord server?
ye
why
how do I register with an id?
Real quick, what's the output of locale?
Ok, so not a system issue. At least what it looks like.
still not working public static void registerEntity(int id, String name, Class<? extends Entity> clazz) { MinecraftKey key = new MinecraftKey(name); EntityTypes.b.a(id, key, clazz); if (!EntityTypes.d.contains(key)) { EntityTypes.d.add(key); } }
@Override
public void registerEntity(Class<?> entityClass, String name, int id) throws Exception {
RegistryID<Class<? extends Entity>> registryID = regName.get(EntityTypes.b);
Object[] idToClassMap = regID.get(registryID);
Object oldValue = idToClassMap[id];
registryID.a((Class<? extends Entity>) entityClass, id);
idToClassMap[id] = oldValue;
}
try it like this
private static ReflectField<RegistryID<Class<? extends Entity>>> regName = new ReflectField<>(RegistryMaterials.class, "a");
private static ReflectField<Object[]> regID = new ReflectField<>(RegistryID.class, "d");
cant find ReflectField class
it's a class of my own
it's just a field chacher
the constructor input is the class and field name
Is there a way to change the attack distance of a mob?
modify the finder pathfindergoal
public void registerEntity(Class<?> entityClass, String name, int id) throws Exception {
Field regName = RegistryMaterials.class.getDeclaredField("a");
Field regID = RegistryID.class.getDeclaredField("d");
RegistryID<Class<? extends Entity>> registryID = regName.get(EntityTypes.b);//how do I fix this?
Object[] idToClassMap = regID.get(registryID);//and this
Object oldValue = idToClassMap[id];
registryID.a((Class<? extends Entity>) entityClass, id);
idToClassMap[id] = oldValue;
}```
@kind hatch
do you know perhaps
how I could get this output with java code?
@grim hound Maybe try using a FileOutputStream and OutputStreamWriter instead of a FileWriter?
try {
FileOutputStream fileOutputStream = new FileOutputStream("src/main/resources/localeOLD/locale_pl.yml");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, StandardCharsets.UTF_8);
BufferedWriter writer = new BufferedWriter(outputStreamWriter);
writer.write("ąęłóśżź");
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
I didddd
FileWriter is kinda old.
cast
but the reader
Are any new files you create with java having this issue or is it just this one file?
seems to also misread the characters
well I've only had to use polish chars here so I'm not sure
so ```java
public void registerEntity(Class<?> entityClass, String name, int id) throws Exception {
Field regName = RegistryMaterials.class.getDeclaredField("a");
regName.setAccessible(true);
Field regID = RegistryID.class.getDeclaredField("d");
regID.setAccessible(true);
RegistryID<Class<? extends Entity>> registryID = (RegistryID<Class<? extends Entity>>) regName.get(EntityTypes.b);
Object[] idToClassMap = (Object[]) regID.get(registryID);
Object oldValue = idToClassMap[id];
registryID.a((Class<? extends Entity>) entityClass, id);
idToClassMap[id] = oldValue;
}```
I'd try testing this first to get some more info on the problem.
public static void readLines0(File file, Consumer<String> consumer) throws IOException {
readLines(Files.newInputStream(file.toPath()), consumer);
}
public static void readLines(InputStream is, Consumer<String> consumer) throws IOException {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(is, CHARSET))) {
//Files.readAllLines(
String line;
while ((line = reader.readLine()) != null) if (!line.isEmpty()) consumer.accept(line);
}
}
``` how do I change the reading tho?
try it
I'm 95% sure it'll appear in any file I rewrite
also, nothing will spawn
Reading seems to work just fine.
wrong id?
on CustomEntity monster = new CustomEntity(event.getPlayer().getLocation()); monster.spawn();
it has to match the og entity's id
registerEntity(CustomEntity.class, "Custom", 120);
after debugging the message read
is this a new entity?
it just shows some squares
and not the polish chars
I made sure my terminal supports polish chars
no entity class code above
so the issue probably lies in the reading
bros ł became ⬜
.
nie
no kurwa
make sure it has zombie id
nie kłam mnie
120 sounds too high
no idea what that means xd
for zombie
bro you just replied in polish
ik lmao
You could try an alternative java distro.
sneaky bastard
entity need to have a zombie ID? I thought i could set anything
this is how spies are born
so tis a java problem?
I've already infiltrated your government.
I am the government
you've entered me
wait-
no
Possibly, but I'm not sure. I'd want to test it with another version of java just to make sure.
no homo
nope
old minecraft is weird in that aspect
It looks like you have the plain oracle java, which is weird considering most linux distros ship openjdk, but fedora does what it wants I guess. ¯_(ツ)_/¯
I have both OpenJDK and Azul on my system though.
zombie have id 54
set it to that and you're good to go
How did you install your current java?
free oracle cloud server creation
not on oracle
still
amma force it with some good ol' java code
Well you'll have to search the repos for the exact package name using: sudo dnf search openjdk
Then you'll install it with sudo dnf install java-19-openjdk.x86_64 Assuming that's the package name format
You may also have to update your system to use that java version as the primary.
sudo alternatives --config java
installing the aarch64 one
aarch64? my phone uses that
is it that good
no idea
lol
If I create an EntityArmorStand as shown in the print and then use entityArmorStand.getBukkitEntity(), will this method create an entity that will no longer be fictional in the world?
Try it and see
my server is local
yes
getbukkitentity is not registering anything
it just does a lazy load of it's bukkit/craftbukkit classes
I didn't understand
thanks it works. I have a npc plugin, can I take the code from there and send player packets for this entity so that it is seen as a player?
how do I cancel the entity creation packet and send my own?
I need to teleport an EntityArmorStand, but there is no teleport method. What do I do?
lazy load is for when it does a null check and bukkitEntity = new CraftWither(this) and then returns
I can't use getbukkitentity, as it creates an entity that will no longer be fictional
that's simply not true
the registration happens only if you register the entity in the nms world
so i can use getbukkitentity?
of course
ok thank you
ah i understood you wrongly then
ye
I thought I asked the opposite and since you said "yes" I thought I couldn't use getbukkitentity 😂
just look in the methods and see which one is which, or even listen on packet sends and filter it that way
So should I do this? new CraftArmorStand(server, (EntityArmorStand)entity)
1.8 is highly unsupported.
to avoid checking multiple instances?
What do you need the Bukkit Entity for?
I'm already clear
which packet should i handle? ```java
public static void injectPlayer(Player player, NPCManager manager) {
ChannelDuplexHandler channelDuplexHandler = new ChannelDuplexHandler() {
@Override
public void channelRead(ChannelHandlerContext channelHandlerContext, Object packet) throws Exception {
super.channelRead(channelHandlerContext, packet);
}
@Override
public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {
if (packet instanceof PacketPlayOutSpawnEntuty) {//this?
}
super.write(channelHandlerContext, packet, channelPromise);
}
};
ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().playerConnection.networkManager.channel.pipeline();
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
}```
for some reason i didn't remember getBukkitEntity to be such a mess
the first reply is when the characters are this weird gibberish
the second is when I change them into the proper polish chars
It usually just gets a mapper function from the type data and converts it lazily. Not a huge mess.
i see
Im trying to store an instance of EnderChest, and then #close() it at a later time, the chunk is still loaded but its not closing?
at least from a player standing right next to it its not closing
if(blocks.containsKey(p.getUniqueId())) {
EnderChest echest = blocks.get(p.getUniqueId());
if(echest == null)return;
Bukkit.broadcastMessage("Closed");
echest.close();
}```
the object is org.bukkit.block.EnderChest
it depends on what kind of packet
if it's out write if it's in read
but as 7smile said, we shouldn't support 1.8.8
does anyone know how to get the golden shovel with grief protect
any gold shovel can be used?
Yeah any gold shovel should work by default
ah thanks for the hot tip
Anyone want to start a server with me lol
Can anyone suggest an updated GUI library?
No
Well sure actually
My rate is 25 an hour
Is it the same for tutoring?
I'll tutor for 20 an hour
Is there a new version of this https://www.spigotmc.org/threads/tutorial-skulls.135083/#post-1432132 because Material.SKULL_ITEM doesnt work anymore its depricated
It all depends on what kind of you need. Do you need a static gui or a animated one
what is this?
delete it contains someone / yours ip
That looks like a private ip
it doesn't
you forgot to turn on something in the spigot.yml
it's a proxy
ye
192 is always private
I'm developing my antibot
that i know but the first ip
and found this stresser
but it doesn't do anything but this
channel.writeAndFlush(Unpooled.buffer().writeBytes((new Handshake(XDDOS.protcolID, "1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1......\u0000.\u0000f84c6a790a4e45e0879bcd49ebd4c4e2", XDDOS.port, 2)).getWrappedPacket()));
channel.writeAndFlush(Unpooled.buffer().writeBytes((new LoginRequest(this.randomString(14))).getWrappedPacket()));
``` this is what the crasher does
for this
:0
well it's the hostname aight
my 3 braincells are exploding
Hey, does anyone know which packet sends blocks to the player? I am assuming it's not the "ClientboundBlockUpdatePacket" because there would be a lot of packets at once. But can't find any with a list of blocks?
but the thing is
yes
yes what? hahah
ClientboundBlockUpdatePacket is probably for singular blocks
where's (or what) your question btw, I've worked with this packet a lot
so did I
The question is
why does the server say that the hostname is invalid
since it shouldn't care about it
proxies are not notchian are they?
I also didn't find anything in the handling made by HandshakeListener
Makes sense will try
I mean, regular servers don't care (spigot, paper, whatever). If bungee does there might be something else
Actually
Is it possible to make a npc do certin job using chatGPt?
so my idea was spawn a type of npc ,
KILLING_MOBS,
FISHING,
CAVING,
LUMBERJACK
and when it spawn , it will use chatGpt , to do its job , so it will look for woods and cut it , etc is it possible?
i want to make it fully ai based
Bungee does care, you can set pvp1.example.com to go to 192.168.0.20 and lobby.example.com to 829.213.321.412 (not real xD)
Needs to support timers in lores so I guess animated ?
but I'm not using a proxy server
it's a paper server
I thought it was
maybe it has something to do with \ characters?
I can't find the code for that anywhere
you can try removing the characters and maybe isolate the issue (prob not)
I cannot currently recompile that jar
I only decompiled it online
oh I have a proxy I can modify but can't do it right now
Like I was saying, this isn't a proxy server
Ik, I was referring that I have a proxy that uses a fake handshake to connect to servers
net/minecraft/server/network/HandshakeListener.class
have you really looked into it?
Pattern is [0-9a-f.:]{0,45}
idk which one is split[1] (probably not this one), but the . of the second one also matches
But it's technically unreadable (everything is private) "ClientboundSectionBlocksUpdatePacket"
How do I make other mobs agro on my invulnerable custom entity?
can nms read packets that the server sends to the players? (and cancel them if needed)
Well yeah they have to be sent some way or another
