#help-development
1 messages ยท Page 1616 of 1
cant cast lambda parameter to monster
I need to get the class of java.lang.Byte[], so I thought lets invoke java.lang.Class#arrayType() on java.lang.Byte, it did not like that ๐คฃ
doesn't know what predicate is so doesn't use it in the getEntities call
uses a predicate in the stream filter call
show the code you are actually trying
byte[].class
does anyone know how to load a preset world with a build? like create a new world and put a specific build in it
for (Entity entity : event.getPlayer().getNearbyEntities(32, 32, 32, e -> { e instanceof Monster })) {
BukkitTask task = new BukkitRunnable() {
public void run() {
if ((entity instanceof Monster || entity instanceof Player) && !entity.isDead()) {
entity.getWorld().strikeLightning(entity.getLocation());
}
}
}.runTaskTimer(plugin, 20L, 20L);
}
sorry once again
why are you using a runnable?
you are creating a runnable for each entity 1 second later, but they all run in the same tick
you are also running a repeating task to fire a single lightning
don't overload the scheduler
how do you think i implement a delay then?
instead of scheduling 100 tasks, 1 for each entity, schedule 1 task that processes all 100 entities
it will still be delayed, but less dumb
they get damage by teh trident being dropped do them all at teh same time 1 second delayed
i think this is the part where i say learn java
you also check for player which will not be a monster
in the predicate you need to do all teh tests you need
a Predicate is simply a boolean test
damn
Ah, seems arrayType is implemented on java.lang.invoke.TypeDescriptor.OfField, darn
so { e instanceof Monster || e instanceof Player}
so err, where would one go about finding the actuall .class files of the java standard library? ๐ค i
so if i want to do 1 task to process all the entites do i need a for loop inside the runnable
final Collection<entity> entities = event.getPlayer().getNearbyEntities(32, 32, 32, e -> { e instanceof Monster || e instanceof Player });
BukkitTask task = new BukkitRunnable() {
public void run() {
for (Entity entity : entities) {
entity.getWorld().strikeLightning(entity.getLocation());
}
}
}.runTask(plugin, 20L);```
or something close
thanks for all your help but im still getting an error here 32, 32, 32, e -> { e instanceof Monster || e instanceof Player });
I've not got an ide up to check it
inconvertible types
a full error might be helpful
Inconvertible types; cannot cast '<lambda parameter>' to 'org.bukkit.entity.Player'
Just a quick question here. Is it fine to store your library instance as a singleton? (Like passing the instance around inside the framework). Currently i am using dependency injection to pass the instance around my library, but I have seen some people use singletons so that they don't have pass it in when using one of the library classes.
so i tried but I really do not like java and kotlin while a lot better, the entire ecosystem is more fragmented than ancient china
how so
can i use mycommands to read and write from files and do math?
so i can cobble together functions and stuff
kinda like bash
Yup, you can read files and do match :"D
mavan and grandle, java not having a builtin package manager, there being no consistent basic gradle project details that dont assume you've worked with java before
how to open the book gui
thats just the tip of the iceberg
Maven and Gradle work pretty much interchangeably in terms of dependencies
Sure, it's not as good as say Rust, but, its pretty decent still
And also a built in package manager isnt necessary if gradle/maven already exists tbh
?
Ok so where do when im learning about compiling projects, does anyone even bother to tell me what Maven central is and what is from the stock marval, why would i ever choose gradle over mavel, why do the gradle build stuff end in a different suffix, etc
thats what you have to learn.?
Seems pretty straightforward to me though
this is very obviously something made to makeup for oracles lack of care for java, and neither of them do a particularly good job at filling the void
........
Oh wait
yeah nvm
i read that sentence wrong
but yeah I think Oracle didnt bother to do anything about that
Hey guys, im searching for a "book gui" when a player joins it opens and theres a text, yk. does anyone know how i do it?
I mean, they dont have the obligation to, so I dont blame them
Also I feel like Gradle and Maven are very good anyways
we should be glad they exist
and use them
I havent worked with Maven before, but Gradle is amazing
Going further than Java too, works with CLang too if you want it to
Maybe it was because i was diving through a bunch of weird Kotlin API spigot adaptions
which is what makes it nice
Groovy still scares me, but it works ๐คฃ
(i mean technically it is cause groovy but you know what i mean)
lol
also the kotlin dsl too is cool
well
when i look up dsl
it tells me that a DSL is a
"Digital subscriber line"
No
broadcast "Welcome to Skript!"```
which isn't what that is
:"D
So quick question, again JNI. Why the hell would JNIEnv#new_string() fail? I really cant figure it out, and the error is not at all usefull ๐คฃ
how the fuck can you all talk so long about fucking gradle and maven?
too much time lol ยฏ_(ใ)_/ยฏ
compiling Rust takes a bit, so I've got plenty time in between
...and now it is not failing, T_T what
sure
how can i check if the player has no blocks above them
get the location of the player
then loop Y value
get the Block from the location of Y value
if it isnt Air
and etc
@How to open a book GUI in the game (that there is information or text)?
or getHighestBlockAt.getY() > playerLoc.getY()
You'd want to open an Inventory or something like that I'd think
no a book
It's been a while since I've toyed with the GUI stuff in Spigot
{
TArray<FVector> Generated;
for (int32 x = floor(Pos.X / scalePoints) - pointsToCalculate; x < floor(Pos.X / scalePoints) + pointsToCalculate; x++)
{
for (int32 y = floor(Pos.Y / scalePoints) - pointsToCalculate; y < floor(Pos.Y / scalePoints) + pointsToCalculate; y++)
{
bool FoundSomething = false;
for (int32 i = 0; i < Input.Num(); i++)
{
if (Input[i].X_Saved_Value == x && Input[i].Y_Saved_Value == y)
{
Generated.Add(FVector(x * scalePoints - SelfPos.X,y * scalePoints - SelfPos.Y,Input[i].Z_Saved_Value));
FoundSomething = true;
}
}
if (!FoundSomething)
{
Generated.Add(FVector(x * scalePoints - SelfPos.X,y * scalePoints - SelfPos.Y,TwoD_Perlin_Noise(x,y,scale,amplitude) - SelfPos.Z));
}
}
}
Output.GeneratedPoints = Generated;
Output.xFirstIndex = floor(Pos.X / scalePoints) - pointsToCalculate;
Output.xLastIndex = floor(Pos.X / scalePoints) + pointsToCalculate;
Output.yFirstIndex = floor(Pos.Y / scalePoints) - pointsToCalculate;
Output.yLastIndex = floor(Pos.Y / scalePoints) + pointsToCalculate;
}```
How would i check if a user is between two opposite location objects
like two locations are points and it makes a box between those points like rise/run and i need to check between that box
Math! Check their X and Z coords compared to the two locations
@lunar schooner this
My tip, draw it out
Thatll help you enormously to figure out the steps you need to take to get your result
C++ is better than Java, right?
Disagreed
i know about this lmao lemme explain actually
how do i remove players from the online players counter with the ServerListPingEvent
kick them
C++ is what you write becomes code, which is better in many scenarios but it leaves room for memory leaks whereas in java its more difficult. A lot of code benefits from the way java does things. If you dont know what you are doing or are not fully attentive to your own code Java code will end up being more performant
not my intention, thanks for the halfassed answer
Also extending upon programs is more difficult in C++ since you need dynamic linking whereas in java you simply load classes into the JVM
if you need it : p.kickPlayer(""); : d
And this is why I love Rust, it's the best of both worlds! What you write is what you get, but out with the unsafety!
i know how to kick people, stop giving terrible answers
Yep i too am a Rust advocate (dynamic linking is also even harder there). But rust does take longer to write a lot of the time
Ok my guy
and learn, but once you do its way worth
Villager villager = (Villager) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0, 100, 0), EntityType.VILLAGER);
villager.setCustomName("Ender Dragon");
List<MerchantRecipe> merchantRecipeList = new ArrayList<>();
MerchantRecipe recipe = new MerchantRecipe(new ItemStack(Material.DIAMOND_SWORD), 1);
recipe.setIngredients(Arrays.asList(new ItemStack(Material.ENDER_EYE, 6)));
merchantRecipeList.add(recipe);
villager.setProfession(Villager.Profession.ARMORER);
villager.setVillagerLevel(1);
villager.setVillagerType(Villager.Type.SNOW);
villager.setRecipes(merchantRecipeList);
villager.setGravity(false);
villager.setInvisible(true);
e.getPlayer().openMerchant(villager, true);
``` when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
๐ค I find dynamic linking rather easy actually
using it right now actually! :"D
Its a bit harder in the sense that you cant just create a program that dynamically reads a "plugin" and just finds its entry function and injects itself in
๐ i need to recheck that then
how do i remove players from the online players counter with the ServerListPingEvent, while keeping them online
let me dig through my repos real quick and shoot you an example
For video games though i find Rust is a little lacking in terms of libraries. Atm making a 2d platformer in C++. Base engine is written in C++ but a lot of the game functionality in terms of world generators and weapon interactions are done in Lua
Sorry I had to leave for a bit. If you didn;t get it fixed...
final Collection<Entity> entities = event.getPlayer().getWorld().getNearbyEntities(player.getLocation(), 32D, 32D, 32D, (e) -> { return (e instanceof Monster || e instanceof Player); });
BukkitTask task = new BukkitRunnable() {
public void run() {
for (Entity entity : entities) {
entity.getWorld().strikeLightning(entity.getLocation());
}
}
}.runTaskLater(plugin, 20L);```
Tried to do it in rust but it was a bit more locking/restrictive and opengl binding crates suck ass
so C++ is still king in gamedev
Im a Game dev ๐ ๐
actually i didnt even use opengl i used BGFX which includes vulkan as well with a platform agnostic api
its really cool
how do i remove players from the online players counter with the ServerListPingEvent, while keeping them online
unsafe {
let lib = match Library::new(filename.as_ref()) {
Ok(lib) => lib,
Err(e) => return Err(e.to_string())
};
//We need to stash it in a Vec due to lifetimes, libr MUST outlive plugin
self.libs.push(lib);
let lib = self.libs.last().unwrap();
//Get the _plugin_create function from the library
let constructor: Symbol<'_, *mut dyn Plugin> = match lib.get(b"_plugin_create") {
Ok(symbol) => symbol,
Err(e) => return Err(e.to_string())
};
let boxed_raw: *mut dyn Plugin = constructor();
Box::from_raw(boxed_raw)
}
This is all you need to do plugins
on the other side it's an extern C function
https://crates.io/crates/libloading Best of luck :"D
aite need to go back to my original question making a graph one sec lmao
so, what is wrong with this signature? [Ljava/lang/String;[Ljava/lang/Object;[Ljava/lang/Class;, I cant figure it out
Villager villager = (Villager) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0, 100, 0), EntityType.VILLAGER);
villager.setCustomName("Ender Dragon");
List<MerchantRecipe> merchantRecipeList = new ArrayList<>();
MerchantRecipe recipe = new MerchantRecipe(new ItemStack(Material.DIAMOND_SWORD), 1);
recipe.setIngredients(Arrays.asList(new ItemStack(Material.ENDER_EYE, 6)));
merchantRecipeList.add(recipe);
villager.setProfession(Villager.Profession.ARMORER);
villager.setVillagerLevel(1);
villager.setVillagerType(Villager.Type.SNOW);
villager.setRecipes(merchantRecipeList);
villager.setGravity(false);
villager.setInvisible(true);
e.getPlayer().openMerchant(villager, true);
``` when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
(please ping on response)
O.o I just noticed it, I need to surround it with (..)V
how to get a delay between loops
So here, I need a function that checks in between two opposite locations like a box and it either returns true or false (hence the colors of User(meant to write player but oh well already saved it)). What would be the equation for this
it has a contains method
for (int i = 0; i < 25; i++) {
new BukkitRunnable() {
@Override
public void run() {
code
}
}.runTaskLater(plugin, delayamount * i);
}
or smth like that
you create a repeating task and process one item per execution
shhh its fine
how would i make boundingbox ignore height
Y coord
set its Y in both corners to the same
if you help me i will send you an emoji of your choice :)
BukkitTask task = new BukkitRunnable() {
public void run() {
for (Entity entity : entities) {
if (entity instanceof Monster && (world.getHighestBlockYAt(entity.getLocation()) < entity.getLocation().getY()) && !entity.isDead())
entity.getWorld().strikeLightning(entity.getLocation());
cancel();
}
}
}.runTaskTimer(plugin, 50L, 20L);
my issue is that the lightning lags the server
no, has to be the same Y as yoru target location you want to test contains on
and strikes all enemeis at once
not difficult
please someone help ๐ฅบ
Something like...
final Entity[] entities = (Entity[]) event.getPlayer().getWorld().getNearbyEntities(player.getLocation(), 32D, 32D, 32D, (e) -> { return (e instanceof Monster || e instanceof Player); }).toArray();
BukkitTask task = new BukkitRunnable() {
int i = 0;
public void run() {
if (i >= entities.length) {
cancel();
return;
}
entities[i].getWorld().strikeLightning(entities[i].getLocation());
i++
}
}.runTaskTimer(plugin, 20L, 20L);```
// Event gets called on flag changes for some reason
// Do not act on event if player is still on the plot when this happens
Location location = ((Player) e.getPlotPlayer().getPlatformPlayer()).getLocation();
if (BoundingBox.of(new Vector(plot.getTopAbs().getX(), plot.getTopAbs().getY(), plot.getTopAbs().getZ()),
new Vector(plot.getBottomAbs().getX(), plot.getBottomAbs().getY(), plot.getBottomAbs().getZ()))
.contains(location.getX(), location.getY(), location.getZ())) return;
tfw having to make a workaround because plotsquared has a bug
๐คก
whoever fixes this problem gets 1 dollar paypal
pweeez
out of range?
I believe so
ok i will try smth 1 sec
Hey is there anyone who could help me with using a Service from an other Plugin I've made? I did the same approach as always but doesn't work anymore, did that changed in 1.17? Just tell me if you need the code
Nothing changed in teh service manager
well that's how I am doing it rn:
Registering the service in onEnable
Bukkit.getServer().getServicesManager().register(PlayerRegisterService.class, this.registerService, this,
ServicePriority.Normal);
And here recieving the service in the other plugin (code also from onEnable)
RegisteredServiceProvider<PlayerRegisterService> provider = Bukkit.getServicesManager()
.getRegistration(de.schmidi.playerRegistration.services.PlayerRegisterService.class);
if (provider != null) {
this.playerRegisterService = provider.getProvider();
}
But the provider seems always to be null
new error popping up
The plugin is also running on the server
java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Lorg.bukkit.entity.Entity; ([Ljava.lang.Object; is in module java.base of loader 'bootstrap'; [Lorg.bukkit.entity.Entity; is in unnamed module of loader 'app')
yeah I thought it might do that due ot teh cast
its a simple fix. See if you can figure it out ๐
do u have any idea about my issue?
remove the cast for starters
is you second plugin depend on the first?
how can i change the playercount on the ServerListPingEvent, i.e; hiding vanished/hidden players from the server list & playercount
yea, that's from the plugin.yml:
depend: [PlayerRegistration, Vault]
change the variable to Object[], then cast to Entity in the runnable
ok i;ve got it working a slightly different way
Then IF both plugins are actually on the server and your provider is in fact running, no I see no reason for your issue.
but it is detecting the user me as a entity so can that be removed with predicate
that's really bad I also can't find anything :/ also double checked with working examples but couldn't find anything
alright i've got it working but i don't know if it will detect other players
does anyone know how to test another play
what code did you put in teh Predicate to test?
return ((e instanceof Monster || e instanceof Player) && e != event.getPlayer());
ok
then yes it will pick up other players. Only the one dropping the staff will be ignored
ah great
This is really basic and I'm being dumb rn but how would I get the player I entered into a command e.g /punish bobby would make that say make a new punishment for bobby
I use identical code in my plugins and they all work fine
I am really confused about this
If you only have name you have to use a name lookup.
with getPlayer or getOfflinePlayer
ok
You have to be doing something wrong. Like not actually registering
Can't I just parse it through a constructor?
I make do when PlotSquared API breaks and calls events when they shouldnt be
// Event gets called on flag changes for some reason
// Do not act on event if player is still on the plot when this happens
Location location = ((Player) e.getPlotPlayer().getPlatformPlayer()).getLocation();
if (BoundingBox.of(new Vector(plot.getTopAbs().getX() - 0.5, plot.getTopAbs().getY(), plot.getTopAbs().getZ() - 0.5),
new Vector(plot.getBottomAbs().getX() + 0.5, plot.getBottomAbs().getY(), plot.getBottomAbs().getZ() + 0.5))
.contains(location.getX(), location.getY(), location.getZ())) return;
had to do some weird shit like
parse what? you said you have a name and needed a player
adding/subtracting 0.5 to a lot of the coords
An instance of the target it better put
fun thing is when it seems to be registered, cause when I print all avaible services it is shown as well, but the get doesn't work for some reason
is there a reason you use the fully qualified name in getRegistration?
as you use it in the diamond before.
just for playing arround, didn't worked before so I thought let's just do something which shouldn't change the outcome
yep, but u know sometimes strange things fix it
yep
System.out.println("known services: " + Bukkit.getServicesManager().getKnownServices());
this also shows the service
it is contained there, bruh
Is your this.registerService actually an instance of PlayerRegisterService?
RegisteredServiceProvider<PlayerRegisterService> provider = Bukkit.getServicesManager()
.getRegistration(PlayerRegisterService.class);
if (provider != null) {
this.playerRegisterService = provider.getProvider();
}
just a different variable name in the plugins
its the same var name in each plugin
ok, but just so long as the instance you are registering this.registerService is the correct class
How can I get the first argument (or zero) from outside the command?
ye it is
k
dependency injection. you pass it to whatever method needs it
um, null?
How can I get a list of all resources in my plugin?
null comes from:
System.out.println(Bukkit.getServicesManager()
.getRegistration(PlayerRegisterService.class));
Oh I just thought of a genius idea to get a list of resources
You must have some instancing issue. like dodgy imports or something
do both of your plugins use different packages?
you have no overlap?
import de.schmidi.playerRegistration.services.PlayerRegisterService;
----
package de.schmidi.playerRegistration.services;
packages also match
How would I go about this? I need these fields in the method.
they cant be declared outside it
yep, I was just wondering if you have (by mistake) created a duplicate package/class locally in yoru plugin
any idea how i could replicate the spectator mode flight but without the noclip part?
is it possible to disable only THIS error when running an application? there's no way to prevent it, and imo it's annoying that it always opens a new tab, where it jumps to
just a way to make a player instantly transferred into flight and locked in flight (unable to double press spacebar to go out)
isn't the spectator flight the same as creative?
ah nvm, i see
spectators cannot double press space to get out of flight
they get locked in flight
yeah i see
you could set them flight again, when they stop flying
if thats possible with #setFlying
I assume the top half of a door is placed 1 tick after the other?
also, i feel i should not
player.setFlying(); does not actually set them into the fly mode
it will most definitely stop you from flying if you are flying
but if you're on the ground it will not transfer you into flight mode immediately
it will only do that if you jump
wait what if i just teleport the player like one block up i think that would work
how do i hit a entity through spigot code, i have the entity , and player
i tried
( (CraftEntity) e ).getHandle().damageEntity( DamageSource.playerAttack( (EntityHuman) p ), 1.0f);
but i just get errors
spigot 1.8.8 btw
never seen this error
wierd
this kind of error dont show up even when i frgot the command section in plugin yml
Your command is not in your plugin.yml
but it is in it
nope
that error says the command you tried to retrieve is not there
id i palce the yml in the wrong place?
then i guess there is no serverside way
but idk exactly
ik but i have no idea what is causing it
plugin.yml goes in resources
i think the flying animation is like a packet thing
dream did make the minecrfat but always flying plugin
try cracking them open i suppose
Can anyone help me figure out why this is red and why no essentials commands or chat prefixes are working?
if(player.getInventory().getItemInMainHand().getItemMeta().equals(ItemData.SPIRIT_STAFF.getItemMeta())) any idea why this isn't working? if i have my code right, the item meta of the item in the main hand should be identical to the itemmeta for the spirit staff because they are the exact same item
okay looking at my console i get the error Caused by: java.lang.NoSuchMethodError: 'org.bukkit.inventory.ItemStack org.bukkit.inventory.PlayerInventory.getItemInMainHand()'
@mellow beacon Essentials failed to enable. Look into your console, there's probably some error message there.
What would be the best way to store Quest data?
SQL database is probably the best way
but in which way?
oh my b
hey I know this is dumb but how do I start a storm
i have googled it but its filled with plugins not help
/weather thunder
my bad in java
can someone plz help me
just make plugin final
private final Plugin plugin;
void run() {
final Plugin p = this.plugin;
new Lambda() -> {
//p.method()
}.run();
}
I think it's something like Bukkit.getServer().getWorld("world").setThundering();
yes it is ^
I cant
?
1 sec let me find the bloody class out of 500 lmfao
final Plugin p = this.plugin; this is the relevant line
not the field above
you just have to create a copy of all variables as final variables before running the lambda method
unless im blind I believe I dont have to get an instance of main, my util does that
then why are you complaining
The same applies for player and args btw
It's just basically you should do this with all variables that you use in lambdas
what are you trying to do?
we've already said everything you need to know
parse an instance of the "target" to another class
but idk how to get an instance of the argument as I need stuff inside the method to define it
just๐use๐final๐variables
Is there any good way (non-janky) to get around PlayerInteractEvent firing twice in 1.8.8 when right clicking certain intractable blocks such as cobble walls, fences, and crafting tables?
Try using System.currentTimeMillis
you can compare them, if its under the cooldown time you ignore the event
Thanks!
why would one use 1.8.8 over 1.8.9 wtf
why is there like a cooldown or something for e.damage?, when i e.damage someone, e.damage wont work again if i do it like 0.1 seconds later
https://gyazo.com/77fc304a2cfd759245408d40ae209920
1.8.9 doesnโt have a server version
Hey guys, Is it possible to set multiple lines in the PlayerListHeader and PlayerListFooter? :)
Entities have a few ticks of invulnerability
You can set them to 0 or subtract Heath directly
http://prntscr.com/1ikaero will this change the invulnerability ticks
You havn't
I want to get arg[0] in another class which is in another method
using final is efficient, yes but doesn't solve the problem
you know java
Why does maven say cannot resolve the thingy when it's in the pom.xml with the repo?
maybe take a break
this really helps so much

send ss
lmao
one sec
trying to import NuVotifier
will do I've been up way too long doing this way too long
i need a server setup
go ask in that software's discord or whatever
ight ty
how do i make a scoreboard
^
i suck
i will never make it as a dev
google^4
g o o g l e
there are spigot docs for a reason โค๏ธ
Youโre right, you wonโt
What would be the best way to store quest Data via SQL?
@ancient plank you want to deal with this kid if you around?
@grand swan sorry for the ping but like every staff is offline or DND/Away and this kid is just trolling and spamming channels
or @quaint mantle
Straight up proof when parents don't raise their kids
fun fact there's two of them now
Who?
Done. That felt good.
Hey i was wondering if this is possible with Pterodactyl?
Start a server in minecraft and a batch file will run to create that server on pterodactyl panel and then assign the ip and port(be a port from before so i don't got to open up tons of ports so for instance i log on my port is 25566 then quit and you login and take that port). Then all the files will go to the server that you just created. After everyone is off the server which ill just check that with bungeecord. Shut down and save the files then remove them. For someone else to use.
or the best way to just do it
If you try to set a player flying to true before they're loaded in, does it have a chance of not setting flight ingame, but spigot thinking it is?
cause spigots giving me the wrong value for if a player is flying and I'm really confused
nope, even after 10 seconds it still doesn't activate
PlayerLoginEvent is a bit strange. You should delay any action that uses the logging in Player by one or two ticks.
I tried delaying it by 200 ticks just to be sure, and it lead to the same issue, it just seems like the players flight and the spigot variable are unlinked for some reason
Printing isFlying returns true which is whats stumping me, even when the player isn't flying (allowflight is on), but fall dmg is still negated
Show some code pls. If you delayed it by 10 secs and it still doesnt work then your logic might be faulty.
Or spigot is acting weird.
@EventHandler
private void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Bukkit.getLogger().severe("1");
if (player.hasPermission("hub.flight.auto")) {
Bukkit.getLogger().severe("2");
new BukkitRunnable() {
@Override
public void run() {
player.setAllowFlight(true);
player.setFlying(true);
Bukkit.getLogger().severe("attempted change");
}
}.runTaskLater(HubCore.getCore(), 200);
}
}
Prints:
1
2
attempted change (after 10 secs)
printing isFlying on a timer loop is true until the player double jumps into flight, then disables it
Are they on the ground
Yes
What exactly doesnt work. What do you expect to happen and what is actually happening
what I want it to do, is check if the player has that permission, and if they do, immediately launch them into flight when they join (not making them turn it on themselves by jumping into it, it already being on etc)
Send them into the air first
oh is it that simple lol
The game disables flight when you touch the ground
And spigot may not notice that, might be a client side thing
If they stand on the ground then flying is disabled
oh that makes sense, let me try it
Are you willing to use NMS? Because if its client side you can try and send a PacketPlayOutAbilities packet
But its most likely the fact that they are grounded
yeah I'm fine using NMS, sorry give me a sec, servers acting weird
((CraftPlayer) player).getHandle().updateAbilities();
Try calling this manually
It seems weird spigot thinks they are flying and the client doesnโt
Unless something client side is going on
calling this seemed to fix it, as for changing the Y level on its own, it didn't seem to affect it, thank you โค๏ธ
I know, considering thats the method that worked and is called straight after the handles flight is changed in CraftPlayer
Might be because you are calling setAllowFlight too
finally, my rewrite is stable
boys, it feels good
it looks good, it works good
we good
Do you know how many ms are between the two events? Player can also click really quickly twice
its u
...
Which two events?
Usually about 50m if the user manages to send two packets fast enough
Print out the current time and compare
It probably varies
roger
main and off hand player interact
Just use the next line char \n
Canโt you just check which hand is being used in that case
They are fired on the same tick.
If no events hook into them then it way under 0.01ms but if some Listeners tinker with the event then the discrepancy rises.
But you can get the hand that is related to the event from within it.
oh so 50ms
Only if you speak of spam clicking.
so this is how datapacks work
kinda weird
XD i think you are better off learning java and making plugins tbh
@EventHandler
public void onInteract(final PlayerInteractEvent event) {
final Player player = event.getPlayer();
final EquipmentSlot hand = event.getHand();
if (hand == EquipmentSlot.HAND) {
player.sendMessage("This is your main hand event.");
} else {
player.sendMessage("This is your off hand event.");
}
}
thx
I also went ahead and measured the delta of those two events
so around 50us - 80us on my machine
idk if this is helpful but the main hand will be called first, i remember do some testing before
just a fun fact ig
Is there anything in the spigot api that allows me to stop mobs being able to travel throughout worlds
Ie: mob entering nether portal in the overworld and geting sent to the nether
EntityPortalEvent
Ok thanks!
This code might help
@EventHandler
fun portalEvent(e: EntityPortalEvent){
if(e.entity !is Player){
e.isCancelled = true
}
}
think something like that will work?
isnt it !=?
or are you talking about something else
Idk man, I'm not java expert
Ohhh that's why
fun is having fun init
Hello, it is possible to make a Miencraft plugin as a web server?
Like, if someone dies, to be placed on a webpage that is created by the plugin?
Sorry if I sound dumb, I'm very new with those things xD
You guys here are the experts.
of course its possible
but your plugin wouldnt be a web server, it would just communicate with a web server
is it possible to summon an trident and apply it a vector like arrow ?
why shouldnt that be possible
so you just wanna push the trident, right?
i wanna summon it at a location and apply it a custom vector
to make like a "trident rain"
and there's not attached to a plyer and cannot be pickable
spawning them already forces them to fall down
How is the Dynmap working?
how do you spawn them ?
and how would you like to apply a vector? do you mean setting the velocity?
World#spawnEntity 
well kinda dump i'm
A Google Maps-like map for your Minecraft server that can be viewed in a browser. Easy to set up when making use of Dynmap's integrated webserver which works out-of-the-box, while also available to be integrated into existing websites running on Apache and the like. Dynmap can render your worlds using different renderers, some suitable for performance, some for high detail.
since i didn't looked at the source code, if there is any public, i can't tell you what it does exactly. probably just doing some magical stuff and sending it to the webserver so it can display it
Dynmap loads every chunk one by one and makes a snapshot of it.
The 2D view is easily rendered by just getting the highest block on every x/z point in the chunk and then using the minecraft texture to render
a simple top down view.
The orthographic view on the other hand is a bit more complex to display as you need a proper 3D framework. A lot of it is just html, css and JavaScript.
But Dynmap is working as a server, right? I mean, after I activate the plugin I can see the map in browser. So it doesn't communicate with someone externally, only itself and the server
myeah
it hosts the server in a new thread or whatever
as to not affect the mc server too much
Dynmap starts a web server
I see, thanks you for the time and the informations.
Programming is so haard.
Just looked at github. They start a simple jetty server to provide the website.
Hello! I am trying to cancel item frames rotations on right click. Do you have idea?
This is what I tried:
@EventHandler(ignoreCancelled = true)
public void onPlayerRotateFurniture(PlayerInteractAtEntityEvent event) {
Bukkit.broadcastMessage("OKAY");
Bukkit.broadcastMessage("OKAYa: " + event.getRightClicked().getPersistentDataContainer().has(FURNITURE_KEY, PersistentDataType.STRING));
if (event.getRightClicked() instanceof ItemFrame
&& event.getRightClicked().getPersistentDataContainer().has(FURNITURE_KEY, PersistentDataType.STRING)) {
Bukkit.broadcastMessage("OKAY2");
event.setCancelled(true);
}
}```
PlayerInteractEvent
it is triggered, I get the 3 logs, but it is not cancelled
with ray tracing ?
yes since it is detected
I didn't need raytracing to achieve it, it was a side-effect of cancelling interact events in general
I mean, I get the logs when I right click on it
yeah but I don't want to cancel all interact events
just the one that target item frames
I don't understand
I get my "OKAY2" when I right click the item frame
so the right click on the item frame is detected
No it can't be the issue
@quaint mantle
public void onItemUsedOnEntity(PlayerInteractEntityEvent e) {
if(e.getRightClicked() instanceof ItemFrame)
<code>
}
since I get the "OKAY2" log
no problems
I don't understand, they also use that event
bruh
I'll try with spigot instead of paper
What is not working for you?
You're using PlayerInteractAtEntityEvent but I used PlayerInteractEntityEvent
Idk the difference but might be the reason
Docs say it's the same but with the location, though they advise to listen to the other version (without At)
Nice!
how is it called when a player is asked to say something in chat and the plugin gets the input without it being sent to chat?
Listen to the chat event and cancel it
thanks. ๐
is Developing in paper better, or worse? I use JDK 8
If you need features of paper (like an AI api) then use paper
Otherwise just develop for spigot api as all spigot plugins work on paper
But not all paper plugins work on spigot
Oh okay
There is I think PaperAPI which allows you to use paper features if the server is running on paper, and otherwise it uses the spigot version
Like async chunkloading
With paper it will do async, with spigot it will do sync
So i need to pipe deserlized numbers into mycommand
player x is the 32st to do this, read line 31 of coords.txt
the math is a little to hard to do on the stop without coding stuff
why a .txt if you could just use the supported .yml format
oh well then i could do a .yml format then
the specific file is not important aslong as it can hold ascii text
otherwise: https://stackoverflow.com/questions/44506455/how-to-read-integer-from-a-text-file-in-java
i dont really wanna make a plugin java is ugly ๐ฅบ
and constraining because i just wanna use my terminal editors and live in peace, that or VSCODE
java not ugly
Ugliness doesnโt make a language inherently worse (:
its less about the language its more about how confused I got when i tried to use gradle with kotlin and work with the 5 dozen unoffical apis
kinda just said "nope"
Well you donโt have to use 5 unofficial APIs, or gradle, or kotlin for that part
yea no after using kotlin over java im not even trying to use java, there is no point
Lmao alright
Small help around one thing
Is it good idead to block player i asyncpreloginevent
And load there data from mysql
So they are stuck in loading screen
Until data is retrived from mysql
No
yes
if the alternative is to block the join event
or if the alternative is to not have the player's data ready for when it's needed
or just let them join and freeze them until their data has been loaded
and the server, too, if someone still wants to read the data
by the time the player is in the game their data should all be loaded and proper
anything else will run into issues when multiple plugins are at play
imagine for example an economy plugin that reported 0 for player's balances for the first 3 seconds they're online
Villager villager = (Villager) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation().add(0, 100, 0), EntityType.VILLAGER);
villager.setCustomName("Ender Dragon");
List<MerchantRecipe> merchantRecipeList = new ArrayList<>();
MerchantRecipe recipe = new MerchantRecipe(new ItemStack(Material.DIAMOND_SWORD), 1);
recipe.setIngredients(Arrays.asList(new ItemStack(Material.ENDER_EYE, 6)));
merchantRecipeList.add(recipe);
villager.setProfession(Villager.Profession.ARMORER);
villager.setVillagerLevel(1);
villager.setVillagerType(Villager.Type.SNOW);
villager.setRecipes(merchantRecipeList);
villager.setGravity(false);
villager.setInvisible(true);
e.getPlayer().openMerchant(villager, true);
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
(please ping on response)
?paste
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
(please ping on response)
does spigot itself use apache commons' WordUtils? why don't I have to shade it for my plugin to work?
Does someone know how to loop it
eclipse๐ฌ
i dont have any idea
more lightweight ๐
looping condition, if type.equal ZOMBIE, create Zombie variable. if type.equal SKELETON, create Skeleton variable and next...
how to do that
iirc yes
How do I make a countdown timer?

thank you
what exactly do you want to loop?
๐
or what are you even trying to achieve
magic โญ
here
loop the EntityType#values
and check for each
nooo, entity variable like "Zombie" ent = (Zombie) some entity;
are you understand?
https://paste.md-5.net/sopogilode.coffeescript
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
(please ping on response)
so my best options will be
for(entityType) {
if(type.equals(entityType.name)) { yes }
}
to save on every transaction
so if player switches server
data is already saved
and loaded
proparly on async pre login event
save it in an interval of X minutes and if they leave
mysql know to be slow on some people machines
and then u get in problems like A server didn't save yet and player switched to server B
and loaded old balance before saving was finished on Server A
and that happens for many people because there servers are on different machines
and because of that you are saving the players data when he leaves the server
https://paste.md-5.net/sopogilode.coffeescript
when this code runs, the villager gui opens for a split second then closes. regular vanilla vilagers work fine. clicking on this summoned villager also makes the GUi close
(please ping on response)
is anyone going to help me
hey how do i download a bukkit development build for making plugins
what if i want to update a bukkit plugin?
you can compile it with spigot
bukkit can run with spigot and paper
you either have to delay it for a second so the server can recognize the villager first or it is opening the inventory twice
alright thanks ill try
well that is problem with saving on leave
event
mysql will not manage to save in time
opening the inventory twice? hmm
and server b will load old amount
yeah if you click on him it will open his and your inventory
its running the event twice because i am in creative mode i think
it should unless you are not doing any expensive operations to save it. otherwise, if they switch the server, support bungee
what event
interactatentity
what would u do by supporting bungee
Probably because you have two hands now.
oh yeah and the second hand
@hybrid spoke i am not checking if they are clicking a villager, I am checking if they are clicking an ender dragon
what is your problem
interect event goes 2 times
we cant see that from your code
listen for the hand
just like aglerr said
The event fires twice because you have two hands, so check If the hand is off hand, return.
Am I supposed to enter a name of plugin here? https://prnt.sc/1io6oh0
ah thanks
the instance of your plugin
the reference of your main class
either getting it by singleton or DI
How?
||Bukkit.getPluginManager().getPlugin("lmao");||
thanks
no don't quote me
that's not what they meant
although I also don't see a problem with doing that
cmon xd
smh no dont use this
bad guy
or go this way
public static final String plugin-name;
public void onEnable() {
plugin-name = "YOUR_PLUGIN_NAME";
}
public void getPlugin-Name() {
return plugin-name;
}
ok, I don't see a reason for dependency injection if the class doesn't even need any aspect of the instance instead of just passing it around like volleyball (e.g. using it for BukkitScheduler#runTask). But I also object having a singleton because it is illogical design-wise.
oh, he just needed the name?
oh okk lol
i thought imma getting shittalked
because everything was wrong about this
but okay nvm
Back to my problem:
Zombie ent = (Zombie) mob;
}else if(type.equals("SKELETON")) {
Skeleton ent = (Skeleton) mob;
}
// Looping to make variable
ent.justCallIt(true);```
I don't know how to explain it, I want loop condition to make some variable, and call it
like this code
type.equals("ZOMBIE") looks wrong
it should be around the lines of mob instanceof Zombie
its not what i mean
you wanted to have a loop for your type.equals thing
to avoid calling it for every entity
maybe yes
otherwise EntityType#valueOf(type) is also a solution
and checking with instanceof afterwards
instead of an equal check
sorry chief, I sleep at 9pm my time and it was 11pm my time when u pinged me
nononono, its not i mean
ohh god, i dont know how to explain it
visualize it
ok i got it fixed with the double event thing ty bye
normal code to use
Zombie entity = (Zombie) someEntity
and
Skeleton entity = (Skeleton) someEntity
and i want to make loop like this
// make entity as Zombie
Zombie entity = (Zombie) someEntity;
} else if(SomeString.equals("skele")){
// make entity as Skeleton
Skeleton entity = (Skeleton) someEntity;
}
// example output SomeString is jombie
entity.execute();```
are you understand
for (entitytype et : entitytype.values()) if et.getentityclass().isinstance(mob) et.getentityclass().cast(mob)
literally no point in that though, that's not how java works
wait
Does anyone know what (int) aInteger %2 does?
takes mod 2 of ainteger
but thats
not what he meant
that takes mod 50 of ainteger
yes, i just try
So if it is 100 it returns 50?
x % 2 divides x by 2 and returns the remainder
100 % 50 returns 0
because 100 is divided by 50 evenly to 2
with no remainder
Ah thx
Ok
probably not
f
maybe if spigot have like
String some = "Zombie";
// make variable as entity
Entity.valueOf("Zombie") ent = (Entity.valueOf("Zombie")) someEntity;
// i mean output like
Zombie ent = (Zombie) someEntity
// and if string is "Skeleton"
// output is
Skeleton ent = (Skeleton) someEntity;```
Are you understand?
literally what
I do understand what's the issue, but I don't know how to fix it.. https://prnt.sc/1iog9yd
learn java'
You can't change that timer inside the runnable
java is strongly typed
How can I make countdown then?
AtomicInteger
which means that you cannot dynamically define the type of a variable
or dont make it a local var
you can only directly declare it as a Zombie or a Skeleton or whatever
hmmm alright ty
the best you can do is generic type parameters and shit but that is far from what you want
i dont know how to explain it. i want make some LivingEntity variable as Zombie or Skeleton
LivingEntity mob = (LivingEntity) mlocs.getWorld().spawnEntity(someLocation, EntityType.ZOMBIE);
and i want to make living entity as Zombie
normaly i use
Zombie ent = (Zombie) mob;
and use ent variable
and how to i make it to i check if mob type is skeleton and make mob as skeleton like this:
Skeleton ent = (Skeleton) mob;
someone understand it?
use World::spawn
instead of spawnEntity
and pass the entity class instead of entity type
and it'll return an instance of that class and you don't need to cast or think about anything
hmmm, wait. i will try it
nah, i mean. how to i pass entity class according condition
wtf, use switch/case everywhere
why if, when variants more than 1?
it would be helpful if you mentioned what the fuck you were doing
yes
so far all we've heard has been incomprehensible babbling about loops and skeletons
what are you doing
i want to pass entity class to some mob according condition, if string == jombie
pass entity class Zombie, and if string == some mob, pass entity class someMob
i think you understand what i mean
that is your attempted solution
but what are you actually doing
what are you trying to achieve
?paste
couldnt get an answer either
Why do you need that
okay, ihave some code
https://paste.md-5.net/ulecojiqez.cs
i want shorten or make it effective with loop
how to do that
You want different behaviour for every mob right
just use the superclass LivingEntity
instead of passing a string to this function, you should pass an object that defines the behavior you're stacking in here
this is a textbook example of oop being done wrong
what i have to use
yes
how do i check for errors in eclipse
maybe you can give a little example. my brain has exploded after explaining
Then you should use a hashmap between whatever you use to identify a mob and an object which applies the desired changes
oh yeah, makes sense
ohh yeah, i can't figure it
give me a little example
For example you are using very similar code for setting the name of the mob
Just have one function for that and make them all use it
hey if im updating a plugin and if i just add the latest spigot in the build path do i need to add the previous spigots the plugin was built with
No
thanks
Well not unless it contains NMS
new BukkitRunnable() {
int countdownTime = 10;
String word = "seconds";
@Override
public void run() {
if (countdownTime == 0) {
player.sendMessage("Countdown over.");
// do something to stop it
}
if (countdownTime == 1) {
word = "second";
}
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&6[&eArena&6] &7Match starts in " + countdownTime + " " + word + "."));
countdownTime--;
}
}.runTaskTimer(Bukkit.getPluginManager().getPlugin("ArenaPlugin"), 100L, 20L);
``` How do I stop this task after `countdownTime` has hit 0?
hi guys how would i make a custom plugin loader? i have a plugin that can have many addons, and i dont want to put them in the plugins folder
Take a look at how we do it
can someone give me an example instead of psuedocode?
example of what
the
That's real code they have just it's a cleaner format for return statements that depend on conditions
That's not psuedocode
Do you understand the top if statement?
public SpawnTask createAFuckingSpawnTask() {
return (spawnTaskList.hasSpace() ? new SpawnTask() : null);
}
``` or whatever
can be understood as
return a new SpawnTask if the list has space and if not return nothing (null (null isnt really nothing))
How do I cancel Runnable task?
Basically a condition followed by a ? Operator is the same thing as an if statement, and the following param will be sent if it is true and the operator after : is what to return if it is false
boolean ? true : false;
If you use IntelliJ it will auto suggest improvements to your code that use those statements
this.cancel();
o
ty all
ty
hm I have an idea but I should really talk to resource staff about it
is there a way to speak to resource staff directly?
?support
Its yours I believe
can i get some help?
on line 29 if i add a sound other than the one already entered it gives me an error saying ""sound name" cannot be resolved or is not a field
What other sound are you using
im trying to replace that with block.bell.use
Isnโt that a sound too?
Just get it from the enum
declaration: package: org.bukkit, enum: Sound
How do I disable block drops?
How do I safely get the UUID of a player (who has to have connected to the server atleast once in the past, but may or may not be currently online) from their playername in Bungeecord? I'm trying to write an economy plugin when players are stored in a database by their UUID and I'm wanting commands such as /bal [player] meaning I'd need to convert the entered playername to the respective UUID (or find tat no such player exists in which case I would return an error to the player)
what if the player wants to type in their uuid instead
I could make that an option I suppose but I highly, highly doubt all players (or even a few) will want to do that
Guys i found that since 1.17 version all of packets class are in "net.minecraft.network.protocol.game" instead of "net.minecraft.server.[verision].[className] . Does it mean we no longer need to care about NMS reflections?
they no longer include version's
yea ๐
Some classes may be in other packages so just know that, if I recall it follows Mojang's packages now
what about bukkit, it as well remove verions from packet path?
Like if a user is running bukkit?
Should be the same due to it being maintained by Spigot
this is my old code to get bukkit class, so now i not longer need to include version?
Im not sure on that, id check but I dont got a jar right now
I tried making an event that cancels BlockPlaceEvent when you place a player head, tried this and whenever i put heads on the side of a block, it doesnt work the block gets placed. Any way to fix this? Heres my code
public class block_place implements Listener {
@EventHandler
public void onItemPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
if (event.getBlockPlaced().getType() == Material.PLAYER_HEAD) {
event.setCancelled(true);
}
}
}
because then its a PLAYER_WALL_HEAD
also make sure to follow the java naming conventions
I was just using the standard snake case that minecraft uses, but i will only use them for my custom item classes
java.lang.ArithmeticException: / by zero I have never seen this in my life
well it's my personal preference anyway
private List<Location> line(Location start, Location end, double distanceBetweenLocations) {
List<Location> locations = new LinkedList<>();
Vector line = end.toVector().subtract(start.toVector());
for(double d = 0; d < line.length(); d += distanceBetweenLocations) {
line.multiply(d);
locations.add(start.clone().add(line));
line.normalize();
}
return locations;
}
Anyone know why this doesn't work - i am trying to get a list of locations on a line
you out here roasting him
thats how python names stuff and i hate it
before you judge this is godciphers code
so
blame him
ye
i forget, is it:
line.normalize();
or
line = line.normalize();
the former right?
oke
okk
private List<Location> line(Location start, Location end, double distanceBetweenLocations) {
List<Location> locations = new ArrayList<>();
Vector line = end.toVector().subtract(start.toVector());
line.normalize();
line.multiply(distanceBetweenLocations);
for(int i = 0; i < 50; i++) {
locations.add(start.add(line.multiply(i)));
}
return locations;
}
or have i misunderstood
guys do you know some good launcher? i need to test plugin on 2 accounts
Location is mutable right? So you need to clone it if you want to have multiple ones.
You can also try 2 approaches to determine the end condition.
- Calculate the number of iterations need beforehand
- Check the current lenght.squared against the full distance.squared
The first one is faster.
turn it to offline mode and then get something like https://mc-launcher.com/special/minecraft.html
obviously i never said that...
it could be in online mode i have mutiple accounts
lets see if my account will be stolen
myeah i always just use a fake one
sorry i got sidetracked by the venom trailer
im back
This would be my approach:
private List<Location> line(final Location start, final Location end, final double distanceBetweenLocations) {
final List<Location> locations = new ArrayList<>();
final Vector fullLine = end.toVector().subtract(start.toVector());
final double fullLength = fullLine.length();
final Vector deltaLine = fullLine.clone().normalize().multiply(distanceBetweenLocations);
final int increments = (int) (fullLength / distanceBetweenLocations);
locations.add(start);
for (int i = 0; i < increments; i++) {
final Location nextLocation = locations.get(locations.size() - 1).clone().add(deltaLine);
locations.add(nextLocation);
}
locations.add(end);
return locations;
}
.
another discord server in my list for just one emoji
No. It gives you N locations depending on the delta you specified
Yeah that should be good
Yeah this works too
private List<Location> line(final Location start, final Location end, final double distanceBetweenLocations) {
final Vector fullLine = end.toVector().subtract(start.toVector());
final double fullLength = fullLine.length();
final Vector deltaLine = fullLine.clone().normalize().multiply(distanceBetweenLocations);
final int increments = (int) (fullLength / distanceBetweenLocations);
final List<Location> locations = new ArrayList<>(increments);
locations.add(start);
for (int i = 0; i < increments; i++) {
final Location nextLocation = locations.get(locations.size() - 1).clone().add(deltaLine);
locations.add(nextLocation);
}
locations.add(end);
return locations;
}
But it doesnt make a huge dif
Wait. Does an ArrayList with initial size have null entries?
lmao
This came to mind because i thought about what would happen if i initialised an array with the given length and then wrapped it in an ArrayList later.
the insults are flying
Hi, i'm trying create packetplayoutentitymetadata using reflections, so i have one question, it is ok?
Class c = Class.forName("net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata");
Class types[] = new Class[3];
types[0] = Class.forName("java.lang.Integer");
types[1] = Class.forName("net.minecraft.network.syncher.DataWatcher");
types[2] = Class.forName("java.lang.Boolean");
Constructor constructor = c.getConstructor(types);
Object argList[] = new Object[3];
argList[0] = armorStand.getId();
argList[1] = armorStand.getDataWatcher();
argList[2] = true;
Object object = constructor.newInstance(argList);```
Ofc because the backing array is copied with System.arrayCopy. Just was confused if giving an initial size would change the element count. Btw can you specify a custom growth function in default java lists? Never checked
Really? So changes on the list are reflected in the array?
Ew
Nice. Naming is on point.
Yes this looks right. Didnt check the argument types but the reflection part looks right.
Make sure you cache reflection Objects as they can get really costly.
Ah interesting
ok, then if that's okay, I'd like to send this as a packet, ie should I cast object to a packet?
@left swift What code do you use to send a packet to player?
((CraftPlayer) p).getHandle().b.sendPacket(packet);
If you use reflections like that then you probably want to go the full mile instead of using NMS directly after using it via reflections.
Why do you use reflections then anyways if you use NMS on your classpath like that?
Server and development versions dont match
I wanted to use reflection because when I used the normal PacketPlayOutEntityMetadata nms class I was getting this error
is there any other way to fix this?
ugh, I generally get the same error with these nms classes :/ what to do about it?
import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
import net.minecraft.network.protocol.game.PacketPlayOutMount;
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;```
This doesnt work?
public void sendNMSDataWatcherPacket(final Entity bukkitEntity, final Player receivingPlayer, final boolean forceUpdate) {
final net.minecraft.world.entity.Entity nmsEntity = ((CraftEntity) bukkitEntity).getHandle();
final PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(nmsEntity.getId(), nmsEntity.getDataWatcher(), forceUpdate);
((CraftPlayer) receivingPlayer).getHandle().b.sendPacket(packet);
}
thx i used spigot1_17.jar dependency instead of 1_17_1 that sever uses
yup, cannot access this is my code ->
Player p = e.getPlayer();
WorldServer server = ((CraftWorld) p.getLocation().getWorld()).getHandle();
EntityArmorStand armorStand = new EntityArmorStand(EntityTypes.c, server);
armorStand.setSmall(true);
armorStand.setMarker(true);
armorStand.setCustomNameVisible(true);
armorStand.setNoGravity(true);
armorStand.setCustomName(CraftChatMessage.fromStringOrNull(p.getName()));
EntityItem item = new EntityItem(EntityTypes.Q, server);
item.startRiding(((CraftPlayer) p).getHandle());
armorStand.startRiding(item);
PacketPlayOutSpawnEntity itemPacket = new PacketPlayOutSpawnEntity(item);
PacketPlayOutMount itemMount = new PacketPlayOutMount(item);
PacketPlayOutSpawnEntity armorStandPacket = new PacketPlayOutSpawnEntity(armorStand);
PacketPlayOutEntityMetadata armorStandMetaData = new PacketPlayOutEntityMetadata(armorStand.getId(), armorStand.getDataWatcher(), true);
PacketPlayOutMount armorStandMount = new PacketPlayOutMount(armorStand);```
Full stack trace on this pls. Ill soon need this too as im updating my hologram API to 1.17 ๐ฆ
arent holograms like rly easy
Not if you want to properly implement them with audiences, chunk loading/unloading etc
I dont know what that means...
Mind showing more code? This bit in the beginning doesnt tell much
I literally know nobody who had a mem bottleneck before a CPU one.
not when u have a 1gb server lol
Wait. Did the guy literally remove his message and then vanished?
i might learn protocollib or what was its name but idk if its useful
do any of you know if worldedit schematics save tile entity NBt?
ooh
nice
tysm
By custom you mean PDC i hope?
idk the correct terminology, tags
What version are you on?
1.16
Ah ok. Use PersistentDataContainer on them then you are on the safer side
So you are about to lie?


