#help-development
1 messages Β· Page 813 of 1
this u?
yeah?
did lynx come up with it
No no
Right now you can enter the command, but when you type the first letter, you can't enter it anymore, can this be solved?
@Override
public List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args) {
if (args.length == 1) {
List<String> matches = new ArrayList<>();
for (String subcommand : WHITELIST_SUBCOMMANDS) {
if (subcommand.startsWith(args[0])) {
matches.add(subcommand.toLowerCase());
}
}
return matches;
}
return ImmutableList.of();
}```
The log console
created on each player command
I mentioned playercommandpreprocessevent
Because I meant a player
I'm already doing that
But there can be an easier way
I'll just cancel the packet I guess
I was planning on doing that anyway
Oh you don't want just to cancel log
But if it's a command I need, I'll just process it's contents on my own
Yeah, but that was the thing that wasn't getting cancelled
In the player cmd event
have you considered setting commands.log to false in spigot.yml?
me fr
where can i hire developer ?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
thank you
if (bukkitGenerator.shouldGenerateNoise())
vanillaGenerator.generateNoise()
bukkitGenerator.generateNoise()
with name or uuid ?
Both but name deprecated
If your focus on cracked then do not use uuids
At all
aight ty
The UUID is based on the name
in offline mode
so why do you need a player that doesn't exist?
I actually need a player who has joined the server before
Then get the player by uuid
for get skulls
well player heads is steve or alex when offline
only if it's an invalid UUID
im getting players from db and i save players with name not uuid
it has to be a Valid Mojang account UUID to get a skin
You will stop supporting me after what I said.
i work for offline server
if you are in offline mode and still want to use Mojang skins you will have to use a skin api
also skull might be broken in offline mode since it won't fetch skins
since you know offline mode is inteded for use when offline
understood but can i do this with tlauncher or skinsrestorer ?
SkinAPI is old but it has a github https://www.spigotmc.org/resources/skinapi.64167/
1.7 to 1.13
ah im 1.16.5
then why the hell are you using offline?
my market is there
you cna still look at teh SkinAPI code and see what you need to do for 1.16
it uses an external website to upload skins
aight i check ty
No point in roles
you could ban people π
safer for me to not have ban access π

theres a couple I would have been tempted to kick
but you deserve
theres a load of people here that should probably have helper but its up to md's discretion to give them the offer
I mean that and we probably don't need a ton of helpers
oh and that too
our dear little cutie @young knoll is irrepalceable 
helpers are really everyone. Being flagged as a helper means you get pinged to deal with trouble.
are discord helpers hydra, 1 head was cut off (imajin) 2 grew back (coll and smile)
factz
how do I make player specific guis
like custom ender chests
what should I use to store contents
pdc if its small, database if its large
database ?
you can actually probably go with PDC here like mojang does
probably yea
couldnt saving it to pdc book ban people if the packet is too big
That or an NBT file
entity PDCs are not synced to the client
Mojang saves Chests to PDC and Enderchests to player pdc
I generally want to make similar progression as Hypixel does with crafting mining etc.
it'll be fine
so like gui_name:playerUUID ?
if its on the players pdc no need to save the uuid on it
gui_id:data
probably a byte array through nbt
wait you can give pdcs onto players directly?
yes Players extend PersistentDataHolder
yeah?
I mean, you will still need to cache the inventory somewhere
Player#getPersistentDataContainer()
like, handle the read/write from/to PDC
which reminds me I still need to do that ByteSerialization API for Some Classes in Bukkit
I think they just have ListTag
i havent actually looked at the byte array stuff through nbt yet so y2k explain how it works
not a list
maybe using database would be easier since I already have one
oh that's what he meant
Imho Binary Storage is better here, but you do you π
100010110101001010010100101111011010010111011110110111111110111110101000101000101010100101
how should I proceed with custom crafting recipiest that are locked behind condition
library of babel but binary
like bool PDC on player that's true/false?
οΏ½
why is the message empty
it won't let me send that unicode character xD
funny it just replaces it with nothing
οΏ½
GUH I have class today WTF I wanted to chill at home
no I have finals coming up and a lot of my grades are on the line, if I do well I can prob still get straight A's
when the fuck are finals
4.0 for 2 college semesters would look great on my applciation
what do these grades even give you
you say coming up but someone else says finals in november π
Better chance to get into the college I want xD not much more than that
once I actually get into a college they mean much less but right now I'm still in highschool fighting to look semi good on my application
what are you gonna do in college
maybe college/highschool dif
ig im too used to final exams having the only meaning in recognision for uni
4.0 seems pretty average
whats ur scale
1-6?
1-4
tf
I'm currently a CS major with no emphasis
where are you even from
Once I get accepted I'm doing CS with an emphasis in Embedded SYstem
since when Switzerland is US
the us cheese land
my state is popular for its cheese
not eu cheese land
i have to enable 2fa to post resource updates but i dont trust myself with the backup codes
if you're going large scale with player data probably best off using some sort of SQL datatabase with a table
I doubt that every player having 30+ PDCs with bools is a good idea
write them down On paper like id id
and you think ill keep track of the piece of paper too?
I hate 2fa. I didn't store my codes.
so make separate table for playerRecipes and fill them with Recipe no. X that would store True/False and each row would represent UUID?
pretty much I thinks
idk I never use SQL but probably :P
yeah that sounds okay
can someone give me a code advice for that?
this one
is good
i love it
isnt that smile
yes it is
seems credible then thank
i really like it
Its system is understandable and i use it
even chrome gives up when making a request
Its more than 6 seconds on making a request
And well, isnt the appropiate
it does work and checks the db and stuff, but its super slow, so can someone help me?
cache the data
yeah i was thinking that
but i still think is the server taking so much, not the connection to mysql
do you know u just sent ur login info and also the info of where the server is runngin
you probably would be best to do some testing on a seperate table with a differnt local only user that is the only one with access to the table
yeah maybe
yo @remote swallow
just did of the cachΓ© stuff
still slow
its the code
cause the domain its ok
dm me or send a request here, it might be ur internet being slow
NGINX is better
Apache πͺ
Nginx can suck a popsicle I have currently stored within my freezer
y2k fight me bitch
https://haste.miketheshadow.ca NGINX gang
Sockets
Apache gang
https://maven.miles.sh
nginx gang
https://repo.epicebic.xyz/
Skull emoji
nginx gang
https://paste.epicebic.xyz/
Hello, is there any other option to display a TextComponent in a bossbar rather than use packets?
Not on spigot
If youre on redacted fork you can
okay thx!
This is coming soon though Choco has been hard at work
on spigot rly ? wtf
okay nice
Yeppers
I'd expect either in early 1.20.3 or 1.21 at latest if everything doesn't break :P
I'm not good at mathematics, but whoever studied this topic can you tell me what the 3rd version of uniform randomness is based on? https://github.com/DailyStruggle/RTP/wiki/Why Personally, I only understood option 2 where the square root is used
which event is called when placing an Item Frame?
I believe its HangingPlaceEvent
Spigot docs say "triggered when hanging entity is created in a world" Which I assume references the placing of a hanging entity
I never messed with item frame placement or the method of handling placed item frams lol so I could be incorrect
no problem!
yeah its correct
The issue that I'm having is with the set player coins logic either within the setPlayerCoins method, or the onCommand method. For some reason when i type /mb balance set <name> <amount> it will send me the message in chat that I have set the <players> balance to <amount> , but doesn't actually update in /mb balance. https://pastebin.com/T1PaiZmG
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.
Also don't judge my nested ifs, it's the only way I know how to implement this logic lol
first and foremost shouldn't the set method actually set the coints no matter if there already is an entry (thus leading to override)?
if that doesn't change anything debug and test if your targetUUID may be null
this will only set the coins if they dont already have any
It shouldn't since I have the defaultcoins method
@EventHandler
public void onJoin(PlayerJoinEvent e){
Player p = (Player) e.getPlayer();
if (!MobCoinCommand.playerCoins.containsValue(p.getUniqueId())){
MobCoinCommand.setDefaultCoinBalance(p.getUniqueId(), 0);
}
}
}```
and this
this wont work
ok
playerCoins.containsKey instead of containsValue
your value is an integer
in the coins map
ok will change that
also you do not need to test against whether the UUID is already contained in the map since your setDefaultCoinBalance method is doing this already
Nice thank you
it was literally just this haha
Idk if I should ask this here, but my friend just updated our github repository, how could I make it automatically update on my home PC? (I have github desktop)
Asking this here since the github discord got nuked
(I think)
Ah its the pull/fetch origin button
how i can resolve?
you have a method signature clash
oh yeah lol that's in JavaPlugin
name the var like iLogger or myLogger or pluginLogger
nope
yes you do
??'
JavaPlugin already has a getLogger method
aaaaa
no you sill guy
bruh
yo so a friend made a plugin, but can someone explain whats going on here? Why is the main class in lowercase and why is there a class inside of a class
because intellij is pissed at you
the file is named staffcore but the class is StaffCore
what IDE would that not be case sensitive?
they just raw dogging it with notepad xd
idfk
windows paths arent case sensitive
staffcore.java
Ok I fixed it
in summary your friend is dumb rename staffcore.java to StaffCore.java
By coping the entire file, deleting it, and making a new file called StaffCore and pasting it all in
I think what happened was
the file was named
staffcore
then inside the file
its
public class StaffCore
Exactly what it is lol

says the file is named StaffCore on their machine
but when I copied the github repo it changed
cloned*
windows π€¦ββοΈ
Also, if you went into the class and looked at what the error is, it would tell you something like "public class name can't be different from file name"
windows try not to be dumb challenge
Ok its lowercase on github too
but its normal case on their pc
interesting
also, how could I run something I cloned from github?
are ores generate in minecraft like structures?
Just like you would run it normally
Intellij suggest that class you are in doesn't have public static void main method
Which probably doesn't if it's plugin
also am I blind but wheres the rename button
ok thanks
so what do I do... I can't click the button
Ik how to compile a plugin
I always press the green triangle to compile a plugin
Because it's probably maven profile selected
But you have to know to do it manually to
do you actually have a run config set
didn't even know you could do that lol
nope my entire life ive been pressing the green triangle
is there a guide anywhere
im in
If that plugin is using maven, either add run config, do what epicebic said or double ctrl and type mvn package
I literally just posted a guide for maven with intellij
which one?
ah wait
its named package
YOO IT WORKED
the green dorito is back
Tbh didn't know it auto add profile
same lol
I always just compile using the package button
or mvn package in the command line
Hardness maybe
Artifacts better
its chatevent or smthg but idk if thats game chat
is bukkit retlogger and systemoutprintln the same thing?
Bukkit.getLogger().info("HeeseSeen loaded.");
Is the configuration ok or do I need to change something (is it the plugin at the beginning)?
@lost matrix ?
The name IClass is very weird. You are also creating a getter for a HashMap which should never occur.
Hey guys! I'm currently working on a chat plugin for my mc server (I find chat plugins are some of the easier to develop and that provide some good experience/knowledge), and I wanted to use it in my next plugin
How can I implement an API into my chat plugin that allows me to use it in other plugins as a dependency? (like using Vault)
Why is a get for a hashmap bad?
Because you expose the hashmap directly
Meaning people could call clear or remove or whatever on it
Spigot libraries are usually developed by not having a plugin.yml or JavaPlugin class. (Unless you are writing a standalone library).
You can simply compile and install your lib using maven, and then shade it into your other project.
What's the problem?
You generally donβt want third parties clearing your map
Or messing with it in ways you donβt intend
It breaks encapsulation. One of the most important concepts for writing robust code.
Simply never have getters or setters for any collections.
Unless you return a copy*
Yes for bulk iterations you can return a copy π
But it won't have an API or if it will I'll put it in another module
Doesnt matter. It forces you to write more robust code. You will encounter far fewer bugs this way. Its not just
for other people, but mainly for yourself. Trust me, it will help you write way cleaner code.
Okay, I trust you two. So I should do everything? without using "@Getter"?
One thing i would def change is your IClass. Distributing dependencies via an abstract class is really not the way to go.
How should I do otherwise?
You have a static getter for your dependencies already. Use those.
is there any way to figure out the loot table of a suspicious sand/gravel block
a loot generation event doesnt seem to be able to detect such a loot table generating and on-interact the loot table is already gone
ofc periodically checking the block the player is simply looking at is an option but that seems silly
One thing i could maybe see is something like this
public interface LogAccessor {
default Logger getLogger() {
return UltimateBedWars.getInstange().getLogger();
}
}
It doesnt allocate fields every time you create an instance of your abstract classes.
*And its lazy so you wont encounter circular references (which could happen with init fields like in your abstract class)
nvm the loot table generates when the first lil thing has been brushed away
@lost matrix this?
?paste
https://paste.md-5.net/aluqozafik.bash whats going on here?
https://github.com/awildboop/BlinkohChat
Lets say I had this running on the server. How can I make it so I can use BlinkohChat#getDecoratorManager in another, separate plugin? Would I simply add the compiled jar to my build.gradle, then implementation() it?
I'm debating with the idea of refactoring to have a Libs plugin that can be used like Vault for all my plugins, though I'm hesitant to do that because I feel that greatly overcomplicates things. Also, not sure how I'd even go about that
and I think it'd be compileOnly, not implementation()?
Something really really bad. Update your jdk and server version.
publish your plugin to your local maven repository and depend on it in your other project via compileOnly
Get a later java 17 jdk and update your server jar
to the latest paper build?
then I can call BlinkohChat#getDecoratorManager and the new, separate plugin would be using the same instance as BlinkohChat itself?
Yes, spigots classloader ensures that plugins have each others classes on the classpath.
You can basically access any plugins classes if you know they exist on runtime.
Awesome, thank you so much for the help! β€οΈ
why does it matter whether some other software messes with your bed location data it just gives more flexibility imo
besides reflection will break any attempt at 'encapsulation' with no effort anyways
That was colls take. I would also not care for other devs in that regard.
But exposing your collections will inevitably lead to very fragile code.
You dont gain anything and you lose a metric ton of robustness.
dont really understand what you mean by fragile code but the one argument i can think of is having to refactor code if you want to introduce custom getter logic
well you gain not having to write copious amounts of boilerplate and added flexbility, i usually dont expose collections in libraries either but thinking about it logically i dont really see why tbh
ofc its nice to have a getX method in XManager but thats mainly QOL imo
What kind of flexibility would that be? All you are doing is violate half of the clean code principle which have been meticulously engineered over last decades.
Its not a QOL. It is necessary information to write proper code.
well you dont really gain functionality because reflection breaks anything anyways but its easier to modify the collections for other devs and yourself
the only reason i wouldnt expose it is bc it doesnt look nice or professional in autocomplete lol
But thats what you dont want. You should never pass the responsibility of your fields to other classes.
It completely defeats the point of having responsibilities. At that point you can as well write python or javascript, where
nothing actually matters.
i dont really understand why that matters
also i wouldnt say you pass responsibilty at all
its more you provide more access for less code
You lose modularity, you have no more data integrity. Its a total and complete mess.
I have literally never worked in a professional environment where breaking strong encapsulation was even considered.
to the rest of your codebase
how do u lose modularity
who can help me with my c# script?
using System.Diagnostics;
using System.Runtime.InteropServices;
class Program
{
const int PROCESS_ALL_ACCESS = 0x1F0FFF;
[DllImport("kernel32.dll")]
public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
[DllImport("kernel32.dll")]
public static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, out int lpNumberOfBytesWritten);
static void Main()
{
Process process = Process.GetProcessesByName("GeometryDash")[0];
IntPtr processHandle = OpenProcess(PROCESS_ALL_ACCESS, false, process.Id);
IntPtr address = new IntPtr(0x188CE1);
byte[] newValue = new byte[] { 0xE9, 0x8A, 0x00, 0x00, 0x00, 0x90 };
int bytesWritten;
WriteProcessMemory(processHandle, address, newValue, (uint)newValue.Length, out bytesWritten);
Console.WriteLine("ok!");
}
}``` i have this script, i want to change values on addresses for my geometry dash mod menu. but it's not working, who can say why it's not working?
It leaves your classes scope. This means if your class is destroyed, there is no guarantee that your objects are collected because
you exposed them. You literally endanger your whole project to be a giant memory leak. Idk how you could pass the responsibility even more...
thats not leaking memory thats just it being kept alive by something else until thats done with it
You provide all the access and lose all the control.
Its like flooding a village and call it good because now everyone has access to water all the time.
if a program uses your collection it would use your class if it had to
im pretty sure this is a minecraft plugin development channel
so its either your collection or your class instance doesnt get collected
nvm, i just need help
any exceptions thrown ? I assume you haven't removed memory proteection
if you want control dont expose it but if its a simple collection and you want flexibility why not, also i dont know what that analogy is ngl
maybe, but idk how to do this?
You are also running the danger of writing DRY code because a lot of operations you will apply on your exposed
collections will be copy pastes of each other. Just spread to different points in your code.
my assumption is that you can't just write to process
idk, let me check
whats dry again
You always want control
dont repeat yourself
Let me write an example to clearify this point...
if you want control, make it an interface and force people to use that
or dont expose the collection
but its always exposed
hi boys!
I was creating a java plugin for my server, an arcade plugin with automatic events, do you happen to know how to fix it on intellij, idea how to fix the jdk? Which one should I use to make it work?
so it doesnt even matter really
depends on your minecraft server version
1.8 and 1.20
id build for Java 8
how to download java 8?
With that argument you can as well not adhere to any clean code principle because you can always hack your way in with reflections and bytecode injection.
Its not about making your code impenetrable. Its about writing clean, robust and maintainable code.
javas mostly backwards compatible so Java 8 will work on Java 17 required by 1.20
give me download please
?java i think this command exists or smth
?java8
nvm
DuckDuckGo. Privacy, Simplified.
jdk 8
ig but i dont see why exposing a collection hurts clean robust maintainable code
whatevr
it doesnt matter
i need to learn stupid macbeth for a fucking english test
I can just repeat myself at this point...
You will understand after working on a bigger project or in an professional environment eventually.
k
check return value of WriteProcessMemory
i dont really know but this is the one i used im pretty sure https://www.oracle.com/nl/java/technologies/javase/javase8u211-later-archive-downloads.html
?paste
When exposing a collection you should always expose a (defensive) copy of it
lol
int bytesWritten returns nothing
So that your collection is properly encapsulated
yeah why
It allows you to have full control over code flow for that collection
check return value of WriteProcessMemory
is it 0
true
i have this
dude
So that if you want to know when something is added to your collection, you just modify the method and it works for every use case
yehah
bool temp = WriteProcessMemory(...);
Console.Write(temp);
returns "False"
maybe run as admin
with this function, you change protection level
Here is the example. Same functionality, but one enforced encapsulation.
You cant tell me the second one is much nicer to read and maintain.
https://paste.md-5.net/nacefibine.cs
bro, it's for c++
i need for c#
bruh
tf
cant you define that like the other method
its literally method from kernel32.dll lol
2nd is better yeah but id add a getPlayerData method regardless
oh.. sorry, my bad
Ok im glad 
not strictly at all though
sigh
The thing is, this is in my opinion the most important concept for writing actual next level code.
hm
interesting
u have a better name for this than "store"? https://github.com/slatepowered/store
its boring name but i couldnt come up with anything better
wanted to send smth with exposed collections in code review but then i thouhgt of this and now im pissed abt the name
If it has exposed collections then you can call it data-store-with-messed-up-data-integrity π
Someone take away orbyfieds IDE...
i actually have a custom written plugin on intellij which automatically exposes every collection i write and makes everything static and all fields public and mutable i forgot to tell you
Yeah sounds about right 
i regret not using lombok before
this is better than records bc you can actually fucking do shit with them
and you can't with records ?
no
You lose the performance gains of records, but i also sometimes use Data classes like that.
no alternate constructors, no initialization code, no other fields
oh didnt know records had performance gains
You can have alternate constructors in records
ig that makes sense with the jvm changes
I kinda dont like those parameters
How would you for example serialize from a simple String using this.
Would you extend SerializationInput and wrap a String?
i dont actually really know what marshaller means or why i called it that it just sounds cool
ill rename it later
Maybe use one shared data type. So X->Y and Y->X
public interface DataSerializer<T, RAW> {
/**
* Serialize the given value into the given serialization output.
*
* @param context The context.
* @param value The input value.
* @param output The output.
*/
RAW serialize(SerializationContext context, T value);
/**
* Construct a value of the correct type from the given serialization input.
*
* @param context The context.
* @param input The input.
* @return The output value.
*/
T construct(SerializationContext context, RAW input);
sun misc Unsafe my favorite
Allocating objects without calling their constructor.
Gson does that, and it confused me a long time how they actually did that.
im trying to make it so each data serializer can serialize a value of type T to any output stream
like to bson, binary, mysql table thing or smth, etc
ig the DataSerializer is more for structuring the data for serialization
than actually converting it
Well then
public interface BsonSerializer<T> extends DataSerializer<T, Bson>
for example
the serializer is like the backend tho
its generated from reflection
or smth
and it accesses and structures the data
Isnt that what a Codec does usually?
for the SerializationOutput to actually serialize
ig that would be a better name
thansk
yeah and it's terrible
oh true thats possible
ill do that for final fields ig
but
DataSerializer<T> simply a codec for type T
DataMarshaller<K, T> is supposed to be an extended codec for a database value of type T with primary key K
Yeah. I have fallen back to having a no-args constructor which just passes null parameters to the actual delegate constructor
to make sure my initialization logic is not skipped by Gson all the time. (I hate writing serializers and i always let Gson wipe over my data via reflections)
Marshalling and serializing are the same thing in many contexts. There's a very tiny difference, where marshalling is specifically transferring data into another format for it to be immediately sent to another system that expects the data in another format, where serialization can be transferring it to another format on the same system...but, in many cases, they're the same thing
Usually a Codec is a factory or registry for different serializers.
So you give him an Object T, he decides which impl to use, then passes T to the selected serializer, and returns the serialized data.
idk man i see a codec in the english language simply as something which describes arbitrary data in a structured format or smth idk english lol
But thats all lingo. If it works and your names are not completely missleading then its probably fine.
I learned that a lot of the time the naming in programming is inconsistent.
ok, it's not working
my naming sure is
but yeah thanks for the name
never wouldve thought of that tbh
looks cooler too
sick
codec is just short for coder/decoder
ig that makes sense
it (en)codes stuff into another format and decodes it back
ah sorry. slightly wrong apparently according to wikipedia. it either encodes or decodes. an endec does both
but whatever
I mean allocating an object without calling it's constructor seems like an anti pattern to me
At least for Java where this isn't possible without calling the low-level api
Serialization is all a bit anti pattern. It always gets really messy.
Fairs
But I honestly would not want my pojo to skip constructor invocation on object allocation simply alone due to the fact that there are many reasons against it xD
What about attribute constants that are initialized in the constructor?
Wouldn't that violate javas object orientation when the constructor is skipped?
@lost matrix
it does bypass a lot of java's principles
not to mention that it will break in newer jdks and probably doesn't work on some of them right now
not sure if this would fit in #help-server better but
im trying to detect a player using an end portal from the end (i tried various events they all lead p much to the same) but whenever i go through an end portal in the end i just get teleported back on top of the end exit pillar (where the egg is). Im using multiverse-core and multiverse-netherportals, and they are definitely causing the issue (disabling them stops that weird behaviour). Does anyone know why the event (in this case PlayerTeleportEvent) doesnt fire at all? (ive also tried NORMAL LOWEST and HIGHEST prios)
lol
seems like something you should be asking Multiverse
but like how does it disable the teleport event?
so you hate yourself? javascript really? are you okay in the head? do you need medical attention?
that confuses me
no clue
C# is a lot like Java, so you'd probably find it's not that bad. C++ and C are not for geniuses, you just need to practice. They aren't that bad.
wtf?
javascript is good language
better than python
here we go
which of the 10 billion frameworks do you use?
shhh I'm going to ignore it and let them be dumb
i'm using node.js
If y'all wanna argue about programming languages go to #general, this is the help channel and ppl are getting help rn
.
last help q
oh sry
i have no idea honestly
it shouldnt be able to cancel an event from being handled right
Its possible Multiverse handles something differently and avoid bukkit
i have this and it triggers whenever i go through a nether portal in the end (and works how it should) but going through end portal just teleports me to the pillar and doesnt fire that
nein unless they have some custom system for teleportation
Β―_(γ)_/Β―
yeah maybe it intercepts the movement
and never use the event
yeah
try Monitor if it doesn't run then ask Multiverse they know their internals better than anyone
why would it do that
whats that?
EventPriority.MONITOR
EventPriority.MONITOR
oh
also double check your listener and make sure its registered π
just so we avoid stupid issues first
i also enabled mv debugging
and it told me i was gonna tp to the right world (but i didnt and tp event didnt get called)
monitor doesnt work
hey
javascript better than java
is it possible to add like an invisible string data to an itemstack item in GUI? eg.: "playername: spexx" and I would be able to retrieve it somehow
iirc going through the end portal triggers the (re?)spawn event? since you're sent to your respawn location. it's possible they are changing the target location in the event
(thats also what i want to do)
but it should not disable the event
russian vodka better than programming
?pdc
the event should still get called
not the teleport event
if your on Legacy you'll have to use NMS or NBTApi
and im getting teleported and this isnt firing
okay
ty
Yeah it fires the respawn event
no no 1.20.2
then pdc works fine π
You can check the cause if youβre not on old version
respawn does get called
yeah that's pretty much intended behaviour
makes sense
but its anti intuitive
that it works differently for different portals
and that teleport DOES get called if you dont tamper w respawn (or at least i think it did)
Blame Mojang
mojang isnt the one calling the events
No but they are the one using respawn in the end portal
EntityPlaceEvent
Only player
does aikar's @Dependency need additional stuff to work i mean im assuming it does
say I use java @Dependency private JavaPlugin genericPlugin;
do i not need to pass the JavaPlugin somewhere
i think it derives that from the plugin instance you use to create the command manager
oh yea
// some classes like your plugin are automatically registered for injection
epic
Texture pack
Why does my bungeecord when I join lobby says my server is offline?
hey whats the event for when player presses Q in GUI again?
I can't remember the name
these four?
How can you iterate over every Block within a Region inside of an iterator. For example I have a region which has a
minX, minY, minZ, maxX, maxY, maxZ
should be yeah
You take min x and max y so that you get a rectangle I think (nvm)
just create an iterator that keeps those 6 values +3 more for the current value and just increment them appropriately in the next() method.
if you mean an Iterator
otherwise just do triple nested for loops
I mean like the actual Iterator interface
then this
alrighty thanks
hey so if I cancel the InventoryClickEvent when player tries to drop any of the items, it will still play the hand animation, as if I'm still dropping something
how can I prevent the hand animation from happening
?jd-s
by cancelling PlayerDropItemEvent i'd guess?
so I just need to write the same code all over again in PlayerDropItemEvent? XD
I already do all gui checks in InventoryClickEvent
well yea. ur tryna block dropping witht the wrong event
u could also intercept the packet π
do you know how to check from which slot the item was dropped on PlayerDropItemEvent
there is event.getItemDrop().getItemStack(), but I dont think its reliable (I could loop through the inventory itemstacks and find first that matches, but I could have multiple of the exactly same items in my inventory, so that wouldn't work)
I guess you can store the item and give it back when player respawn.
I don't think there is a way to detect which slot the itemstack belongs to.
I need to detect from which slot the item was dropped, if it was from the upper inventory or player inventory
if it was from the upper inventory I need to get the slot number from which it was dropped and from there check if it's less than 45, because the bottom line is for pagination, anything less are homes blocks (which player can click to teleport, they can press Q to remove them, right click to modify the block material for the home)
right now it works, I just need to deal with the hand animation, for some reason it's still there after I cancel the inventoryClickEvent
So I got a suggestion in the chat to go for PlayerDropItemEvent and now I can't even check from where the item was dropped or anything
I think the arm swing might be client side
You can try player animation event
alright
https://www.spigotmc.org/threads/how-to-get-item-slot-from-playeritemdropevent.524796/ this guy seems to have done it that way
That works but it doesnt xD
It doesn't cancel the hand swing animation for some reason
but it should since i think its specifically made for it
π€
here's my code
it comes to the end of the code block and everything works, but that event.setCancelled just doesn't do anything
is there any sane way to convert a material to a block
i tried uh
BlockData blockData = material.createBlockData();
Block dataBlock = blockData.createBlockState().getBlock();```
but this wasnt so cashmoney
a block is a position in the world
yeah but like
idk man
i need to get the nms version of the block to call getSoundType
idk what sound type is but isn't that the sound group? you can get that from a BlockData in the API
are you sure about that π ±οΈuddy
laughs in GlobalPos
net.minecraft.world.level.block.Block nmsBlock = ((CraftBlock) block).getNMS().getBlock();
SoundType soundEffectType = nmsBlock.getSoundType(nmsBlock.defaultBlockState());```
i was using this for nms
that is a Block type, not at all the same as the api's Block
Itβs closer to material
._.
i mean i passed it a casted bukkit Block so its close enough
BlockType when
is there any website that provides mappings from protocol ids to minecraft version names (i know wiki.vg does provide it, but i would like to fetch it like from some kind of api)
actually perhaps im overcomplicating this
i've currently made my own .csv file but not sure
i simply need a material to a sound
why not just get the soundgroup from the blockdata in the API..?
anyone?
i'll guess i will make a git repo and store the .csv file there lol
because nms is life (ur right thanks)

is there any way to make sure the player's dat file is (forcibly) updated when updating it's PDC?
I'm trying to make a crash-save thing that saves a serialized string of the player inventory and tries to replace it when the player join the server after crash
that's the gist of it, but the server seems to simple not update the .dat file because well... it crashes
Player#saveData should work
HOW do you get inventory title
wasn't there getTitle in previous versions or am i delusional
ladies and lentlemen do you all have any tips on how to approach modifying a block's hit sound
Dont compare inventories by title
How do you compare them
I also do material comparison
https://github.com/Dovias/mc-version-protocol/blob/main/mc-version-protocol.csv
i've made a repo which contains .csv file which maps version names to protocol ids. Not sure if that's really the best thing that you could use, but it helps me to automate some stuff im working on
i've scraped wiki.vg and parsed via libreoffice and some regex and then saved it in .csv
Compare by instance, @river oracle can you get the 7smile thread
Depends on setuo but ideally you would compare the inventory objects
?guis
Reason for not using title or name is because the client can set those
the server can set them arbitrarily too
InventoryView#setTitle for example
thanks
Its not much of an issue with the server rather the client
well the main issue is that Inventory's don't even have titles technically only their containers do, and the container title can be set arbitrarily by both the client and the server, for our purposes the title on the server is more important, but the title on the client can also cause weird sync issues
Again not an issue with the sever
I will give an example. Lets say you use inventory names to see of its some special inventory and the way it is opened is via a command. Well the client could just send an inventory open packet bypassing the command and then set the name of the inventory and now they are allowed to do whatever with it to sometimes include taking the items lol.
Its fine to set a name just as long its not the primary means for checking the inventory
unfortunately it doesnt seem to be NAMED_SOUND_EFFECT
If the server does it, it is fine because you can for the most part detect and do things the server does not necessarily the client. Why the client is allowed to change the name or specify it is dumb though
weirdly enough unless you use packets the server won't let you set the title again. However their is the weird client quirk that allows you to just reopen the same ID with a dif title which is what I assume is what you're talking about
You could also rename a chest and boosh ur fucked
Both is what i am referring to
Its stupid regardless mainly because again the server just accepts what the client says about some things lol
also by hit sound i mean the breaking sound
Might be client side
well how do other players hear it then
they also all do calculations ig?
seems kinda inefficient idk
hmm okay
i cant really find much related to sounds tbh
i was looking at https://aadnk.github.io/ProtocolLib/Javadoc/com/comphenix/protocol/PacketType.Play.Server.html and there's like a singular sound packet for like 2000 events
and block breaking is not one of them π π
Iβm pretty sure thereβs a non-named version
Idk though ProtocolLib names are pain
you mean a non-named packet for it?
idk about protocollib but the protocol definitely lets you use the packet that way, https://wiki.vg/Protocol#Sound_Effect
instead of named identifier it lets you use the sound id
you can find sound ids and identifiers here
it has block.<blockname>.{break,fall,hit,place,step}
yeah but that packet is not being sent at all when breaking a block
or so it seems lol
keep in mind some sounds are played in the client by itself, I'm not exactly sure in what cases that happens
this one isnt though cuz some servers have custom breaking sounds
π
But that would only change the textures
Not the model, right?
you would need a plugin that can display the model
if only there was a cool developer that just released such a plugin which is also free and open source
that sure would be poggers
Yeah. What you would do is use armor stand or display entities with items
And then use custom item models
or use a plugin that does that for you
unnamed sounds seems like a sick album name
Prob would need to do something with NMS
To display the model
nope
#general message
no nms required
pink
Isn't that the case already?
surely not, no one author is that cool
how could a mere mortal ever ascend to such a level of coolness
Yeah, figured
It'd be impossible to be that cool
Also why can't I modify the spigot page on a phone
Is that one model or just a bunch of block models put side by side?
on that one specifically that is technically one model but each cube is its own bone for debug purposes
How
it's open source so go find out for yourself
i would like to be able to access my player data (ex: health, vault eco balance, XP level, etc.) through an external app (node.js)
thing is, i dont know how to do so, i looked into Rest PAPI (it doesnt work!) and im not experienced enough to make my own plugin to handle a REST API
could i get help please? maybe point me in a direction and ill search from there
Hey, so I want to know how can I set the item from PacketSetInCreativeSlot to AIR or null if NBTTag isnβt null. Should I call a new PacketSetInCreativeSlot?
Edit the item?
Uβll have tough luck messing with creative tbh
Just use a database
There is an exploit in past versions which I would like how to prevent when players have access to creative
What exploit
yeah just edit the packet and then update the client if you change it
Creative = Server trusts anything the client does.
So basically inject the new packet to the player connection
No edit it
Oh, ok
A specific hack which change your saved toolbars to hacked items which you can get into the game
is it ok to use cf in chunk populate event?
Creative is a mess so good luck
cf?
I lost already 6 hours on it π
completable future
Use it how?
i need to generate custom ore
i know that it should be generated with block populator
And you want to use completablefutures for that how?
i will send u my class
?paste
if i will use the same code but with block populator, my server stop respond
i think problem in big loops
like they become infinite
or smth like this
so what should i do than?
Use a block populator?
thing is
- i dont want to move my stuff to a DB (some plugins require essentials so i'd have to link them to the DB im guessing)
- if i were to use a DB, ideally it would just have a clone of the players data (see above), how would i do that?
okay, i will try use block populator again
and in block populator i can use async?
It already is async
so i dont need cf
and i also need to know
shouldnt i use bukkit runTaskAsynchronously with this?
no
ok
No CF, No Tasks, No Async
why?
Because the chunk you are populating doesn;t exist yet
You instead use the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/generator/LimitedRegion.html from the event
ok
why does the runnable run, the event constructor get called, but the event doesn't get called
register listener?
Or the event class isn't implementing handlers properly
Hi , i have a question ..
what kind of things i need to have on the core moudle?
i have
- api module [api]
- core moudle
- game moudle [jar game itself]
- lobby moudle [jar for lobby server]
public void readPacket(Player player, PacketPlayInSetCreativeSlot packet) {
ItemStack itemStack = packet.c();
if (!itemStack.v().h().toString().equalsIgnoreCase("{}")) {
ItemStack item = new ItemStack((IMaterial) null);
new PacketPlayInSetCreativeSlot(packet.a(), item);
}
}```
how can I update this packet?
Kinda whatver you want
Whatever you think would be abstract and applicable for both of your implementation modules
Oh boy manual packet listening
You probably need reflection
push the new packet through the netty pipeline
should i make this a map?
and add each thing sepratly?
like arenaname,arena.getarenaName()
etc
write this code: https://pastebin.com/RDWvEs4q
but on world generation server just stop respond
in main class i have :
@Override
public @Nullable ChunkGenerator getDefaultWorldGenerator(@NotNull String worldName, @Nullable String id) {
if(worldName.equals("world_the_end")) return new CustomEndGenerator();
return super.getDefaultWorldGenerator(worldName, id);
}
so im trying to make my plugin compaitable with the older versions of the spigot as well as newer versions of the spigot so there is this method in 1.8 inventory.getItemInHand() which is deprecated in the newer versions and replaced with getItemInMainHand(). what is a proper way to handle this?
ΠΊΠ°ΠΊ ΠΌΠ½Π΅ Π·Π°ΠΉΡΠΈ Π½Π° ΠΊΠΎΠ»Π»ΠΈ Π²ΠΎΡΠΎΠ»Π΄
I did this and got this error: ```Internal Exception: io.netty.handler.codec.DecoderException: net.minecraft.server.CancelledPacketHandleException
It automatically maps to getItemInMainHand in new versions
so is it safe to use the deprecated method?
player.getHandle().b.a(new PacketPlayInSetCreativeSlot(packet.a(), CraftItemStack.asNMSCopy(item)));
ΠΊΠΎΠ³ΠΎ
ΠΠΈΠΊΠ°ΠΊ
As long as you only want the right hand sure
probably
what version is this for? in any case, you need to push it through ChannelHandlerContext#fireChannelRead, not write it to the channel
1.19.4 and thanks, I fired it through the channel lol
Does the InventoryCreativeEvent not handle PacketPlayInSetCreativeSlot?
no
did ServerGamePacketListenerImpl lose the connection variable in recent updates?
it was made private iirc?
man
woman
baby
β π¬
Reflection π₯
i was hoping to not need that but i guess you gotta do what you gotta do
unless theres a better approach to getting someones channel
use MethodHandles if it makes you happier
a players?
yuh
one sec buddy
thanks buddy
ServerPlayer#connection <3
CraftPlayer#getHandle() -> ServerPlayer
works as of 1.20.2
that returns ServerGamePacketListenerImpl
isn't that what you want
i need a Channel lol
oh π
its reflectin' time
@slender elbow please help, I'm dumb
channelHandlerContext.fireChannelRead(new PacketPlayInSetCreativeSlot(packet.a(), CraftItemStack.asNMSCopy(item)));```
System.out.println("hello world")
System.cat.output("give food")
Hey guys, I'm getting on the v1.20.2-R0.1 mappings the error "incompatible types: inference variable T has incompatible bounds" when calling "craftWorld.createEntity(location, EntityType.ARMOR_STAND.getEntityClass())" any reason why?
somebody?
