#help-development
1 messages · Page 1140 of 1
I dont remember the exact name of the PE wrapper but it's name will be similar to the wiki vg name
very often
ight, cool
retrooper from this community is the dev for it, hes suiper active
right so I've got the wrapper WrapperPlayServerPlayerInfoUpdate
how do I find the event
as in how do you listen for it?
yes
and that in your main
just one listener for all packets?
indeed
usually you want to have multiple listeneres and just an if statement to discriminate
fair enough
brother what are you doing
we told you, use text displays, you're just going to suffer more with packets
blue line
.
why does that matter
you don't see that unless you press F3 + some key combo
trust the process
No Cartboard
if so, then just change the player profile
yeye
does it change per player
or to all
to everyone
yeah thats an issue
you can still use it and just intercept the packet so that you can change what is displayed per player then
whats the point then
setting the player profile without the API will cause desyncs you don't want to deal with
?
it doesn't matter what the client receives, but it does matter what the server has stored
I dont get it
whats wrong with just intercepting it
without setting it beforehand
I dont even know what I would be supposed to set it to
his normal name
which it already is?
I mean, you could intercept it on join too, it's whatever
I was thinking you wanted to change it mid-game
I did
then do what I suggested
I dont understand what you are suggesting
setting the player profile will send a packet
right
you intercept that packet and only change the name for every player
okay but whats the point of the first change on the server
if it will be different for every player
ig it doesn't matter since you don't want it to be persistent anyway? Hm
changing the name requires sending a player info packet, and a respawn packet (among updating a bunch of other stuff)
however you aren't changing it in this case but just intercepting the player info packet for each player
respawn packet?
I am not aware of whether that works properly, but you can try
yk what
ill just try it
and come back when it doesnt work 💀
uhm so
how do I change a packet? 💀
?paste
Right i did that
But heres the issue
Changing game profile name changed both tab and above head
How do I only change above head
They are one in the same
Unless you also want to spoof the tablist separately
yes
I hate this so much
I mean, this is what you gotta do to not see a blue line
Can I somehow make it ride the player 100 blocks higher?
Why do you have such an issue with a hit box line
Its annoying af
To who
Me
You won't see it 90% of the time
I just cant have it
Wait untill you find out any servers that use TAB to change overhead name use armor stands and just don't care about the hitbox line because most sane people can tell what the players hit box is
Ill go check
Nah but thats just cap tbh
Im pretty sure pvplegacy doesnt do it like that 🤓
TAB still using armor stands for that? I thought it was only for versions that didn't have text displays
do you play pvp with hitbox view
I didn't think that was all important in newer versions
since you don't have to be fast to aim, at least not as fast as one used to
Hell yeah
What hitbox line are we talking about
The blue line
Surprisingly yeah
.
TAB USES ARMOR STANDS??!!
Yeah
Because you shouldn't
Cuz ngl, I dont think I saw a blue line with tab
And they still have blue lines
Am I tripping then??
Why not
Okay but
I need old version support
And where is their blue line
Cuz ngl I dont see no blue lines
Okay actually fair point
Making 2500 armor stands on a good day doesnt seem like the brightest idea
The marker flag might get rid of it
since that shrinks the hitbox to effectively 0
Will check give me a min
nah it still shows the direction vector pretty sure
the hitbox size is zero but it still exists
feet
Why is it here
ok base plate
which is gonna be above your head anyway
because that's just how minecraft works?
^^ and because that's where the hitbox is
the entity exists and is there
And wdym by that
it's always gonna be above your head because it's gonna be riding the player
and that's where it is
it's always gonna give you head
So ur telling me that there has always been a straight line at players head when using tab?
uhm
I was waiting for someone to make that joke tbh
I used to play with chunk borders enabled 💀
I tend to forget to turn them off
ok and
Tab didn’t have it as a passenger
Because it would be offset weirdly
Pretty sure they constantly teleported it
this is the way
guys how to parse placeholder's placeholder
like %luckperms_prefix output is %img_player% but it does not parses given placeholder
how can i parse all given placeholders
Use papi
I believe it’s a single method call
i know
i already use papi
if any placeholder gives another placeholder how can i parse?
Uhh
I mean you can run it though the method twice
Idk if papi has a better system for that
if it gives placeholder again?
i think run PlaceholderAPI.setplaceholders() twice
not good idea
just test it out to see if it even works in the first place
java.lang.NullPointerException: Cannot invoke "me.arkallic.core.manager.TaskManager.getTasks()" because "this.taskManager" is null
But its not, It works in another method in the class just not there
that doesn't happen for text displays tho, does it?
if you are getting a NPE then it is
the order of initialization is messing with you most likely
make sure that taskManager is initialized before whatever class you are using
It is. It doesn't register till the player runs the command to open the GUI.
Taskmanager is before GUI
private final RankManager rankManager = new RankManager(this);
private final TasksFile tasksFile = new TasksFile(this);
private final TaskManager taskManager = new TaskManager(tasksFile);
private final PlayerDataManager playerDataManager = new PlayerDataManager(tasksFile, taskManager, rankManager, this);
private final LangHandler langHandler = new LangHandler(this);
private final GUIManager guiManager = new GUIManager();
private final Listeners event = new Listeners(this);
private final Commands cmd = new Commands(this);
public void onEnable() {
tasksFile.initialize();
taskManager.initalize();
langHandler.initialize();
//Commands
cmd.register("core", new CoreCommand(playerDataManager));
cmd.register("rank", new RankCommand(rankManager, playerDataManager));
cmd.register("setrank", new SetRankCommand(rankManager, playerDataManager));
cmd.register("home", new HomeCommand(playerDataManager, langHandler));
cmd.register("sethome", new SetHomeCommand(playerDataManager, langHandler));
cmd.register("deletehome", new DeleteHomeCommand(playerDataManager, langHandler));
cmd.register("maxhomes", new MaxHomesCommand(playerDataManager));
cmd.register("tasks", new TasksCommand(taskManager, guiManager, playerDataManager));
//Listeners
event.register(new PlayerDataListener(playerDataManager, langHandler));
event.register(new PlayerJoinListener());
event.register(new TaskListener(taskManager, playerDataManager));
event.register(new GUIListener(guiManager));
//Reload
for (Player player : Bukkit.getOnlinePlayers()) {
playerDataManager.register(player.getUniqueId());
}
getLogger().info("Core is online!");
this.saveDefaultConfig();
}```
Caused by: java.lang.NullPointerException: Cannot invoke "me.arkallic.core.manager.TaskManager.getTasks()" because "this.taskManager" is null
at me.arkallic.core.gui.TasksInventory.createInventory(TasksInventory.java:51) ~[?:?]
at me.arkallic.core.gui.InventoryGUI.<init>(InventoryGUI.java:19) ~[?:?]
at me.arkallic.core.gui.TasksInventory.<init>(TasksInventory.java:24) ~[?:?]
at me.arkallic.core.command.TasksCommand.onCommand(TasksCommand.java:44) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.21.1-R0.1-SNAPSHOT.jar:?]```
can you show us the code causing this
and where its used
?paste
Where its used
https://paste.md-5.net/ubudavagog.java
Main class
https://paste.md-5.net/rukagegonu.cpp
is the inventory using the TaskManager initialized before the TaskManager is initialized? in like, another constructor or whatever?
but it is 😉 if it wasn't null it wouldn't say it was
use a debugger
or just run sysouts as you approach
or are you trying to use the same inventory perhaps after a reload?
yes
:] /reload isn't supported
rather close the inventory when disabling the plugin for everyone that has it open
this is why everyone should use InventoryView's instead that way its pretty clear you shouldn't keep em over reloads
Any time I browse the channel there's like a 75% chance he's shilling 
this one isn't a shill for new API its how I've always done things 💪
though... If you don't mind I have some words to say about new API
I just realized... did you review your own CB PR? lol
yeah I did
I must do what no one else wants to do
Still happens after a server restart
You only just removed it from draft status yesterday!
yeah I'm kinda next level like that
just moved from draft status and I already reviewed my own PR
the speed is stunning
when it comes to menus unless you absolutely need to share an Inventory the best approach is per player displays
it makes it pretty clear about the data etc that should be in that menu
Ive never messed with guis before so i just used this
https://www.spigotmc.org/threads/a-modern-approach-to-inventory-guis.594005/
I use a similar, but imho less naively implemented approach that does everything based off of InventoryView well in my case MenuScene because I wrote my own equivalent in NMS for my library
My design
https://github.com/PineappleDevelopmentGroup/Pineapple/blob/dev/pineapple-bundle/pineapple-core/src/main/java/sh/miles/pineapple/gui/PlayerGui.java
My implementation
https://github.com/PineappleDevelopmentGroup/PineappleEnvoys/blob/master/src/main/kotlin/sh/miles/pineappleenvoys/ui/editor/LootEntryEditor.kt
generally I feel like this gives the best results when it comes to interactable menus
Why did they make inventories api so dumb xD
there's nothing inherently wrong with it though
its just 8 years outdated
I think its time for an update 😉
The Inventories themselves shouldn't even be creatable imho
but you can use them here regardless kind of as a proxy view
just ensure 1 inventory per player
and don't save those views unless they store information, in which case they shouldn't be saved as inventories, but some other digestable structure you can use around your code
e.g. I have a collector plugin which provides a view of item stacks. I have my
CollectorMenu(SyncContainer)
these SyncContainers store all items that need to be serialized deserialized etc to bytes, and they contain a synchronize method which does the job of syncing all views.
I recognise that from somewhere hmmmm
I hope you do its from a plugin you worked on
I'd be concerned for your memory if you didn't remember
I don't remember what projects I worked on 5 years ago, and I have them stored in my projects folder lol
Different story for my buddy here who worked on it under a month ago 
bro has early onset alzheimer's
Who are you and what are you on about
Where am i
How can I make a player open the inventory of a block (barrel) with code
im trying with this but no inventory opens
Well yeah you only allow it to be opened if it's locked
That's just a faulty if statement
i want to block normal players to opening it
but allow admins to open
i know i can use nbt but
ehhh
Use pdc
what is pdc?
?pdc
You can use PDC on tile entities
I mean you maybe can
Again not opening is pretty vague
I'd need to know exactly what's happening
Bad if statement etc
nope
Does it appear for a second than go away?
nope
What version are you programming for
1.21.1
Alright give me a few minutes I'll pop open craft bukkit
I need to see what's going on here with min dif
there is it
okayy thank you
is ok
I think its possible the loc logic may be overriding the opening
this is very much what I suspected
one sec let me check again
I might be wrong
okie
probably
it is weird, it should work
depends on how internals of the lock key work
ye
Lock just requires an item with the right name atm
yea but i need the item to make administrators "open" the inventory inside?
I got it working with locks?
It works with and without the scheduler
full minimum def code
@Override
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
getCommand("test").setExecutor(new TestCommand(this));
}
@EventHandler
public void onInteract(PlayerInteractEvent event) {
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
return;
}
if (event.getClickedBlock().getType() != Material.BARREL) {
return;
}
final Barrel barrel = (Barrel) event.getClickedBlock().getState();
if (!barrel.getLock().equalsIgnoreCase("funky")) {
barrel.setLock("funky");
}
if (barrel.isLocked()) {
Bukkit.getScheduler().runTaskLater(this, () -> {
System.out.println("here");
event.getPlayer().openInventory(barrel.getInventory());
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_ANVIL_LAND, 1.0f, 1.0f);
}, 20L);
}
event.setCancelled(true);
}```
ive tried with scheduler before but ill try with more seconds
because you have some logical error
@EventHandler
public void onBarrelUse(PlayerInteractEvent event) {
if(event.getHand() != EquipmentSlot.HAND) return;
if(event.getAction() != Action.RIGHT_CLICK_BLOCK) return;
Block clickedBlock = event.getClickedBlock();
Player player = event.getPlayer();
CooldownManager cooldownManager = KobasPub.getPlugin().getCooldownManager();
if (clickedBlock.getType().equals(Material.TRIPWIRE_HOOK)) {
if(cooldownManager.hasCooldown("tripwire", player.getName(), 3)){
player.sendMessage(color("&c¡Espera un poco para hacer esto denuevo!"));
return;
}
TripwireHookHandler handler = new TripwireHookHandler(clickedBlock, player);
if (!handler.isValidBarrel()) return;
Barrel barrel = handler.getBarrel();
if(!barrel.isLocked()){
barrel.setLock(player.getName());
barrel.update();
}
handler.powerTripwireHook(true);
delayedTask(() -> handler.powerTripwireHook(false), 1.5);
player.getInventory().addItem(barrel.getInventory().getItem(0));
}
if (clickedBlock.getType().equals(Material.BARREL)) {
Barrel barrel = (Barrel) clickedBlock.getState();
if (barrel.isLocked() && player.hasPermission("kobaspub.inspect")) {
/*Inventory pInv = Bukkit.createInventory(null, InventoryType.BARREL, "Almacén");
pInv.setContents(barrel.getInventory().getContents());*/
delayedTask(() -> player.openInventory(barrel.getInventory()), 2);
}
}
}
mm
my only guess is its not passing your inner if statement
I also double checked it works with right click too
I don't think its even reaching that code
weord
okay I noticed it doesn 't work when I'm not opped
for some raeson
christ
I am actually creating a monster
and I can't do anything about that
this is sort of cursed
okay found the issue
its 100% with locks
you need to use PDC instead
it delegates the open method to createMenu which checks if you have a valid lock
@Nullable
public Container createMenu(int var0, PlayerInventory var1, EntityHuman var2) {
if (this.canOpen(var2)) {
this.unpackLootTable(var1.player);
return this.createMenu(var0, var1);
} else {
return null;
}
}```
essentially you can't open it without a lock no matter what
public boolean canOpen(EntityHuman entityhuman) {
return canUnlock(entityhuman, this.lockKey, this.getDisplayName());
}```
damnn
it'd be innapropiate for us to go actually do anything about this too
Locks are kinda just blegh
PDC is an easy solution <3 it'll be pretty much a simple drag and drop for the most part
anything you're doing with locks can be replaced with a pdc stored string
what does setMaximumNoDamageTicks do
thank you so much
?jd-s
"Sets the living entity's current maximum no damage ticks." doesn't really help
what are maximum no damage ticks
invulnrability ticks I'd assume
maximum no damage ticks is pretty much anagolous to the concept of invulnrability I'm assuming its under a different name to reduce confusion between setInvulnrable and this
the interanl name is legit public int invulnerableDuration;
whats the difference between setMaximumNoDamageTicks and setNoDamageTicks
weird
are you certain they are the same?
considering I have craftbukkit open right now
yes
they set the same exact field
of course the set the same field
oh wait no I fucked up
they are named slightly differently lol
thanks for questioning me
one is named invulnerableTime and one is named invulnerableDuration
the first one sets a time period they are invulnerable
the second is permanent with no tracking how long
Then why does it take an int
if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN)) { // CraftBukkit - restore use of maxNoDamageTicks
that's where its duration
yeah mojang is weird
yeah that too
So for an entity to be invulnerable the invulnerable time has to be > half the invulnerable duration
isn't that so nieche
also invulnerableTime ticks down every tick
What’s the default invulnerable duration
where as invulnerableDuration does not
its just used as an upper bound it seems
so if you set it to 0 as long as invulnerableTime > invulnerableDuration you can't take damage?
Is it 0 by default
its 20 by default
That explains why setting it to 1 didn’t work
The comment is also interesting
We restored the use of it? Was it removed at some point
yeah it makes me think it was originally removed
let me look at vanilla
OrbitMC Ftw
its legit not used in vanilla
this is some weird CraftBukkit thing
the field just exists in Vanilla but its never used
my guess is this some weird backwards compat play
actually gonna do that now
it seems like it happened in the update to 1.17
with no further explanation
I’m just wondering why the heck it was a thing in the first place
my assumption is mojang removed it in 1.17 and this provides backwards compat
A simple tick counter for invulnerability makes sense, idk why some weird math would need to exist
mojang removed the weird math
in vanilla now its just the tick counter
Yeah but I’m wondering why Mojang had it in the first place
It must have had a purpose at some point
Imo it would make more sense to remove the patch and deprecate the method (and just have it do nothing)
but ¯_(ツ)_/¯
I wonder what % of plugins actually use that method anyways it seems fairly neiche to begin with
it also makes setNoDamageTime more ambiguous
I'd imagine anyone who does use it thinks its broken as well
and likely dips into NMS
It being 20 by default is extra weird
Means setting invuln time to < 10 doesn’t actually do anything
aren't you in the super secret spigot I feel like that's maybe something you could bring up, though I'm not really sure how the deprecation would flesh out.
Yeah idk
It’s technically a breaking change
But the patch is a deviation from vanilla behaviour, which is also not ideal
I wonder what else that fucks up as far as damage goes tbh
Idk
Isn’t the invuln time used for the immunity frames when stuff gets damaged
Does this make them shorter than they should be?
yeah
that's what I'm thinking might end up being happening
I feel like its gotta be pretty unnoticable if no one has noticed, but whether it should continue to be like that is another question
ohh
this makes so much more sense now
// Vanilla
if (this.invulnerableTime > 10.0F && !damageSource.is(DamageTypeTags.BYPASSES_COOLDOWN))
// CraftBukkit
f ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN))
Vanilla just inlined it, that or my decompiler inlined it because it was never changed and was final
So in vanilla invuln time also has to be above 10 for it to work
yeah, again a weird choice, but it seems the only difference is the inline
Weird but okay
so it seems the API allows you to modify the weird modifier for the invulnerableTime to work
possibly
Or maybe Mojang just wants 10 to be the new 0
10 is 0!
It gets even weirder though
invulnerableTime is never used on the Player
How do player iframes work then
20 is applied for all living entities besides a few
but everything else is done through yet another field
like spawnInvulnerableTime instead of using the already existing one
Mojank
also the 10 can't be a client thing
the hurtDuration is yet another field for animation the hurt
@Override
public void animateHurt(float f) {
this.hurtDuration = 10;
this.hurtTime = this.hurtDuration;
}```
TIL this is fucking weird and those spigot docs need to be better
clearly you've never been in pain
oh my it gets even weirder
if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN))
Basically if this statement is false
// CraftBukkit start
if (!this.actuallyHurt(damagesource, (float) event.getFinalDamage(), event)) {
return false;
}
this.lastHurt = f;
this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks
this code runs and the invulnerableTime is updated to the invulnerableDuration which gives exactly half of the invulnerableDuration iFrames
oh no
this is really cursed guys
I don't know if I should enforce 2-way validation
I think I have to?
2-way validation magma guy you're better than that We all know you don't need 2 way validation because everyone knows if they fuck with you their life is basically over
yeah I don't think I have a choice here
So if you hit something while it’s invulnerable it’s remaining invulnerability time changes?
I picked one hell of a project to stop drinking coke 0 for
where is invulnerableDuration modified
by CraftBukkit
that's it
its a constant
I'd imagine setting it could fuck other plugins over
I would avoid setting that value tbh
Ah I think I see what happens
If you deal more damage during the iframes, the difference is dealt to the mob and the iframes are refreshed
interesting
And increasing the duration of iframes isn’t linear
With a value of 20 you get 10 ticks of invulnerability (default)
If you set it to 50 you’d have 25 ticks
I still don't really get the point of dividing it in half couldn't you just set the half value
Yeah idk
If it was me I’d just set the actual value
Ie a value of 20 would be 20 ticks of invuln, 50 would be 50, etc
¯_(ツ)_/¯
/**
* Sets the living entity's current no damage ticks.
* <p>
* Setting the ticks value to less than {@link #getMaximumNoDamageTicks()} / 2
* provides no ticks of invulnerability frames. To ensure invincibility
* frames actually occur you must set an amount of ticks greater than
* {@link #getMaximumNoDamageTicks()} / 2
*
* @param ticks amount of no damage ticks
*/
public void setNoDamageTicks(int ticks);
``` I feel like this clarification would help
tho I'm going to definitely need to test this before
to ensure I'm not tripping
You can drop the tick speed to test more accurately if needed
(Love that feature Mojang <3)
Ik its great
oh stepping would be great here
I could also probably use a debugger
I'll look at it closer tomorrow If I get time ig
ok
I think I have it figured out
this is going to be as fun as it will be tricky to make work
this is probably the first O(no) notation code I've ever written
it's pretty bad 🤡
lol
if I'm using spigot 1.8.8 what would be the best way to place/remove smallish 10x10x10 structures
I really don't want to use worldedit and I think the structure api hasnt been added yet
should I write my own filetype which is just a big array
who doesn't like iterating through over 3000 elements per 16x16x16 piece of terrain on the lowest end possible, with no real ceiling?
actually it's probably way more
I don't want to update the math
what would be the best way to go about it
?workdistro
1.8.8
augh
A nice rabbit hole you encountered
Always fun when you find weird code with no clear documentation to it lol
How do I shade a plugin into my plugin jar
you don't
Wrong question
How do I shade packet events into my plugin
😎
please don't
Bruh
If you shade PE, then you'll have to release a plugin update for every PE update
aand if you don't, there's no need
ok so now to account for every possible rotation
with every single interaction this thing can have
I'm sure this will be computationally cheap
trust
What are you making, looking interesting
Hi, I'm currently refactoring somethings in a fork of a invs lib, my problem is about the opening/closing menus and setting items during click event, which need to be sent in next tick or it won't work (As warned in the javadocs), so I'm thinking of an approach which what literally does is:
Take the operation -> Schedule it directly to the next tick
Some advantages from my prespective and from what I really want to solve:
- Boilerplate code: No need for
plugin.getServer().getScheduler().runTask(() -> openInv())which literally looks like PSVM but being put in every single piece of code. - Consistency: No more guesses whether the item is shown or not, next tick guarantees the item being set.
- No more
player#updateInventorywhich literally sends a whole inventory everytime I want to modify a single item?
Cons:
- Not consistent in rare scenarios: If the player sent a click/open/close/(set item) event in the next tick and got fired before my scheduled task (i didn't really test if scheduled tasks get fired before the events/interactions made by players).
Pseudocode Example:
Menu{
void open(Player player){
schedule(() -> player.openInventory(inv));
}
void close(Player player){
schedule(() -> player.closeInventory());
}
void set(int i, ItemStack stack){
schedule(() -> inv.set(i, stack));
}
void schedule(Runnable task){
scheduler.runTask(task); // BukkitScheduler#runTask runs the task on the next tick.
}
}
However, as I didn't see it before, does it have any potential drawback would you guys think about? Like for now I don't see anything wrong with this design approach, because literally opening a new menu when clicking an item in another menu is a PAIN even tho it's basic stuff.
Is it poor practice? or the proper way of handling inventory events? (Also I'm 100% sure my invs will only and only be modified from my wrapper, it's not for public btw)
Feel free to @mention
Wdym by that first one
PSVM? public static void main args
Your approach sounds fine
Infinite City Generator
Wanna send updates into the channel if you have one ^ Would be cool C:
wave function collapse or boring simplex noise?
gimme some of that quantum noise
Why use simplex noise when you can use advancple noise
wave function collapse
who do you think I am doing that boring simplex shit, imillusion?
@echo basalt
Im making an auto condense plugin, what event should i listen ? PlayerPickupItemEvent work great, but... if i give people item, is PlayerPickupItemEvent is fired or not ? If not what event should i use instead ?
Maybe should i listen SET_SLOT packet with protocolib api ?
How can I disable light level requirement for planting and growing crops?
I think u can listen BlockGrowEvent event, check if the block is a crop that has light requirements like wheat / carrot etc and then setCancelled(false) the event, that will ensures the crop will grow no matter the light level
no grow event will fire if its not trying to grow, so has light
yep u right idk soo
A grow event only triggers if all conditions for the crop to grow have been met
So basically I have to manually check for all crops in player's range and then execute my custom logic for found crops? Like coding another random tick feature?
by sending player info update packets
?
Where is it in the player info update packet
Valid
ahh, packets are "fun" lmao
Is there someway of making this task more efficent, it's currently running async and the metrhod isInViewDistance just calculates the distance from the corpse npc to the target player, but it makes the server lag
public void run() {
corpsesManager.getAllCorpses().forEach(corpse -> {
Bukkit.getOnlinePlayers()
.forEach(player -> {
if (isInViewDistance(player, corpse)) {
if (!corpse.isVisibleFor(player)) corpse.setVisibleFor(player);
return;
}
if (corpse.isVisibleFor(player)) corpse.setHiddenFor(player);
});
});
}```
Don't duplicate the isVisibleFor call
Other than that get us a spark report of the lag caused
Yeah I don't imagine this is the thing causing your issue
i mean, a) if it's running async, that code can't cause lag, b) that is likely not thread safe lol
^^
is there a way to detect every time a player gets an item ? i know about the PlayerPickupItemEvent but im asking for a way to check for a player receiving an item in any way, including Player#getInventory()#addItem(ItemStack...), i want to make an auto-condense plugin
no, not unless you constantly monitor the inventory using a snapshot
So if I understand correctly, I need to perform a task every X time to check the inventory of all players who have autocondense enabled, and then condense items if possible. is this will be resource-intensive ?
depends how you write it
every x take an inventory snapshot, pass it off to an async task to compare.
Emily proving yet again that async = fast
if it has changed since the last snapshot, condense and update changes
every x ? Like one second is okay ?
thats up to you to decide
however, as you are making changes to the inventory you have to be careful it doesn;t change between the time you take your snapshot, condense and then update
I have no idea how much this can impact a server's performance. But anyway while it's in a async task this shouldn't be an issue right ?
Yep that what i was thinking about, it's not realy safe so
So this can cause duplication bug ?
is this WFC
I love WFC tbh
well
so technically I am pretty sure this is so different from wfc that it maybe couldn't be considered 100% that anymore
I'm trying to improve on its limitations
it uses a border/tag system instead of a list of valid adjacent tiles and it natively supports any individual tile rotation (except when a tile is configured to affect the rotation of tiles above itself)
but those are non-trivial differences
usually advanced WFC uses a grid of tiles on each side to determine matches
i.e.
| # |
| # |
| # |
| # |
| # |
this makes a 5x5 grid where the center has to be filled on that side
I'm not sure I get that illustration
If this is on the NORTH side of the tile, you can only put another tile that has the same tile pattern on the SOUTH tile
Fr it's fun as hell this is why I love the server there are so many odd little things like this
I love figuring out how stuff works it's one of my favorite things about programming
was gonna ask - the new item displays, how can i set like a nametag above them, like a hologram, just needs to be 1 simple number
I'm probably wrong but I think you need a TextDisplay for that
setCustomName worked
were chillin
W
omg that got me so hard xD
ah yeah i do that
but I do that with tags
also not only am I using tags instead of tiles but I allow any rotation
which I must say does complicate things
:(
how would I save the type of block such as type of log and set it later for 1.8.8
I know support isnt offered but I can't hurt to ask
sets the block but default settings
I need to save and set the correct colored clay and orientation of slabs etc
yeah 💀
damage values
is there really no way to download resources from spigotmc api without web scraping
Did getState exist back then
what
yeah but no setState so
That copied all of the blocks data
what
BlockState#update
Assuming you want to place it back in the same spot
Otherwise I think getData would get you the extra data
tried getdata and then getstate.setdata and doesnt work
just doesnt set the data I guess
it may sound like a dumb question but i cant find the material for an itemstack material on 1.21
ill do some debugging
I believe there was a setTypeAndData or something
I'm striking lightning on a trident in a projectilehit event and that destroys the trident
I am trying this to stop it, but noticed I the events never get logged, is this another event? if so which one is it?
@EventHandler
public void dontDestroyTridentPls(EntityDamageEvent e){
Bukkit.getLogger().info(e.getCause().toString());
Bukkit.getLogger().info(e.getEntityType().toString());
if(e.getCause() != EntityDamageEvent.DamageCause.LIGHTNING) return;
if(e.getCause() != EntityDamageEvent.DamageCause.FIRE) return;
if(e.getEntity() instanceof Trident){
e.setCancelled(true);
}
}
@EventHandler
void a(EntityDeathEvent e){
Bukkit.getLogger().info(e.getEntity().toString());
}
what on earth in an itemstack material 😭
because you need to re-set the state
the material for an itemstack
getState returns a snapshot, you need to call BlockState#update
Yeah it’s just getType
so getstate.setdata and then getstate.update?
oh thanks
ive used it like this:
ItemStack WIP = new ItemStack(Material.GRAY_STAINED_GLASS_PANE);
in 1.19.2
that doesnt work?
Yes that’s still the same
no
errors?
Does the material class not exist?
how do people not update intellij regularly?
Well enum but shh
and then how do I change the data of the block with that variable
not using the toolbox probably. The toolbox actually keeps me up to date constantly by annoying me
Yeah update IntelliJ
yes
MATERIAL IS AN ENUM?!
Yes
damn
lazy
call getState, put the result in a variable
change the data with BlockState setData on the blockstate variable you just made
then call update on the blockstate
Do you need the toolbox to get the proper version?
toolbox 🙏
no it just makes it more convenient
i don't know and frankly i don't care
im still using version 2023.1.2 is that may the problem
Yes
Just messed with packets
you can check, intellij is open source 👀
no clue what I did but it works so 👍 😃
idk if toolbox is
fk uhm im going to update in a sec
That’a over a year old
Well over
well
worked fine with 1.19
1.19 didn’t use java 21
1.19 is over a year old :o
thats true
so anyone got an idea?
bro
your checks never pass
Does IntelliJ follow some sort of quarterly release like eclipse does?
the cause cant be fire and lightning simultaniously
This is outdated
no shit
Does 2023.3.2 refer to Q3 2023?
the events never get logged
did you register your listener
he made it returned if cause isnt fire
and then made it return if cause isnt lightning
💀
ok that doesn't change the fact that they are logging at the very beginning of the listener and nothing gets logged
it does get executed
there are some other events that do work
you said it doesn't get logged lol
so that EventHandler isn't fired
but others in the same class are?
yeah, the trident still gets destroyed, I think its an entity but I can't seem to find an event that logs its destruction
that is not what i asked 😭
so when it gets destroyed nothing gets logged?
Out of context that’s an interesting statement
ye, the other events are getting fired, just not those I sent
lol?
in the same listener class?
yea
public class ChannelInRain implements Listener {
@EventHandler
public void onLaunch(ProjectileLaunchEvent e) {
}
@EventHandler
public void onHit(ProjectileHitEvent e) {
}
@EventHandler
public void dontDestroyTridentPls(EntityDamageEvent e){
Bukkit.getLogger().info(e.getCause().toString());
Bukkit.getLogger().info(e.getEntityType().toString());
/* if(e.getCause() != EntityDamageEvent.DamageCause.LIGHTNING) return;
if(e.getCause() != EntityDamageEvent.DamageCause.FIRE) return;
if(e.getEntity() instanceof Trident){
e.setCancelled(true);
}*/
}
@EventHandler
void a(EntityDeathEvent e){
Bukkit.getLogger().info(e.getEntity().toString());
}
@EventHandler
void b(EntityDamageByEntityEvent e){
Bukkit.getLogger().info(e.getCause().toString());
}
}
onlaunch and hit log
Hey, I want from my plugin to be able to send a player to my bungeecord server called "lobby" and found I could be able to use this :
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF("lobby");
Player player = Bukkit.getPlayerExact(p.getName());
player.sendPluginMessage(MyTumble.getInstace(), "BungeeCord", out.toByteArray());
but it never send me to the server lobby
did you register the handlers?
anyone know the default values of update(boolean force, boolean applyPhysics)
false, true
You're getting old
when are you sending that?
Not fast enough anymore
Force will override any other block that may have replaced the one the state represents
anyone know?
And applyPhysics I’m sure you can guess
what are you asking
my fault I didn't scroll further enough in the docs
.-.
i can stop that....
(or so I assume)
at the end of my function wich consist of sending a title to a player and then sending him to the server lobby

Block blockAt = player.getWorld().getBlockAt(x, 100 + y, z);
blockAt.setType(block.getType());
System.out.println("Data: " + block.getState() + " Type: " + block.getState().getClass().getName());
blockAt.getState().setData(block.getState());
if (!blockAt.getState().update(true, false)) {
System.out.println("failed to set block at " + x + ", " + (100 + y) + ", " + z);
}```
this isnt setting the state and also doesn't print that fail message
depends, it can be after an event and a command. It's a function called stopGame that can be triggered by an event (when the game normally finish) or with a command
example of log
[02:25:59 INFO]: set block at 1, 104, 6
[02:25:59 INFO]: Data: REDWOOD UP LOG(1) Type: org.bukkit.material.Tree
bro didn't get the whole put it in a variable deal
tree?
are you registering the channel in the messenger?
like this?
BlockState state = blockAt.getState();
state.setData(block.getState());
if (!state.update(true, false)) {
System.out.println("failed to set block at " + x + ", " + (100 + y) + ", " + z);
}```
what the hell is the point of updating the state to itself
am I tripping?
oh I'm not. blockAt is the current block and block is the new block
let me name my variables better
guys, random question, in sql, if I make a column with a BIGBLOB or whatever its called variable type, which afaik can hold 4 gb, is it gonna take up 4 gb for each element of only how much it actually needs
Block oldBlock = player.getWorld().getBlockAt(x, 100 + y, z);
oldBlock.setType(newBlock.getType());
System.out.println("Data: " + newBlock.getData() + " Type: " + newBlock.getData().getClass().getName());
BlockState state = oldBlock.getState();
state.setData(newBlock.getData());
if (!state.update(true, false)) {
System.out.println("failed to set newBlock at " + x + ", " + (100 + y) + ", " + z);
}```
okay this works thank you emily
honestly I don't understand how setting it to a local variable changes anything
It'd be wild if it took all 4 gigs
It'll only take what It needs
The cap is likely 4 gigs
whats a good file type I should dump a 3d matrix of blocks into
is json fine
maximum of 1000 blocks
only storing type and data
real
Use a schematic :p
I dont want to use worldedit as an api because first of all they don't offer support and have no documentation for 1.8.8 and two I want to keep the load times short and jar size compact
hear me out
just hear me out
dont use 1.8.8
Guys what are your opinions on guessing syntax
yeah unfortunately that is the bounds of my project and unfortunately cannot be changed
as like everyone else here I would love to be on the latest version
using java 21
im not gonna lie
jar size compactability wont help when your "schematic" files are gonna take up 3 trillion terabytes of space each
how big will it realistically be
big
storing 1000 Material objects and 1000 MaterialData objects
material data gets big
maybe theres a way to only store what I need
oh
I have all the data I need stored in an object. should I measure up how much memory it takes and it might give me a rough estimation on file size?
material is just an int enum and materialdate is just a byte
MaterialData has been deprecated for eons
I always forget that BS exists
Hey it’s better than the magic bytes
Haha magic!!
did some maths looks like my json file should be about 8KB
Ofc the new system is even better but yeah
surely thats better than a schematic library
I would be cautious with using magic numbers with materials
only storing them as magic numbers
Considering yk they're registry backed
and its not meant to be edited manually, moreover a command will edit the magic json
please I need approval before I do something stupid
This is 1.8, wtf is a registry
Oh legacy
Well if you're on 1.8.8 cope asf lolllll
When there are kids playing 1.8 younger than 1.8 you should probably update
You can use nms to modify the mob goal
Is there a 100% reliable way to detect when a player or the server itself changes the armor?
listen to inventory click and some other equip event
fr
oh wait dispenser
hm
ur right
There are methods like using a command, or using player.getInventory().setHelmet(), etc
If you want to detect that too
?nms
You need a repeating task
Ayo guess who's back needing help dab
me?
It's strange that this doesn't exist in Bukkit, to be honest 🐱
fr
but I guess it's kinda fair
paper
I'm gonna have to punish you for mentioning this forbidden name in the holy home of spigot
😔
once you try to do this, its also kind of a pain to narrow down what even is "armor changing"? bukkit also has ItemStack#setType (super dum), but that is changing the whole type of the armor when you call it on a mirrored stack
what about when a piece of armor takes damage, it's changed too, it has less durability
Idk who tf can not hate paper
and what is different about taking 1 point in durability damage and me switching between two pieces have have 1 point difference
uhm
the other stack having 1 more durability
I understand your first point. The second one, not so much
1 attribute of the stack changed. what about if a command enchants an item in place without it ever leaving the slot
There’s the PlayerInventoryChangeEvent PR which would allow you to detect any changes inside a players inventory
that is also 1 attribute changing
But its not merged yet
lol
whats the goal of this armor system
yeah, goals are always going to be different, which is why one event with a set definition of "armor changed" is difficult. everyone's gonna have different definitions of when something changed
Someone who has to make changes to their plugins so they also work on Paper because they changed things from Spigot lol
oh this is about the API itself?
hating something a little bit is better than blind love
Paperzzz
Aight so, trying to figure out NMS stuff (ProtocolLib is also fine, but I'm trying to limit dependencies for something so small)
Okay so, I'm trying to support the rest of the demo mode screens + Credits: https://wiki.vg/Protocol (Game Event -> Demo event)
101: Tell movement controls.
102: Tell jump control.
103: Tell inventory control.
104: Tell that the demo is over and print a message about how to take a screenshot.
I was able to follow the above guide and got that far.
Looking at Minecraft and it uses this.player.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.DEMO_EVENT, 0.0f)); (0.0f is the welcome screen (The only one spigot supports))
Looking at CraftBukkit's implementation of Player#showDemoScreen
getHandle().connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.DEMO_EVENT, PacketPlayOutGameStateChange.DEMO_PARAM_INTRO));
Using the mapped values I get the following code
serverPlayer.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 101.0f))
However, for some (likely dumb) reason my own code doesn't work, although it's basically the same but just using the mapped values 🤔
I'm confused as to why it is taking a float
oh it is a float in the protocol, wonder why
Here's the full class
set player's display name
lmao
give up bro 😭
just leave in shame
nah
what ever happened to shame bruh
I take the L with pride
prob cuz you aint verified?
oh yeah ur not verified LOL
yeah you're blue and I'm white
blueist
oh dear
🥸
blue lives matter bro 😔
poor Optic, nobody cared about their issue lol
like what the hell, my code should work. It's literally the exact same except it uses mapped values
NMS: this.player.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.DEMO_EVENT, 0.0F));
OBC: getHandle().connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.DEMO_EVENT, PacketPlayOutGameStateChange.DEMO_PARAM_INTRO));
My code: ((CraftBukkit) player).getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.DEMO_EVENT, 101.0f))
is that the only thing the showDemoScreen method does?
what the sigma
Sigma the what
@Override
public void showDemoScreen() {
if (getHandle().connection == null) return;
getHandle().connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.DEMO_EVENT, PacketPlayOutGameStateChange.DEMO_PARAM_INTRO));
}
``
No difference between it & my code functionality wise, only difference is I have to cast to craftbukkit first
well, are you sure the code is being called?
It should work. It's really strange that it doesn't
Yea, that's why I'm assuming I've done something stupid lmao
does the API method work for you
if that doesn't either then it might be a thing with your client rather than your code
🤷♂️
Eh. Since the rest are just text, I can just send the messages & use the api lmfao
Actually, probably not. Don't think I can copy the placeholders 😐
I was thinking you were trying to use packets directly to do something else with it
what are you trying to do
how do I look at the source of spigot
Trying to not copy as much code as possible, given ya know, these things are in packets lol
I wanna know why my teleport returned false but I got teleported anyways
?stash
ty
Specifically adding more things into https://www.spigotmc.org/resources/actionlib.117241/, which I use in a few plugins
Ehh, it's not programming. Purely config stuff
that is always how it starts
If I wanted to use an actual programming language, I'd just throw in lua support or some shit lmao
lmao, good to know teleport cause is useless
useful between plugins, sometimes
to signal its a plugin causing the teleport
yeah but the teleport function doesnt do anything with it
and when it changes dimensions it just uses PLUGIN cause
kotlin script
right
please, leave the server
but like
hehe
i dont understand then
As part of our vision for Swift to be a widely-used language for a wide variety of use cases and platforms, today at @SwiftServerConf we open sourced some early work on Swift/Java interoperability: https://github.com/swiftlang/swift-java. Excited to partner with others to expand this. @java
anything that calls craftentity.teleport(location, cause) will either not use the cause or change dimensions with PLUGIN cause
but gasp I can code, so I can just impl code java-side into a neat lil config option... which is what I do, instead of wasting my life away remaking skript like an idiot
it will fire a teleport event passing the cause
just debug a telport event listener for the cause
then call teleport passing a cause
mod idea
client-side guis without font fuckery
simple example: drawing text in a box:
- server sends packet to draw text
- client draws text
- server calculates text width and adds some padding
- server sends packet to draw box
- client draws box
is this a good idea
Would be cool if someone made mod so servers can make client side scripts
you mean like... RCE? 🧌
its a good idea
So basically spout lmao
oh wait
it's dead
Gmod
wouldnt be surprised if somewhere in the future mojang actually decides to work on something like that, but prob not
i wish dude
Probably not, gets in the way of bedrock lol
true
$
$$$$$$$$$$$$$$
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
why would the server decide what the client would draw
for someone as big as microsoft a few millions wouldnt even be a big deal
i mean
They make less if they implement it java side 🙂
they are entirely different teams making bedrock vs java
true..
like, completely different teams
Like Microsoft won't get any money if they did it.
atleast raytracing should originally go to java, but sadly opengl was in the way 😭
it looks cool
for who
for players?
wdym
it's just what you can currently do but easier
why is that cooler than the client drawing it