#help-development

1 messages · Page 1545 of 1

earnest sonnet
#

Send it, no biggie, mine is wrongly written, I'll have to edit it in a few hours

hybrid spoke
hardy swan
#

sus profile pic

#

ngl

tardy delta
#

so should i make a static Inventory or not for the getInventory() method or not?

hybrid spoke
#

pretty bad made, the whole thing is currently in recode to keep it clean and better up the performance. so don't judge me

hardy swan
tardy delta
#

idk

hardy swan
#

since the inventory belongs to the inventoryholder

#

think of it in real life

hybrid spoke
#

encapsulation is a thing

tardy delta
#

like this?

public class TradeGui implements InventoryHolder {

    private Inventory inv;
    private InventoryHolder holder;

    @NotNull
    @Override
    public Inventory getInventory() {
        return inv;
    }
}
hardy swan
#

^ this OK

hybrid spoke
#

the holder is unnecressary since your class IS-A InventoryHolder already

hardy swan
#

oh yea why is that there lol

earnest sonnet
#

Yes, way better, but remove the holder

hardy swan
#

maybe is a pair of twins

tardy delta
#

and then just a method that makes the inventory and return it and thats pretty much all?

earnest sonnet
#

nope, you have the getInventory() to return it

#

you only need to make it

tardy delta
#

so 2 methods would be enough?

#

oof

earnest sonnet
#

Not exactly, utilize the constructor

tardy delta
#

to?

hardy swan
#

to?

tardy delta
#

for what?

hardy swan
#

if you are constructing the inventoryholder

#

it would make sense to make an inventory for it at the same time right?

tardy delta
#

yes

#

i thought i was just constructing an inventory

hardy swan
#

hence, what he meant is you can create a new inventory instance in the constructor

#

avoid creating another method to set your inventory

tardy delta
#

so inv = new Inventory() ?

jagged monolith
#

What are the best ways to go about menu pagination? Are there any updated guides or something similar to help with understanding how to do pagination. Creating single menus is fine, it's more the pagination side that's confusing

tardy delta
#

inside the constructor

hybrid spoke
hardy swan
hybrid spoke
#

you just created you own by using the Bukkit class

hardy swan
#

you cant do that

hybrid spoke
#

inventory is an interface afaik

hardy swan
#

and that^

#

oh right

tardy delta
#

what do i need to put in the construcor then?

#

yea i saw that

hardy swan
#

the factory method is provided by Bukkit class

hybrid spoke
#

inv = Bukkit#createInventory just like you did before

tardy delta
#

ah that way

hybrid spoke
#

its not pretty good but enough

hardy swan
#

I mean, you can technically, inv = new Inventory(){
...
}
lololol

tardy delta
#

yea saw that

ashen flicker
#

Is it possible to load or create a world async? Or at least remove the lag that derives when doing so?

chrome beacon
#

||Paper||

hardy swan
#

||Purpur||

#

legit thing fyi

dusk flicker
#

||CraftBukkit||

earnest sonnet
#

🙄

chrome beacon
#

Purpur is nice ngl

hybrid spoke
#

||Alt+F4||

hardy swan
#

purpur is a monster at starting server

ashen flicker
#

How do I do this using paper?

hybrid spoke
#

In heraldry, purpure, () is a tincture, equivalent to the colour "purple", and is one of the five main or most usually used colours (as opposed to metals). It may be portrayed in engravings by a series of parallel lines at a 45-degree angle running from upper right to lower left from the point of view of an observer, or else indicated by the ab...

#

nice

dusk flicker
hardy swan
#

what are the commonly used social platforms for games other than discord

dusk flicker
#

Twitter?

hardy swan
#

ok TwitterSRV

dusk flicker
#

I'd say teamspeak but that's not too big anymore

#

More focused to pvp servers

wraith rapids
#

implying discord is used for games and not primarily for child trafficking

tardy delta
wraith rapids
#

personally i define tokens that represent different sections of the inventory layout, and then define the inventory with the tokens

slate pendant
#

Does "BungeeCord Plugin Messaging Channel" require a non-null player?

hardy swan
#

if it is a none changing gui, where contents not dependent on viewer, yes I would do in constructor

wraith rapids
#

a null player is not a player

tardy delta
#

its a trading gui in this case so players can drag items in it

wraith rapids
#

a null player refers to a variable of type player that is empty; that is, the absence of a player

hardy swan
#

it is nothing, it is everything

slate pendant
#

because I just want to send data

wraith rapids
#

if a player variable is null, there is no player

slate pendant
#

just a message to proxy

#

or back

wraith rapids
#
                readSlots(new GuiSlot[]{
                        _,_,_,_,_,_,_,_,_,
                        _,P,E,N,M,_,A,O,_,
                        _,W,W,W,W,_,I,U,_,
                        _,W,W,W,W,_,B,C,_,
                        _,W,W,W,W,_,F,D,_,
                        _,_,_,_,_,_,_,_,_
                });
#

where each variable here is a predefined token representing a type of slot

slate pendant
#

how do I get a player

wraith rapids
#

then you don't get a player

#

because there are no players

tardy delta
#

🤡

hybrid spoke
#

if there is noone on the server PMC won't work

wraith rapids
#

use sockets

#

plugin messaging is gay and trash

slate pendant
#

ok

wraith rapids
#

basically sockets but with extra hoops to jump through

slate pendant
#

but I don't think sockets can help in connecting the entire server network

wraith rapids
#

sure they can

slate pendant
#

they will require too many ports

wraith rapids
#

that's not how sockets work

slate pendant
#

for sockets

#

I think I'm going to use Java Message Service instead (maybe)

wraith rapids
#

multiple connections can be made to the same server-side socket as long as the client side ip:port differs for each connection

hybrid spoke
#

or you use jedis

wraith rapids
#

which means you only need one socket on each server

quaint mantle
#

spigot-api-1.12.2.jar
spigot-1.12.2.jar
Wich one is better to put here?

wraith rapids
#

and thus one port

#

and yeah, jedis and others are also options

slate pendant
quaint mantle
#

YEs

hybrid spoke
#

not libraries?

#

modules?

quaint mantle
#

moudles

quiet ice
#

Aren't modules J9+?

maiden briar
#

Is there a way to give players temporary permissions? Like in Bukkit's PermissionAtachment, but then in Bungee

quiet ice
#

also, Please don't actually use the IDE builder but you may want to use the spigot-1.12.2.jar if you are at it already since it has NMS (which I do not suggest you to use)

hybrid spoke
quaint mantle
#

spigot-api-1.12.2.jar?

#

is better?

quiet ice
#

why would it be better?

maiden briar
hardy swan
#

._.

quiet ice
#

spigot includes spigot-api

hardy swan
#

but internally, spigot isn't javadoc'd

wraith rapids
#

@slate pendant i'm sure your server comes with more than one port

quiet ice
#

you can add the javadocs manually on eclipse, you should be able to do it in intelliJ too

wraith rapids
#

would be pretty sad if it didn't

wraith rapids
#

you wouldn't for example be able to use votifier

#

as that, too, uses a port of its own

quiet ice
#

VSC should also support it

#

If it does not it is literally dogwater

#

Or ... it has no javadoc support at all, at which point it is meh but at least better

hardy swan
#

but yea, you dun actually need spigot's nms if you think about it

#

reflection brrr

quiet ice
#

Of course not, but if you already do it the wrong way, why not go it fully wrong?

hardy swan
#

reflection is wronger

quiet ice
#

Reflections is not the ideal way of doing it

#

It way okay once, but not anymore

#

All hail 1.17 spigot

hardy swan
#

it still is, if you dont mind writing separately for 1.17+

#

but if your plugin is only for 1.17 also quite meh

smoky oak
#

Can I ask another question? Why ain't math working in bukkit?

hardy swan
#

what math

#

1+1?

#

that is 3

#

btw

smoky oak
#
    private void handleCryingObsidianRightClick(PlayerInteractEvent ev, Block b, Player p) {
        Location originloc = b.getLocation();
        World wrld = b.getWorld();
        
        ArrayList<Vector> shift = new ArrayList<Vector>();
        shift.add(new Vector(  0, 1, 0));
//        shift.add(new Vector(  0, 0, 0));
        shift.add(new Vector(  0,-1, 0));
        shift.add(new Vector(  1, 0, 0));
        shift.add(new Vector( -1, 0, 0));
        shift.add(new Vector(  0, 0, 1));
        shift.add(new Vector(  0, 0,-1));
        
        ArrayList<Block> surroundblocks = new ArrayList<Block>();
        
        originloc = new Location(wrld, originloc.getBlockX(),originloc.getBlockY(),originloc.getBlockZ());
        
        for(Vector l : shift) {
            surroundblocks.add(wrld.getBlockAt(originloc.add(l)));}
        
        for(Block tmp : surroundblocks) {
            Location tloc = tmp.getLocation();
            p.sendMessage("At "+tloc.getX()+" "+tloc.getY()+" "+tloc.getBlockZ());
            if(tmp.getType().equals(Material.GLASS)) {
                p.sendMessage("It's Glass.");
            }
        }
    }```
This results in
quiet ice
#

math works in bukkit

smoky oak
#

At 0.0 72.0 0
At 0.0 71.0 0
At 1.0 71.0 0
At 0.0 71.0 0
At 0.0 71.0 1
At 0.0 71.0 0

#

that

quiet ice
#

Is that the java.util.Vector class?

smoky oak
#

no the bukkit vector

#

but the same thing happens if i replace the vectors with locations

#

the problem is

#

look at the 2nd, 4th and 6th result

#

they are NOT shifted

#

negative values dont seem to work for some bizarre reason

wraith rapids
#

result 2 looks shifted

quiet ice
#

Are locs mutable?

wraith rapids
#

72 shifts to 71

hardy swan
quiet ice
#

then that may be the issue

wraith rapids
#

result 4 is also shifted

smoky oak
#

no no 0 71 0 is where i start the scan

wraith rapids
#

x1 shifts to x0

quiet ice
#

?stash

undone axleBOT
smoky oak
#

the POSITIVE values work

#

the negative dont

wraith rapids
#

they do

#

a location is mutable

smoky oak
#

then why aren't my results showing that

wraith rapids
#

originloc.add(l) mutates the originloc location

smoky oak
#

the 2nd should be 0 70 0 not 0 71 0

wraith rapids
#

which means that in addition to adding a thing to the list, the location itself changes

smoky oak
#

so do clone()?

wraith rapids
#

yes

smoky oak
#

perfect it works now thanks

wraith rapids
#

that said

#

that is rather silly

hardy swan
#

for?

wraith rapids
#

consider using Block::getRelative and iterating over BlockFaces

hardy swan
#

location to be mutable?

#

oh

smoky oak
#

i only need the directly adjacent faces. Can i still iterate over them somehow?

#

and thanks for the tip

quiet ice
#

You could store it in an array somewhere

wraith rapids
#

enumset 😎

quiet ice
#

Enumset is even worse than arraylist here I would assume

wraith rapids
#

why would it be

quiet ice
#

Sets (to my knowledge) are kinda inefficient with iteration

wraith rapids
#

they do iterate slower, but for something this small, time complexity hardly matters

quiet ice
#

myeh, still consider enumsets overkill here

wraith rapids
#

i feel it suits the intention better

#

as we don't care about order, nor do we want duplicate elements

quiet ice
#

Like you can do

   public static final BlockFace[] CARDINAL_BLOCK_FACES = {
        BlockFace.UP,
        BlockFace.DOWN,
        BlockFace.NORTH,
        BlockFace.EAST,
        BlockFace.SOUTH,
        BlockFace.WEST,
    };

and be done with it for once and for good

wraith rapids
#

to use an arraylist over a set because it's a few nanoseconds faster would be what people call a micro optimization

sage swift
#

airplane

wraith rapids
#

Like you can do

   public static final EnumSet<BlockFace> CARDINAL_BLOCK_FACES = EnumSet.of(
        BlockFace.UP,
        BlockFace.DOWN,
        BlockFace.NORTH,
        BlockFace.EAST,
        BlockFace.SOUTH,
        BlockFace.WEST,
    );

and be done with it for once and for good

smoky oak
#

i wanted to use an array list but i would have instanced it. Thanks for the tip

#
ArrayList<Block> surroundblocks = new ArrayList<Block>();
        
        for(BlockFace face : CARDINAL_BLOCK_FACES) {
            surroundblocks.add(b.getRelative(face));}```
like that then?
wraith rapids
#

yes, but with an enumset

quiet ice
#

Why enumset

smoky oak
#

i copy pasted the one from above

wraith rapids
#

because it indicates the intention better

quiet ice
#

All advantages of enumset are void here

wraith rapids
#

we do not care about order

#

we do not want duplicate elements

#

to use an arraylist because it's a few nanoseconds faster is what many would call a micro optimization

quiet ice
#

It is needless overhead

wraith rapids
#

it's not even an overhead

#

arraylist takes an order of magnitude more memory

quiet ice
#

Ight

vital ridge
#

how can i delete a column in database using example uuid

#

in mysql

smoky oak
#

you guys mean using a enum set for the cardinal directinos right?

wraith rapids
#

we want a set because the properties of the collection we use correspond to those of a set

#

and an enumset is the most performant implementation of set for this case

smoky oak
#

ok thanks. was asking since i tried putting the actual block list as enum set but it told me it cant be instancized

#

since the order isn't important with that either, what data type would be better there? Collection?

quiet ice
#

EnumSet has to be inistantiated via EnumSet.of(Enum<?>... e) or EnumSet.emptyOf(Class<? extends Enum> c)

wraith rapids
#

enumset as one can guess from the name is intended to hold enum constants only

#

BlockFace is an enum, but Block isn't, so it wouldn't work for the latter

smoky oak
#

ah ok. Google tells me to use ordered structures due to the limited number of elements tho, that applies here too?

quiet ice
#
final BlockFace[] CARDINALS = new BlockFace[]{
    BlockFace.UP,
    BlockFace.DOWN,
    BlockFace.NORTH,
    BlockFace.EAST,
    BlockFace.SOUTH,
    BlockFace.WEST,
};
Block origin;
Block[] adjacentBlocks = new Block[CARDINALS.length];
for (int i = 0; i < CARDINALS.length; i++) {
  adjacentBlocks[i] = origin.getRelative(CARDINALS[i]);
}
#

Here, fastest way possible (without hardcoding everything)

wraith rapids
#

fastest != best

#

but yeah, you could use an array of fixed length for the blocks themselves

smoky oak
#

its always 6 faces anyways

wraith rapids
#

or an arraylist of predetermined underlying size of 6

smoky oak
#

difference here would be what exactly?

wraith rapids
#

that to populate an array, you'd need an index counter

#

with an arraylist, you can just .add

quiet ice
#

It is better than

Block origin;
Block[] adjacentBlocks = new Block[] {
  origin.getRelative(BlockFace.UP),
  origin.getRelative(BlockFace.DOWN),
  origin.getRelative(BlockFace.NORTH),
  origin.getRelative(BlockFace.EAST),
  origin.getRelative(BlockFace.SOUTH),
  origin.getRelative(BlockFace.WEST)
};
smoky oak
#

true

#

also im just iteriating over everything anyways

wraith rapids
#

if you're just iterating over it, you don't need an intermediate collection for blocks

#

also, enumsets are a rather special implementation of set

#

in that their iteration time complexity is constant

smoky oak
#

well since i need to do that a few hundred times

#
for(BlockFace face : CARDINAL_BLOCK_FACES) {
            Block b = origin.getRelative(face).getLocation();```
#

and run a check on the block material

quiet ice
wraith rapids
#

this depends on the environment

quiet ice
#

then I am misunderstanding how it works

smoky oak
#

well nothing exceeds 6 here except the number of iterations

wraith rapids
#

for enumerations with 64 elements or less, the implementation uses a hotspot intrinsic function which is usually deferred to the hardware and executed as a single instruction

smoky oak
#

in other words if its less than 64 its faster, but you can't tell how much faster?

wraith rapids
#

O(1) if your chip supports said operation

#

which I'd assume most server grade machines to do

#

probably ever so slightly slower than iterating an array

vast sapphire
#

is there a better way to do this?

#

ItemStack[] menu_items = {placeholder,placeholder,placeholder, spawncmd, bowcmd, blazerodcmd, placeholder, placeholder, placeholder};

wraith rapids
#

but possibly faster than iterating f.e a linked list

vast sapphire
#

placeholder is a glass pane

vast sapphire
wraith rapids
#

of course for something like the material enum which is literally thousands of fucking elements, it will be significantly slower

#

as that uses a J U M B O enum set as the underlying impl

vast sapphire
#

maybe i could do for every air slot or something

dusk flicker
#

Just I do it s bit diff using chars

smoky oak
#

yes but I'm iterating over the block faces and running a material check on the temporary blocks i get from that. You're saying to do instead of if(tblock.getType().equals(Material.THIS)) (Material doesn't change) using Material m = Material.THIS; if(tblock.getType().equals(m)) would be faster?

wraith rapids
#

yeah i'm not totally pleased with the way how my inventory shit works right now

#

huh i don't remember saying anything about your if conditions

smoky oak
#

well what i mean here is it better to grab the material in a variable and then start the loop?

#

ie faster?

sage swift
#

mm yes you should continue using .equals for enums

wraith rapids
#

enun set

#

i don't know, where are you getting the material from

smoky oak
#

the bukkit material enum?

vital ridge
#

How can I make so I add items to the gui with a for loop, but I want to create a pattern pretty much

wraith rapids
#

if you get it from like a block or something, yeah, cache it in a var

vital ridge
#

so the items will only be in certian slots

#

like slot 5-10 for example

#

and the under it

wraith rapids
#

but if you're just directly referencing the material enum, there is no point

smoky oak
#

remember i need to run a few hundred checks

wraith rapids
#

there is no difference

sage swift
#

for (int i = 5; i < 11; i++) {

wraith rapids
#

enum constant fields are final so they are inlined

smoky oak
#

didn't you say referencing it is slower due to it being a J U M B O EnumSet?

wraith rapids
#

i said iteration is slower

smoky oak
#

ah i see. So for direct comparisons it does not make a difference?

wraith rapids
#

if you have an EnumSet<Material>, iterating it is slower than an ArrayList<Material>

#

however this statement has nothing to do with what you are doing

maiden briar
#

If I schedule a bungee task it gets repeated infinitely, with a delay of 5. I just want it repeated 5 times and a delay of 1, this is the code

schedule(() -> <runnable>, 1, 5, TimeUnit.SECONDS)

wraith rapids
#

as you are not iterating over the material enum

#

you are iterating over the blockface enum, which is less than 64 elements

vast sapphire
#

so for setting empty air slots to glass would i do something like

for (Arrays.stream(menu_items).filter()) // something? {
vital ridge
#

like to create a frame pretty much

smoky oak
#

ok thanks for the help

ivory sleet
vital ridge
ivory sleet
#

Better just loop it, faster and probably easier for you

vital ridge
#

im just looking to create smthing like this

sage swift
#

and j from 2 to 6

vital ridge
#

But I have 1 list of items

sage swift
#

i*9+j

vital ridge
#

I can only use 1 list of items

#

thats the thing

sage swift
#

what

vital ridge
#

Okay basically

#

its so fkin hard to explain that

#

lemme figure out how to explain it

wraith rapids
#

one list of items can represent multiple dimensions

#

to represent the 2*5 grid of items you have there, you could use a list of 10 elements

sage swift
#

keep a counter and increment by 1

#

so you can get the proper item from the list

wraith rapids
#

or map the dimensions to the index

iron condor
#

hey, is it possible adding efficiency 6 into enchantment table?

wraith rapids
#

index = x + (y * width) for example

dusty sphinx
#

What would be the right way to see if a configuration file exists?

wraith rapids
#

so 1,1 would point at index 1 + (1 * 5) = 6 if you had an inventory of width 5

dusty sphinx
#

Oh, I can just config.isSet("some default key")

wraith rapids
#

second item on the second row, 0,0 being first item on the first row, as java is 0 indexed

#

the first row would map to elements 0 through 4

#

the second row would map to elements 5 through 9

vast sapphire
#

ok i tried looping through all slots but i got an internal error v for(int i = 0; i <= 27; i++) { if (gui.getItem(i) == null) gui.setItem(i, placeholder); }

regal lake
#

Hey, i need some help with the tablist.
I want to sort the tablist and also add some offlinePlayers/text to the tablist.
The sorting and adding online(!) players is working with creating a custom scorboard/teams and add the players to the teams (team.addEntry(string);).
But the issue is that if i add any string which is not an online player it will not be displayed in the tablist.
Can i configure that or i have to change my code ? (Is is possible without packets or do i need them?)

summer scroll
#

How can I get char from FileConfiguration?

pulsar zenith
#

Is there any way I can make it so a player can still interact through another player (hit entities, place and mine blocks etc) while still being visible and in survival mode?
If not, is it possible to use hidePlayer() and still have the glow effect and nametag show (I am providing the nametag from teams in a scoreboard) ?

frosty tinsel
summer scroll
frosty tinsel
frosty tinsel
vast sapphire
#

oh ok thanks

vast sapphire
#

i think looping through slots will work

ivory sleet
#

No need to use streams here, will just be an overhead

vast sapphire
ivory sleet
#

What’s the error

sage swift
#

well a good start would be-

vast sapphire
#
30.06 15:23:45 [Server] INFO at java.util.Arrays$ArrayList.get(Arrays.java:4351) ~[?:?]
30.06 15:23:45 [Server] INFO at net.minecraft.server.v1_16_R3.NonNullList.get(SourceFile:46) ~[patched_1.16.5.jar:git-Paper-"e04368045"]
30.06 15:23:45 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryCustom$MinecraftInventory.getItem(CraftInventoryCustom.java:105) ~[patched_1.16.5.jar:git-Paper-"e04368045"]
30.06 15:23:45 [Server] INFO at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory.getItem(CraftInventory.java:50) ~[patched_1.16.5.jar:git-Paper-"e04368045"]
30.06 15:23:45 [Server] INFO at me.gui.Commands.onCommand(Commands.java:57) ~[?:?]
30.06 15:23:45 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.16.5.jar:git-Paper-"e04368045"]
30.06 15:23:45 [Server] INFO ... 19 more```
#

there are 27 slots tho

ivory sleet
#

Yes but indices start at 0

#

So to access element 27 you’d need to for instance call inventory.getItem(26)

vast sapphire
#

oh ok

frosty tinsel
vast sapphire
#

can't resolve the methods

frosty tinsel
#
Arrays.stream(menu_items).filter(i -> i.getType() == Material.AIR).forEach(i -> i.setType(Material.GLASS));
#

I am typing this on phone, so it might be a little off

vast sapphire
#

oh i fogot i is not my var

#

i'll try this

ivory sleet
#

@frosty tinsel stop spoonfeeding

#

And for the record that still doesn’t work

frosty tinsel
#

Why?

#

It doesn't work

ivory sleet
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

ivory sleet
#

Because you’re only setting the type to a copy

frosty tinsel
#

*do

ivory sleet
#

Inventory#setItem() would be needed

ivory sleet
#

And for the record I am not so sure he knows everything about higher order functions

regal lake
#

I try to update my plugin to 1.17, but i have some issues with NBT..
For 1.8 to 1.16 i always had this setup:

[...]
import net.minecraft.server.v1_16_R3.NBTTagCompound;
net.minecraft.server.v1_16_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound compound = nmsStack.getTag();
[...]

But with 1.17 intellj tells me i have to use

[...]
import net.minecraft.nbt.NBTTagCompound;
net.minecraft.world.item.ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound compound = nmsStack.getTag();
[...]

But then i get this error while compiling

 cannot find symbol
[ERROR]   symbol:   class NBTTagCompound

Did i miss something ?
I tried to search if that Class has been moved for 1.17 but i don't found anything.

smoky oak
#

had the same problem, I dont think it exists anymore

ivory sleet
#

Are you using the mappings or not?

#

It might be called something different

regal lake
wraith rapids
#

yes, ignore the question that was asked

regal lake
#

Let me think about that, im not sure which mappings are meant.

regal lake
ornate ledge
#

I'm trying to use abstraction to add support for lower versions. The problem is idk what im doing.

#
import org.bukkit.entity.Player;

public class Handler_1_8_R1 implements VersionHandler {
    @Override
    public void vulnerableSet(Player p) {

    }
}```
#

I'm trying to implement 1.8 method for vulnerability, but the problem is that it doesnt want to implement the old method for setVulnerable();

ivory sleet
#

As you are aware of, the normal spigot server jar contains the nms classes however if you have looked into that you should have recognized a lot of gibberish names for the method names, parameter names and field names. Mappings are a way to map those gibberish names with useful names.

regal lake
ivory sleet
#

I don’t talk about reflection

regal lake
#

Then i maybe don't understand it..
My english is not the best :/

ivory sleet
#

But anyways my point was that maybe the name NBTTagCompound or whatever it was called is the name in the mappings however not outside the mappings

wraith rapids
#

does the server jar itself use mappings? I haven't looked at 1.17 at all yet

ivory sleet
#

Hmm don’t think so

#

Md5 just hinted us at a maven plugin

wraith rapids
#

good, as expected

torn shuttle
#

just to make sure before I commit to it, there are no soil tilling events right

#

I should be checking for block place instead?

eternal oxide
#

PlayerInteractEvent

#

using a hoe on block

wraith rapids
#

i vaguely remember that being involved in one of the umbrella events like blockfromto event and friends

torn shuttle
#

who are you calling a hoe?

#

thanks

#

actually I think blockplaced in blockplaceevent might be better just by virtue of not firing as much and potentially getting cancelled less often

eternal oxide
#

Look at EntityChangeBlockEvent as it may fire for tilling

torn shuttle
#

assuming it fires this event when it replaces

eternal oxide
#

it won't be blockplace

torn shuttle
#

ah shame

#

hm changeblockevent could work just as well though

wraith rapids
#

yeah it's one of those

#

i don't think it's documented anywhere though

vital ridge
#

how do i count rows in mysql?

tardy delta
#

records?

#

a row is horizontal right? 🤡

vital ridge
#

row is vertical

#

column was horizontal

tardy delta
#

what

#

i thought when i was at the first row at school...

#

just the first bank

#

nvm

whole stag
#

Is SELECT COUNT(*) FROM <table> what you're looking for?

vital ridge
#

Yeah i have that arldy

#
final ResultSet rs = MySQL.prepareStatement("SELECT COUNT(*) FROM all_usertags;").executeQuery();

            int rowCount = 0;

            if (rs.next()) {
                rowCount ++;
            }

            return rowCount ;
#

i have smthing like this

#

now

whole stag
#

What result does that give you?

vital ridge
#

1

#

tho i have 4 usertags

#

in my database

#

no idea

whole stag
#

Okay. SELECT COUNT(*) FROM all_usertags; will return a single result, so that makes sense

#

The actual count is in the value of that result

vital ridge
#

so rs.next only runs once

whole stag
#

Yes

vital ridge
#

So id need to run it till the end of the rows

eternal oxide
#

while instead of if

whole stag
#

No

eternal oxide
#

oh yep, he has a count

#

so value of next

whole stag
#

Next returns a bool. What does rs.getInt(0) give you?

nova notch
#

how do i get the task id of a task?

whole stag
vital ridge
#

returns me an error

#

in console

nova notch
#

idk how to make a new task

#

i only have a scheduler

vital ridge
#

Create a bukkittask variable before your scheduler

#

so BukkitTask task = bukkit.getscheduler blablabla

vital ridge
wraith rapids
#

have you considered mentioning the type of the error

#

or should we go get the crystal ball

vital ridge
#

This fixed it for me:

final ResultSet rs = MySQL.prepareStatement("SELECT COUNT(*) FROM all_usertags;").executeQuery();

            int columnCount = 0;

            while (rs.next()) {
                columnCount = rs.getInt(1);
            }

            return columnCount;
vast sapphire
#
    public static Recipe recipes() {
        ShapelessRecipe shapeless = new ShapelessRecipe(ItemManager.customBow())
                .addIngredient(Material.GOLD_BLOCK)
                .addIngredient(Material.GOLD_BLOCK)
                .addIngredient(Material.TNT)
                .addIngredient(Material.TNT)
                .addIngredient(Material.OBSIDIAN);

        ShapedRecipe appleRecipe = new ShapedRecipe(ItemManager.invertedApple());
        appleRecipe.shape("123","456","789");

        appleRecipe.setIngredient('1', Material.BEDROCK);
        appleRecipe.setIngredient('2', Material.BEDROCK);
        appleRecipe.setIngredient('3', Material.BEDROCK);
        appleRecipe.setIngredient('4', Material.BEDROCK);
        appleRecipe.setIngredient('5', Material.GOLDEN_APPLE);
        appleRecipe.setIngredient('6', Material.BEDROCK);
        appleRecipe.setIngredient('7', Material.BEDROCK);
        appleRecipe.setIngredient('8', Material.BEDROCK);
        appleRecipe.setIngredient('9', Material.BEDROCK);
        
        return shapeless;
    }
}``` how do i return both of these recipes? i can only return one
hardy swan
vital ridge
#

Ik, mb

hardy swan
#

of which im a fan of the last

hybrid spoke
#

since your method name is already in plural i would just return an Array

#

another method would be cleaner

vast sapphire
#

ok

wraith rapids
#
        ShapedRecipe appleRecipe = new ShapedRecipe(ItemManager.invertedApple());
        appleRecipe.shape("111","151","111");

        appleRecipe.setIngredient('1', Material.BEDROCK);
        appleRecipe.setIngredient('5', Material.GOLDEN_APPLE);
#

assigning a different character for each slot is redundant

raw coral
#

if i was using the server scheduler to run a delayed task and lets say i wanted it to run in an eighth of a second how would i do that since as an input it takes ticks

wraith rapids
#

you figure out how many ticks 1/8th of a second is

raw coral
#

its 2.5

wraith rapids
#

protip: 1 second is 20 ticks

#

then you choose either 2 or 3

raw coral
#

So i cant

#

ok

slim kernel
#

does rayTraceEntities work through blocks?

torn shuttle
#

damn I think tilling doesn't work with EntityChangeEvent

#

changeblock

toxic mesa
#

So I've never used the bungeecord messaging channel and I'm confused;
I want to do something very simple, get the number of players on a server
Read the doc of course and got this so far
I have the onPluginMessageReceived (at least this rn)

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equalsIgnoreCase("BungeeCord")) { 
                  return; 
                }
        ByteArrayDataInput input = ByteStreams.newDataInput(message);
        String subchannel = input.readUTF();
    }

and in a method this, with server being a string

        ByteArrayDataOutput output = ByteStreams.newDataOutput();
        output.writeUTF("PlayerCount");
        output.writeUTF(server);

Now how would actually send the plugin message and receive the information?

slim kernel
#

does rayTraceEntities work through blocks?

tardy delta
#

is this a good way of making a gui?

#

and I'm using like this

p.openInventory(new TradeGui().register());
eternal night
#

register seems like a weird name for that method

tardy delta
#

xd lets call it create

ivory sleet
#

But you’re already creating it by a standard instantiation?

tardy delta
#

is the most left slot in the menu bar (or how its called) slot 0?

#

hotbar*

eternal night
#

👍

tardy delta
#

my player.getInv().additem() isnt working so i try setting it on an index

torn frost
#

hi, i wanted to have global keys and if user defines custom keys per world then it uses the custom one..
for example there is world in worlds...so all things that it says in custom world keys will be used for that world and the "spawn-block-blacklist" which is not in the custom world keys...so it will use the global ones.

I tried this but it says using global always and also dont recognize the global default values.
but if i manually print the world keys then it shows the ones in config.

    private String checkWorldConfig(World world, String config) {
        List<String> worldList = plugin.config.getConfig().getStringList("worlds");
        String worldName = world.getName();
        if (worldList.contains(worldName)) {
            if (plugin.config.getConfig().contains("worlds." + worldName + "." + config)) {
                return ("worlds." + worldName + ".");
            }
        }
        return ("global.");
    }

# UnexpectedSpawn
# Authors : Shivelight, DeathGOD7
# Original : https://github.com/Shivelight/unexpectedspawn-paper
# Modified : https://github.com/DeathGOD7/unexpectedspawn-paper

global :
  # Random respawn area for global settings.
  x-max: 399
  x-min: -399
  z-max: 399
  z-min: -399

  bed-respawn-enabled: true

  random-respawn :

    on-death: true

    on-first-join: false

    always-on-join: false

  spawn-block-blacklist:
    - LAVA
    - WATER
    - CACTUS
    - FIRE
    - MAGMA_BLOCK
    - SWEET_BERRY_BUSH
    - CAMPFIRE


worlds :
  world :
    x-max: 2000
    x-min: -2000
    z-max: 2000
    z-min: -2000
    bed-respawn-enabled: false
    random-respawn :
      on-death: true
      on-first-join: true
      always-on-join: false

glossy scroll
#

does anyone know where the spigot mappings are for NMS?

eternal night
#

in spigots build data repo

dusty sandal
#

So I noticed whenever I boot my test server with my plugin I get a message saying initializing legacy material support and the getType() of Block’s with any type of button other than oak or stone give me the material LEGACY_AIR
Anyone know what’s up?

eternal night
#

did you specify the api version in your plugin yml

dusty sandal
#

Nope

eternal night
#

go do that 👍

dusty sandal
#

I’m coding against 1.16.1 api right now but I don’t theres anything in my plugin really version specific, should I just put 1.16? An earlier version for more compatibility?

eternal night
#
api-version: 1.16
#

would be it then

#

note that API version is always just the base version

dusty sandal
#

alright that fixed it, thank you!

eternal night
#

np

quiet ice
#

You can also just define it at api-version: 1.13 if you want to

eternal night
#

please don't

quiet ice
#

Any version of spigot would be able to load it then

quiet ice
glossy scroll
#

use api-version 1.13

quiet ice
#

the API-version is merely a suggestion

glossy scroll
#

theres no reason to use any other version

eternal night
#

no. spigot introduces compatibility layers depending on your version

#

that is the entire point

#

if you want to run on 1.16 only, stick to api version 1.16

quiet ice
#

And what if you want to run it in 1.15 then?

eternal night
#

then you go down to 1.15

#

I don't see the issue ? Stick to the lowest version you want to support

glossy scroll
eternal night
#

just like with your spigot-api dependency

#

not yet

#

doesn#t mean it won't

#

e.g. material enum recode by choco

quiet ice
#

So?

glossy scroll
quiet ice
#

That PR is never going to get merged, everyone knows that

eternal night
#

So you would actively be using compatibility layers you really don't need

quiet ice
#

what is wrong with using them?

eternal night
#

I don't see any reason to use a version lower than your spigot-api dependency

#

they are slow

#

some rather agressive asm manipulation is needed for them

quiet ice
#

How slow?

glossy scroll
#

there is no other compatibility layer than null or not null

#

its literally in the code

eternal night
#

are you good ?

glossy scroll
eternal night
#

yes

#

right now

quiet ice
#

And in the future they will be present either way

#

Regardless of version

#

If you put in 1.13 or 1.16 or 1.17 it wont matter

eternal night
#

I am saying, a system that wants you to specify your minimal supported api-version might do things for you

#

that you might not need

glossy scroll
#

right, and everyones minimal supported api when using 1.13 version is 1.13

#

thats the whole point

eternal night
#

yes

glossy scroll
#

so... put 1.13?

eternal night
#

when using spigot 1.13

#

if you use 1.16, put 1.16

quiet ice
#

You almost always dont want to put in arbitrary limits

eternal night
#

because you do not support 1.13

glossy scroll
#

whatever, my main point is that it will likely never change beyond null/not null

quiet ice
#

I for example have a few methods for providing fallback for older versions while still linking with newer versions

glossy scroll
#

and when it does change (say 1.17)

#

1.13-1.16 will all function the same

quiet ice
#

And I doubt that Md is going to continue the strict ABI compat

eternal night
#

Have you read the material PR ?

glossy scroll
#

yea

quiet ice
#

He already broke the EntityShootBowEvent constructor with an 1.16.2 build

eternal night
#

like, you literally just stated you don't think it is going to be pulled

quiet ice
#

And that PR is never going to be merged

eternal night
#

and in the next sentence say "ah spigot will fuck ABI"

quiet ice
#

I have said "strict"

glossy scroll
#

the next time version-specific support is added in the form of api-version

#

im betting that they just drop support

quiet ice
#

And that PR is the whole opposite of "strict"

eternal night
#

which is why a compatibility layer might be introduced

glossy scroll
#

the forwards compatibility has really been a hamper on things

quiet ice
#

It will fuck every plugin permamently unless these basic fallback support options are included

#

But remapping an Enum to a non-enum is hard at best

#

?stash let me look if I remember that PR correctly at least

undone axleBOT
glossy scroll
#

its basically using the system intended by minecraft

eternal night
#

the 1.13 layer also had to aggressively change byte code calls

glossy scroll
#

a registry based system

eternal night
#

I don't see what your point is here

glossy scroll
#

i think hes talking abt the material pr

quiet ice
#

So non-enum

glossy scroll
#

if the material PR were to be accepted, forwards compat would cease to exist for prior version

#

which in my mind

quiet ice
#

Then yes, that is impossible to write an compat layer for

glossy scroll
#

is the best

#

id rather have the registry system than the enum we do rn

quiet ice
#

EnumSet and co. would need to be rewritten to work with the new registry system

eternal night
#

would just have a LEGACY_Material enum

#

and you'd be good

quiet ice
#

And duplicate the whole codebase? No thanks

eternal night
#

don't get me wrong, I am defo in favour of dropping backwards compat

glossy scroll
#

forwards*

#

not backwards

eternal night
#

what ?

#

backwards

quiet ice
#

That will be killing performance permamently

#

It would be both

glossy scroll
#

backwards compatibility means the plugin developed on future versions can be used on prior versions

eternal night
#

yes

#

no

#

thinking

#

are you sureeee about that ?

glossy scroll
#

its definately forwards ive had this convo before

eternal night
#

pretty sure backwards would be the server being able to execute code run against older versions of itself

vast sapphire
#

how to detect if a player is eating

glossy scroll
#

interactevent

#

or consume event

#

there's no "isEating"

#

(because its controlled clientside)

vast sapphire
#

ok

quiet ice
#

I mean, the material refractor would kill both

eternal night
#

what

#

how does one even kill both

tawdry python
#

How do I get a higher value from a config.yml patch? I wanted to put some numbers in order and I need to get the highest number from the setting and then add +1

quiet ice
#

If you write a plugin without the mat refractor it wouldn't run with the mat refract. Writing it with the mat refract it wouldn't run without it

eternal night
#

if you define forwards compatibility like that, no new api will ever be forward compatible

quiet ice
#

That is one thing

#

It will also not be backwards compatible

#

So, that is a lie

eternal night
#

afaik forwards compatibility is designing an API to be easily extendable, dynamic enough to not require backwards compatibility breaking changes to be extended

vast sapphire
#

so did i do this right? v @EventHandler public void onAppleEat(PlayerItemConsumeEvent event, ItemStack item) { Player player = event.getPlayer(); { if(player.getInventory().getItemInMainHand().equals(Material.APPLE)) { player.sendMessage("eating"); } } }

weary geyser
#

no?

#

if(player.getItemOnCursor().getType() == Material.APPLE)

whole stag
vast sapphire
#

ok

weary geyser
#

It's late for me lmao

tardy delta
#

lmao someone wants to pay me 200/300 euros to make a server for him

weary geyser
#

bruh lmfao

onyx shale
#

Not unheard of

weary geyser
#

If it's only the base

#

It's probably unheard of

whole stag
tardy delta
#

i dont trust it

onyx shale
#

you can always ask money upfront

#

or half

tardy delta
#

i'm now wondering if my bankaccount even works

#

😂

vast sapphire
#

this doesn't work v if(event.getItem().getType() == Material.APPLE)

toxic mesa
#

So I've never used the bungeecord messaging channel and I'm confused;
I want to do something very simple, get the number of players on a server
Read the doc of course and got this so far
I have the onPluginMessageReceived (at least this rn)

    @Override
    public void onPluginMessageReceived(String channel, Player player, byte[] message) {
        if (!channel.equalsIgnoreCase("BungeeCord")) { 
                  return; 
                }
        ByteArrayDataInput input = ByteStreams.newDataInput(message);
        String subchannel = input.readUTF();
    }

and in a method this, with server being a string

        ByteArrayDataOutput output = ByteStreams.newDataOutput();
        output.writeUTF("PlayerCount");
        output.writeUTF(server);

Now how would actually send the plugin message and receive the information?

weary geyser
#

@toxic mesa player.sendPluginMessage(..., input.toByteArray());

#

Wait let me write you an example

vast sapphire
# raw coral Can we get more context?
    @EventHandler
    public void onAppleEat(PlayerItemConsumeEvent event, ItemStack item)
    {
            Player player = event.getPlayer();
        {
            if(event.getItem().getType() == Material.APPLE)
            {
                player.sendMessage("eating");
            }
        }
    }
}
shadow gazelle
#

Alright, so, I don't know what I did wrong, but I have this in a player drop item event and nothing happens. Any ideas?

Location loc = event.getItemDrop().getLocation();
World world = loc.getWorld();
world.playEffect(loc, Effect.FIREWORK_SHOOT , 5);
weary geyser
#

Player player; //get it how you want to

ByteArrayOutputStream stream = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(stream);

//try catch etc
out.writeUTF("PlayerCount");
out.writeUTF("whatever-server");

player.sendPluginMessage(plugin, "BungeeCord", stream.toByteArray());
``` @toxic mesa
toxic mesa
#

So I would use the stream.toByteArray(), that's to send it right?
How would I like recieve the info and change it to let's say an Integer

weary geyser
#

Sec, I am just going to the toilet

#

We could continue in DM's if you want

toxic mesa
#

Np, tysm for helping

#

Sure

vagrant stratus
#

?

tawdry python
#

How do I get a higher value from a config.yml patch? I wanted to put some numbers in order and I need to get the highest number from the setting and then add +1

unreal quartz
#

wut

hexed hatch
#

why is item a parameter

#

you get the item from the event

vast sapphire
#

Was testing

hexed hatch
#

ah

ember crag
#

how do i get the players ping in 1.17?

vagrant stratus
#

Player#getPing iirc

ember crag
#

oh did the method change?

#

i remember it being Player#getHandle#ping iirc

vagrant stratus
#

iirc you don't need to do NMS

ember crag
#

ah ic, thx

dull ridge
#

can you modify the block list from BlockExplodeEvent#blockList() to change which blocks it removes?

slim kernel
#

can I somehow get if the rayTraceEntities goes through a specific block location?

silver wadi
#

does anyone have any basic plugin ideas to help me learn some more java

#

not going to be publicly released or anything

hot hatch
tawdry python
#

How do I get a higher value from a config.yml patch? I wanted to put some numbers in order and I need to get the highest number from the setting and then add +1, help pls

proud basin
silver wadi
#

simple enough

slim kernel
#

can I somehow get if the rayTraceEntities goes through a specific block location?

shadow gazelle
#

How would I summon particles on a dropped item? I tried using the code below and it didn't work.

Location loc = event.getItemDrop().getLocation();
World world = loc.getWorld();
world.playEffect(loc, Effect.FIREWORK_SHOOT , 5);
ember crag
#

how do i send a packet to a player in 1.17?

shadow gazelle
#

That might actually be the wrong thing to use, but

dusty sphinx
#

Does the server automatically skip loading a plugin if a dependency is missing, or do i need to add handling myself

glossy scroll
#

You have to iterate with the vector you chose

slim kernel
glossy scroll
#

no im on mobile

main dew
#

How I can clone Packet (PacketPlayOutMapChunk and others)

vocal mirage
#

Hey !
Just a question, I asked resources support 1 month ago a question by email, and I havn’t recieced any reply.
Is it normal ?

Thanks

quaint mantle
#

can i hide only damage attribute on item?

wraith rapids
#

so many questions, so few answers

#

how sad

hot hatch
#

why is it saying this ERROR Could not load 'plugins/Regex-1.0.jar' in folder 'plugins': uses the space-character (0x20) in its name when it tries to load my plugin?

wraith rapids
#

have you tried reading the error message

hot hatch
#

yes, i see no space character

wraith rapids
#

show plugin.yml

vagrant stratus
hot hatch
#

oh

#

oh ok ty

#

i get it now

wraith rapids
#

that's not the name of the plugin

#

that's the name of the file

hot hatch
#

yea i fixed it, ty lol

granite stirrup
#

is this chat dead?

#

no ones talking :)

granite stirrup
wraith rapids
#

it is yes

#

mostly because I don't have the effort to answer all of the nooby questions today

#

i'm sure there are at least 10 other people lurking around who could answer if they chose to

pallid stratus
#

quick question -- should I use the "latest version" command if I want the latest 1.17 spigot build, or should i use the "1.17 version" command?

granite stirrup
#

build tools?

pallid stratus
#

ye

quaint mantle
#

latest = latest
1.17 = 1.17

granite stirrup
#

1.17 for 1.17 latest for 1.16.5

pallid stratus
#

cuz the wiki says latest is 1.16.5 for some reason

quaint mantle
#

'cause it hasnt been changed I dont think

pallid stratus
#

aight bet, thats why i was asking

#

ty

granite stirrup
earnest sonnet
#

1.17for 1.17

pallid stratus
#

soo theres basically only one 1.17 version then, correct?

#

and ill just use 1.17 then

granite stirrup
#

lol

pallid stratus
#

oo

#

so 1.17 command straight up gives me the latest 1.17 ya ?

granite stirrup
#

mine is probs outdated again

granite stirrup
pallid stratus
#

k bet thanks

wraith rapids
#

watch everybody coming out of the woodwork

granite stirrup
#

it will actually take quicker to update if nms is already decompiled lol

#

in the work folder

#

it took like 2 mins for me tho to update to a newer version of what version i had ;-;

#

5 mins normally for like when im building a new version i havent built before

shadow gazelle
#

Wait, nvm

wraith rapids
#

particles generally don't make sounds

#

the only exception I can think of is the rain hitting a solid block particle

earnest sonnet
#

It doesn't? I would swear that and lava would have some sound effects

shadow gazelle
#

lol I was thinking of actually setting the thing off

granite stirrup
#

i have summoned a water particle before

#

didnt make any noise

wraith rapids
#

i'm not totally sure if the rain particles make the sound directly but I'd assume they do as rain goes totally quiet if I disable particles

#

could be some kind of optifine fucknuggetry I suppose

granite stirrup
#

¯_(ツ)_/¯

#

i swear it doesnt make noises tho

shadow gazelle
#

uh

#

how would I make it .5 above?

wraith rapids
#

add .5 to the y of the location

#

see the javadocs

whole stag
granite stirrup
#

loc.y += .5 maybe?

#

idk

wraith rapids
#

loc.add(0, 0.5, 0)

granite stirrup
#

oh

wraith rapids
#

loc.y is private

#

you can't modify it directly

granite stirrup
#

thought you could

novel pendant
#

Hey, I have a variable that updates based on when I place or break blocks, the problem Im getting is that when other people are on the server, instead of adding only 1 point, it adds the number of people that are on the server... Anyway I can fix this?

quaint mantle
tawdry python
#

How do I get a higher value from a config.yml patch? I wanted to put some numbers in order and I need to get the highest number from the setting and then add +1

wraith rapids
#

all fields except for public constants are always private or protected

ivory sleet
#

mojang minecraft code be like, not a chance

granite stirrup
#

i actually thought the coords where public but i guess not

wraith rapids
#

nothing is ever public

#

or at least nothing mutable should ever be public

granite stirrup
#

x,y,z can be changed but

#

why cant you make it public?

wraith rapids
#

because that's not how java works

#

nothing mutable should ever be public

#

x y and z are mutable

granite stirrup
wraith rapids
#

look up encapsulation

granite stirrup
#

k

wary harness
#

any one can tell when was Material.isItem()

#

added

#

to spigot API

#

is there any page where are records when some new method get's added

hot hatch
#

yes

#

wayback machine

wary harness
#

what

wraith rapids
#

brilliant

wary harness
#

time travel

#

omg

#

my dreams coming true

dire marsh
#

he's not joking

wary harness
wraith rapids
#

the wayback machine

#

google it

dire marsh
#

internet archive

wary harness
#

well page is not loading xd

granite stirrup
#

it takes a bit

#

there servers are slow since loads of people use it

#

but dont blame it

#

its free

#

they only getting money from donations

urban knoll
#

Anyone knows how I detect the blocks a player will get "hit" into? Is there a event for this maybe or sth else

wraith rapids
#

not that i know of

urban knoll
granite stirrup
urban knoll
whole stag
#

Where the knockback will take them?

granite stirrup
#

PlayerDamageEvent

#

i think

urban knoll
granite stirrup
#

oh wait PlayerDamageEvent isnt a thing f

#

thought it was

whole stag
#

Well, you could probably do it mathematically

urban knoll
#

It is a mix of PlayerDamageEvent, PlayerMoveListener and PlayerVelocityListener I think

granite stirrup
#

maybe its EntityDamageEvent?

urban knoll
urban knoll
granite stirrup
#

EntityDamageByEntityEvent?

whole stag
granite stirrup
#

Players are entitys right?

urban knoll
#

yes

whole stag
#

Can take three snapshots of position, plot a parabola through them, clear the next block in the parabola

cinder thistle
#

Ah hell

#

Wrong channel

#

Good ol apple sharing

urban knoll
urban knoll
whole stag
#

Probably not

wraith rapids
#

it will be difficult to programmatically detect which blocks the player is colliding into, and even moreso before the player actually collides into them

#

this is largely because the api doesn't actually expose precise collision shapes

shadow gazelle
#

I tried it with a barrier underneath, there's no particles spawning at all

wraith rapids
#

note that if you're doing that in an event, it only happens once

granite stirrup
wraith rapids
#

a player is an entity

granite stirrup
hot hatch
#
e.getMessage().matches(Objects.requireNonNull(Arrays.toString(Objects.requireNonNull(getInstance().getConfig().getString("regex")).split("\\|"))))

so it used to give errors, but now its not even giving errors
error it used to give:

30.06 17:04:27 [Server] ERROR Could not pass event PlayerChatEvent to Regex-Censor v1.0
30.06 17:04:27 [Server] INFO java.util.regex.PatternSyntaxException: Unclosed character class near index 1
30.06 17:04:27 [Server] INFO []
30.06 17:04:27 [Server] INFO ^
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.error(Pattern.java:2027) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.clazz(Pattern.java:2695) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.sequence(Pattern.java:2138) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.expr(Pattern.java:2068) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.compile(Pattern.java:1782) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.<init>(Pattern.java:1428) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.compile(Pattern.java:1068) ~[?:?]
30.06 17:04:27 [Server] INFO at java.util.regex.Pattern.matches(Pattern.java:1173) ~[?:?]
30.06 17:04:27 [Server] INFO at java.lang.String.matches(String.java:2024) ~[?:?]
30.06 17:04:27 [Server] INFO at me.ChatListener.chatListener(ChatListener.java:17) ~[?:?]
shadow gazelle
#

I think it's already 5

granite stirrup
#

no that was the data

#

not the radius

urban knoll
main dew
#

How I can clone Packet (PacketPlayOutMapChunk and others)

shadow gazelle
granite stirrup
#

¯_(ツ)_/¯

#

yeah i dont know lol

shadow gazelle
#

rip

#
Location loc = event.getItemDrop().getLocation();
loc.add(0,0.5,0);
World world = loc.getWorld();
world.playEffect(loc, Effect.FIREWORK_SHOOT , 5, 5);
#

That's what I have rn

wraith rapids
#

note that if you do that in an event, the particles are only spawned once

shadow gazelle
#

Okay.... ?

#

Meaning they're only there for a millisecond or something?

#

Because there's nothing

wraith rapids
#

if you're listening to the drop event, you probably can't see the particles because they're spawned where the item is created

#

namely inside the player

shadow gazelle
#

It waits like three seconds

#

then does everything

wraith rapids
#

try a different particle

granite stirrup
#

i think for fireworks you need to set like more data like for color,damage or something

shadow gazelle
#

GHAST_SHOOT this time

wraith rapids
#

try something simpler

#

like fire

#

or flame

#

or whatever it's called

shadow gazelle
#

:thonk:

granite stirrup
#

bruh

shadow gazelle
#

There's no fire, just bow fire and firework shot

granite stirrup
#

that effect is the sound

#

not the particle

shadow gazelle
#

bruh

#

It's still not making any noise

wraith rapids
#

world.spawnParticle

#

world.playSound

granite stirrup
#

it summons a particle not plays a sound

shadow gazelle
#

Shouldn't it at least play sound, then?

granite stirrup
#

what you want is to use the Particle close

granite stirrup
#

it summons a fucking effect not playing a sound

#

you want Particle.FIREWORKS_SPARK

#

i think

main dew
#

How I can clone Packet (PacketPlayOutMapChunk and others)

granite stirrup
#

w h y

#

idk i dont know nms

onyx shale
#

you dont rly clone it

#

you build ur own object

#

or modify the existing one but eh

granite stirrup
#

make a class that extends PacketPlayOutMapChunk ?

onyx shale
#

just build the packetiself

#

it has a constructor as everything else

#

whats var1 its up to you

#

but i guess its entity id

granite stirrup
onyx shale
#

most of the times yes

shadow gazelle
#

Still doesn't work

onyx shale
#

however seems protocol is saying something else

#

it asks for the chunk and the mapid

shadow gazelle
#
Location loc = event.getItemDrop().getLocation();
World world = loc.getWorld();
loc.add(0,0.5,0);
world.spawnParticle(Particle.FIREWORKS_SPARK, 0, 0, 0, 50);
#

Wait

granite stirrup
#

you forgot the location

#

LOL

#

replace 0,0,0 with loc

chrome beacon
#

add reurns a clone

granite stirrup
onyx shale
#

immutable

#

imagine takking the location of a player then randomly adding to it

#

rip..

granite stirrup
#

¯_(ツ)_/¯

shadow gazelle
#

That doesn't work

granite stirrup
#

why?

main dew
#

How clone object without cloneable?>

shadow gazelle
granite stirrup
chrome beacon
shadow gazelle
#

That's what I had before you even sent that

granite stirrup
#

hmm

#

yeah thats weird its meant to work

onyx shale
#

hopefully you dont have particles turned off on the client

#

right?

granite stirrup
#

yeah check

shadow gazelle
#

They're all on

onyx shale
#

should be good to go try it with a default client

#

also are you sure the code even gets there?

main dew
onyx shale
#

do you have some message

main dew
#

bad method ;/

onyx shale
#

not rly

#

thats how you work with packets

#

through nms

shadow gazelle
onyx shale
#

add a debug right after

#

the particles and see

granite stirrup
#

it could be spawning in the ground still

craggy cosmosBOT
granite stirrup
onyx shale
#

packets are rather easy to work with once you get thru constructors

granite stirrup
#

it might not let you get the location of it if its not there

shadow gazelle
#

ah yes

#

incompatible runtime

#

Wait, I set it to 16

#

duh

main dew
#

realy you can tell me how clone object (without constructor)?

granite stirrup
#

well maybe try adding more to the y?

shadow gazelle
#

I'm dropping it on top of a barrier block that's two blocks above the ground

granite stirrup
#

f

#

then idk

#

either thats its not getting the Location or something is wrong with your client

#

or it could be something else but i doubt it

shadow gazelle
#

What in hell

granite stirrup
#

?

chrome beacon
shadow gazelle
#

I added System.out.println(loc) and System.out.println("Added enchant"), neither were sent

granite stirrup
#

f

shadow gazelle
#

But the item got the enchant and lore change

#

and the book got removed

main dew
shadow gazelle
#

Uh

#

?paste

undone axleBOT
shadow gazelle
chrome beacon
granite stirrup
#

lol

main dew
chrome beacon
#

No why would there need to be

wraith rapids
#

you can not clone an object without a constructor

#

if you do not invoke a constructor anywhere, then no new object is created

#

and thus there can be no clone

chrome beacon
#

^

shadow gazelle
#

This is stupid

opal juniper
#

Why lmao

#

What are you trying to do

shadow gazelle
#

Or I am

#

fork

#

I had it on the wrong enchant

chrome beacon
#

add still returns a clone so that's not doing anything

shadow gazelle
#

@granite stirrup I am have dumb

opal juniper
#

And I am… having a stroke reading that

shadow gazelle
#

Probably

granite stirrup
#

?

shadow gazelle
shadow gazelle
granite stirrup
#

lol

#

u should make it so you can reuse some code cuz putting same code in multiple classes or in different methods is really not a good idea

shadow gazelle
#

After you said that I realized there's a way more efficient way to do part of this

#

well

#

maybe

#

I am have stupid tho

dusk flicker
#

That's what I ended up doing is using a utils class for stuff like a confirmation gui, just make it return a boolean etc

#

Util classes are the best

granite stirrup
#

ye

#

no

digital plinth
#

does anyone know of a way to check if a mv world exists and finished initializing

#

using the mv api

#

some code get ran and boom chunks now exists

#

jk

#

well i believe this is how mc world get created:

#
  1. world filled with stone with terrain (called voice-map or something)
#
  1. add grass, water
#
  1. add structures and trees and stuff
#

nop

#

maybe nether world are just lighter

wraith rapids
#

do you use paper

#

because chunk generation differs on paper, especially in speed

#

so you'll have to ask the paper people

#

you'll probably be better served over there anyway, as basically everyone here are noobs and haven't worked on world generation, let alone know how it works under the hood

#

have you asked the paper people

digital plinth
#

how 2 cancel a bukkit task

#

ik its like Bukkit.getScheduler().cancelTask(id);

#

but i cant use it from within the runnable

#

since the int id is not initialized

sage swift
#

can't you just do cancel()

wraith rapids
#

if you need to use it within the runnable, you need to use a BukkitRunnable

#

and call this.cancel()

digital plinth
digital plinth
#

the method cancel

sage swift
#

new BukkitRunnable() {