#development

1 messages · Page 34 of 1

icy shadow
#

yesterday

shell moon
#

the method (from PlaceholderExpansion) called getDefaults()

#

is always called? or only when its the first time running the expansion

#

real question is, what if i want to add default config but i dont want it to keep adding it again

#

if the owner deleted some options

dusky harness
marble owl
dusky harness
marble owl
#

its okay dw, im more concerned about getting this plugin to work lol

noble cedar
#

maybe you should add a option to open guis as admin
so you can take items from the gui

torpid raft
#

why

hoary scarab
#

I've tried everything I can think of at this point lol

icy shadow
hoary scarab
#

You can also read the past conversations for what I have tried as well as the advice I have bee given.

icy shadow
#

You’re not writing the response string length

hoary scarab
icy shadow
#

everything is included in the packet length

hoary scarab
#

Ok so yeah its already set.

icy shadow
#

No it’s not

hoary scarab
#

in sendPacket I add the buffer limit

icy shadow
#

that is not the same thing

#

length of the packet data != length of the string

#

you need both

hoary scarab
#

So would I add to the buffer limit? buffer.put(0, buffer.limit()+response.length)?

icy shadow
#

no what

#

that's really unsustainable and that's a completely different thing

#

whenever you write a String, you write its length first

hoary scarab
#

Ok, let me go test something

icy shadow
#

this is a rough sketch of what the data should look like, note the string length being written twice

icy shadow
edgy lintel
#

you major in computer science?

icy shadow
#

don’t really have majors here but yes

hoary scarab
#

Having issues trying to create a byte array for the int rather then writing directly to stream

icy shadow
#

?

hoary scarab
#

Nothing just on my part lol

hoary scarab
#
private void handleMOTDRequest(DataInputStream in, DataOutputStream out, int packetSize, int packetId) {
    Output.debug("Handling Packet:HANDSHAKE");
    try {
        int status = 0;
        
        byte[] packet = new byte[packetSize];
        in.readFully(packet);
        status = packet[packet.length-1];
        Output.debug("Handshake [status:"+status+"]");
        
        int responseId = UninitializedConnectionTypes.ClientBound.STATUS_RESPONSE.getId();
        byte[] responseBytes = response.getBytes(StandardCharsets.UTF_16);
        
        ByteBuffer buffer = ByteBuffer.allocate(9999);
        buffer.putInt(responseId);
        buffer.put(varMethods.createVarInt(responseBytes.length));
        buffer.put(responseBytes);
        
        Output.debug("Sending Packet:STATUS_RESPONSE [id:"+responseId+",status:"+status+"]");
        readBytes(responseBytes);
        
        sendPacket(out, buffer);
    } catch(IOException e) {
        e.printStackTrace();
    }
}

public byte[] createVarInt(int paramInt) {
    List<Byte> buffer = new ArrayList<>();
    
    boolean loop = true;
    while (loop) {
        if ((paramInt & 0xFFFFFF80) == 0) {
            buffer.add((byte)paramInt);
            loop = false;
        }else {
            buffer.add((byte)(paramInt & 0x7F | 0x80));
            paramInt >>>= 7;
        }
    }
    
    byte[] output = new byte[buffer.size()];
    for(int i = 0; i < buffer.size(); i++)
        output[i] = buffer.get(i);
    return output;
}
```Same output (failed packet basically) Tried mimicking the var method without outputting.
edgy lintel
#

idk shouldnt the leftmost 1 be 0 in the first 8 bits?
cuz basically you are trying to fit 8 bits of integer in 1 byte right?

#

but tbh you probably wont need this varint method in the first place?
cuz the bits of the length should be of constant length, or else it will be imposssible to know the length?
like the length can be 1 byte two bytes or even 4 bytes
but its supposed to be 4 bytes fixed

#

just uneducated guess if you deem its wrong ignore

icy shadow
#

Why are you doing varints like that

edgy lintel
#

one way to learn cpp socket programming in java for me lmao

edgy lintel
icy shadow
#

🤨

edgy lintel
#

usually for packet length, the field should be a constant uint_32 or whatever thing that have fixed length, not a number type with variable length that can be 1 byte, 2 bytes, 3 bytes or 4 bytes
Does that make sense?

icy shadow
#

that is not true in this case

spiral prairie
#

varint exists too

icy shadow
#

packet length is explicitly a varint

#

as is the string length

edgy lintel
#

yeah well i guess i dont know much about minecraft packets
i assume its higher level packet setting to have a variable packet length field?

spiral prairie
#

i mean just look at the packet structure

edgy lintel
#

🤔

#

yeah imma head out

icy shadow
#

it's not particularly high level

minor summit
#

lol

hoary scarab
#

Can't reply to 2 messages lol

WanderingPalace — Today at 10:07 AM
are you sure 0xFFFFFF80 is the right number?

Brister Mitten — Today at 10:16 AM
Why are you doing varints like that

Method was taken from https://wiki.vg/protocol and just made it so I can use the byte[] instead of writing it directly to output

icy shadow
#

the one there looks very different to the one you've written lol

hoary scarab
minor summit
#

I would say that after 15 hours, it might be quicker to test it yourself by putting a System.out.println

shell moon
#

computer is slow

#

brain too

minor summit
#

15-hours-to-test-a-placeholder slow?

hoary scarab
#

or read the source code 😉

shell moon
hoary scarab
#

I feel like my issue is the packet size now... Like maybe I'm not writing the right size

#

Could still be completely wrong though xD

#
int responseLength = response.getBytes(StandardCharsets.UTF_16BE).length;
int statusSize = (responseLength+varMethods.createVarInt(responseLength).length);
Output.debug("StatusSize: "+statusSize);
            
varMethods.writeVarInt(out, statusSize);
varMethods.writeVarInt(out, 0);
varMethods.writeString(out, response, StandardCharsets.UTF_16BE);
```Even tried this (and variations of) and still getting the 1.6 ping packet as a response...
icy shadow
#

size includes the packet id so yes

hoary scarab
#

as well as int statusSize = (responseLength+varMethods.createVarInt(responseLength).length+varMethods.createVarInt(0).length);
Just for the hell of it lol

past ibex
#
  • Don't advertise anywhere unless the channel states otherwise.
tight junco
#

probably

#

if you're doing it in a plugin

#

yes

tight junco
river solstice
#

my mans speakin to himself zz

#

schizo rant

stuck hearth
#

I would probably compare your code with the examples on wiki.vg and see if anything sticks out.

hoary scarab
#

I have, also multiple users have given suggestions over multiple days and still can not get it to work.

icy shadow
hoary scarab
hoary scarab
icy shadow
#

Ideally all of it

hoary scarab
#

Holy shit!!!!

icy shadow
#

whatever you’re sending

hoary scarab
#

I fucking got it

icy shadow
#

What did you change?

hoary scarab
#
private void handleMOTDRequest(DataInputStream in, DataOutputStream out) {
    try {
        int responseLength = response.getBytes(StandardCharsets.UTF_8).length;
        int statusSize = (responseLength+varMethods.createVarInt(responseLength).length);
        
        varMethods.writeVarInt(out, statusSize+1);
        varMethods.writeVarInt(out, 0x00);
        varMethods.writeString(out, response, StandardCharsets.UTF_8);
    } catch(IOException e) {
        e.printStackTrace();
    }
}
icy shadow
#

lol

#

that's because you weren't including the byte for the string length

hoary scarab
#

Literally been working on this for over a week FML

icy shadow
hoary scarab
icy shadow
#

anyway that approach is not particularly good

#

you dont wanna be calculating the length manually if you can help it

hoary scarab
#

Yeah I was using bytebuffer but wanted to manually do it for debugging

icy shadow
#

refactor it out, make that method just write the packet id, string length and string, then make a separate thing to write the length (and if you ever get that far, compression)

hoary scarab
#

Just wanted to get this packet down the rest should come naturally now. Damn this took way to long

icy shadow
#

indeed

hoary scarab
#

So just making sure, do you have to add the size before any object other than string?

icy shadow
#

it'll say on the wiki for the corresponding data types, but off the top of my head it's just that and arrays

#

usually depends on context though

#

just look it up ad-hoc

hoary scarab
#

👍

#

Got ping to work first try xD

#

Although the favicon isn't showing, hmmm

stuck hearth
#

Make sure it's 64x64 or it won't render

hoary scarab
#

It is

#

Ill try another one here in a bit

hoary scarab
#

Yeah must have been the image I used. Another one worked.

forest jay
#

I have this class: https://paste.helpch.at/awurixahoz.typescript. And I am having issues importing it. It worked like 5 minutes ago, but IntelliJ just started freaking out and now no classes can access that class. I checked the imports, and they are correct. I rebuilt gradle and restarted IntelliJ multiple times. Any ideas?

#

It is there through Explorer, so I know it is a physical file.

dusky harness
#

also what happens if you go into that file in IJ?

It is there through Explorer, so I know it is a physical file.

forest jay
#

IntelliJ treats it like normal

#

until I go into another class

forest jay
minor summit
#

close intellij and nuke .idea

forest jay
#

I deleted the file and added it back, and now it works. seems like a cache bug or smthing

minor summit
#

or that ig lol

#

intellij is very silly sometimes

forest jay
#

I am using the beta version, so I guess I cant complain

dusky harness
#

File -> Repair IDE

#

😌

minor summit
#

last time I tried it none of it worked lol

fading stag
#

I want to change CONTENT of the chests that are generated naturally (Temple chests, Village chests etc)

I'm thinking about what is the best way to do it but I don't have a better idea then listening new chunk create event then looping over all the blocks in it and checking is block a chest (it doesnt sound too optimised lol) is there any better way than this?

torpid raft
#

loot tables?

fading stag
#

Have never heard of it

fading stag
#

Thanks!

torpid raft
#

👍

fading stag
torpid raft
#

i havent dealt with loot tables much so im not positive but there's a very good chance you can also manipulate them with plugins

fading stag
#

This was very helpful thanks

torpid raft
#

you are very welcome

amber ferry
#

Anyone know how to cancel knockback for when a player hits a nonplayer entitiy with PrococolLib 3.7.0 for Bukkit 1.7.10?

I tried listening for and cancelling the PacketType.Play.Server.ENTITY_VELOCITY packet, but that only seems to cancel knockback for when a player hits another player

forest jay
#

just manually do the damage and then cancel the event

forest jay
#

What would be the best way to override a default crafting recipe? I know that I can loop through the iterator and make my own, but I saw somewhere that there are hidden recipes that then get ignored. I saw that you can do it through NMS, but the examples were out of date and I couldnt find the modern versions. What is the best way to replace the default crafting recipes?

vestal talon
#

Hello there ,
I linked ProtocolLibAPI to my project and I'm trying to spawn a armorstand and it's not spawning in the world, my code:

public void spawnEntity(Entity entity, Location location) {
        PacketContainer packet = this.getProtocolManager().createPacket(PacketType.Play.Server.SPAWN_ENTITY);
        packet.getIntegers().write(1, 1);
        packet.getDoubles().write(0, location.getX());
        packet.getDoubles().write(1, location.getY());
        packet.getDoubles().write(2, location.getZ());
        packet.getEntityTypeModifier().write(0, EntityType.ARMOR_STAND);

        this.getProtocolManager().broadcastServerPacket(packet);
    }
    
    public void despawnEntity(Entity entity) {
        PacketContainer packet = this.getProtocolManager().createPacket(PacketType.Play.Server.ENTITY_DESTROY);
        packet.getIntegers().write(0, entity.getEntityId());
        this.getProtocolManager().broadcastServerPacket(packet);
    }

about the entity I provide to spawnEntity they are entities I spawn to the world and right before the spawnEntity i remove them from the world.
What am I missing? (it's the first time using ProtocolLib)

proud pebble
#

i would assume that your missing the entity's id and UUID

vestal talon
sonic cobalt
#

Does any of you know of a plugin that gives you the ability to add collectibles to your server?

A plugin where people can collect certain limited edition items.

sonic cobalt
#

I'm getting passed around like a hot potato around here

torpid raft
#

#hot-potato

spiral prairie
#

Are there any libs for using HOCON in Java with POJOs?

icy shadow
#

maybe

#

yes, in fact

stuck hearth
#

I also have heard that

#

Jackson has a pojo lib, and I think Configurate does this as well

torpid raft
#

HOCON this duck

river solstice
#

is

    @EventHandler
    public void onBlockInteract(CancellableEvent e) {
        if (e.isCancelled()) {
            return;
        }
     ...

is (basically) the same as

    @EventHandler(ignoreCancelled = true)
    public void onBlockInteract(CancellableEvent e) {
        ...
    }

?

sterile hinge
#

yes

river solstice
#

sometimes I'm confused how some people are allowed to code

tight junco
#

if you do java @EventHandler(ignoreCancelled = false) public void onEvent(CancellableEvent e) { } its the exact same as ```java
@EventHandler
public void onEvent(CancellableEvent e) {
}

#

crazy that right

minor summit
#

no

#

not in the slightest

tight junco
#

or functionally the same

minor summit
#

(i meant it's not crazy)

tight junco
#

oh

forest jay
#

thats like 6 more steps than it requires

forest jay
#

I am trying to add lore to default vanilla recipes. ```java
List<Recipe> recipes = new ArrayList<>();

for (Iterator<Recipe> it = Bukkit.recipeIterator(); it.hasNext(); ) {
Recipe recipe = it.next();

if (recipe.getResult().getItemMeta() == null) {
    System.out.println("Skipped recipe");
    continue;
}

ItemStack item = new ItemConstructor(recipe.getResult())
        .setLore("", ChatColor.translateAlternateColorCodes('&', "§8§lCOMMON"));

if (recipe instanceof ShapedRecipe shapedRecipe) {
    Bukkit.removeRecipe(shapedRecipe.getKey());

    NamespacedKey key = new NamespacedKey(TaleOfKingdoms.getInstance(), shapedRecipe.getKey().getKey());
    ShapedRecipe newRecipe = new ShapedRecipe(key, item);
    newRecipe.shape(shapedRecipe.getShape());
    shapedRecipe.getIngredientMap().forEach((character, itemStack) -> {
        if (itemStack != null) {
            newRecipe.setIngredient(character, itemStack.getType());
        }
    });

    recipes.add(shapedRecipe);
}

if (recipe instanceof ShapelessRecipe shapelessRecipe) {
    Bukkit.removeRecipe(shapelessRecipe.getKey());

    NamespacedKey key = new NamespacedKey(TaleOfKingdoms.getInstance(), shapelessRecipe.getKey().getKey());
    ShapelessRecipe newRecipe = new ShapelessRecipe(key, item);
    shapelessRecipe.getIngredientList().forEach(itemStack -> newRecipe.addIngredient(itemStack.getType()));

    recipes.add(shapelessRecipe);
}

}

for (Recipe recipe : recipes) {
Bukkit.addRecipe(recipe);
}

river solstice
#

what

hoary scarab
#

Pretty sure shaped recipes require a char for air (null) as well...
And debug it, see where the code doesn't function.

#

Thanks discord... Don't reply when I want you to 🤦

dense drift
river solstice
#

yeah intellij is drunk

dense drift
#

it tells you that the condition is always false because Bukkit#getOfflinePlayer is marked as @Notnull

dense drift
#

you should use the namespace of the original recipe

forest jay
#

oh

forest jay
river solstice
#

anyone knows a reliable dependency manager at runtime api or wtv?

#

so I don't have to shade 10 different libs

#

something like pdm by brister

dusky harness
#

or if you're using 1.16+

#

then spigot itself

spiral prairie
#

although I dont understand why you wouldnt want shading

dense drift
#

Spigot has a size limit for premium plugins, 4.5mb or something

pulsar ferry
#

All plugins have that limit, but free plugins can link to an external download while premium can't

spiral prairie
#

premium cant? damn

forest jay
hoary scarab
frosty laurel
#

Anybody have experience automating / outsourcing parts of a project to a remote desktop? Wondering how I can "send" and "return" JSON data with a Remote Desktop

dusty frost
#

SSH, http server

#

Many options lol

past ibex
warm steppe
#

What's a drm?

dense drift
#

yes

frosty laurel
# dusty frost SSH, http server

Which one is the most low-maintenance easiest solution to implement? The script on my computer is in Python and the script on the remote desktop one is also python
And all I need is the ability to "send" a string (JSON) and "return" a string (also JSON), no added complexity like transferring files or anything like that

dusty frost
frosty laurel
dusty frost
#

then you'd just use HTTP and stuff, super easy

signal grove
#

i like to use a python api for json

#

like flask

dusty frost
#

yeah if you just need something quick, flask is a great choice

forest jay
# forest jay I am trying to add lore to default vanilla recipes. ```java List<Recipe> recipes...

here is the updated version:
I want to add a section of lore to every crafting recipe, and using tutorials I found online, this was the best supposed method. It doesnt work as intended, and nothing changes on the crafting result. ```java
List<Recipe> recipes = new ArrayList<>();

for (Iterator<Recipe> it = Bukkit.recipeIterator(); it.hasNext(); ) {
Recipe recipe = it.next();

if (recipe.getResult().getItemMeta() == null) {
    System.out.println("Skipped recipe");
    continue;
}

ItemStack item = new ItemConstructor(recipe.getResult())
        .setLore("", ChatColor.translateAlternateColorCodes('&', "§8§lCOMMON"));

if (recipe instanceof ShapedRecipe shapedRecipe) {
    Bukkit.removeRecipe(shapedRecipe.getKey());

    ShapedRecipe newRecipe = new ShapedRecipe(shapedRecipe.getKey(), item);
    newRecipe.shape(shapedRecipe.getShape());
    shapedRecipe.getIngredientMap().forEach((character, itemStack) -> {
        if (itemStack != null) {
            newRecipe.setIngredient(character, itemStack.getType());
        }
    });

    recipes.add(shapedRecipe);
}

if (recipe instanceof ShapelessRecipe shapelessRecipe) {
    Bukkit.removeRecipe(shapelessRecipe.getKey());

    ShapelessRecipe newRecipe = new ShapelessRecipe(shapelessRecipe.getKey(), item);
    shapelessRecipe.getIngredientList().forEach(itemStack -> newRecipe.addIngredient(itemStack.getType()));

    recipes.add(shapelessRecipe);
}

}

for (Recipe recipe : recipes) {
Bukkit.addRecipe(recipe);
}

unborn ivy
#

but it can be easily leaked if someone just copies the file link and sends it to whoever and they will be able to download it aswell

pulsar ferry
#

Not allowed on Spigot

cunning geyser
#

you have to make your own anti-piracy system

sharp cove
#
    if (OorlogSimulatie.instance.getSettingItems().normalSwordBoolean){
                    OorlogSimulatie.instance.getSettingItems().normalSwordBoolean = false;
                }else{
                    OorlogSimulatie.instance.getSettingItems().normalSwordBoolean = true;
                }```
```java
OorlogSimulatie.instance.getSettingItems().normalSwordBoolean = !OorlogSimulatie.instance.getSettingItems().normalSwordBoolean;```
#

Is this a good way to simplify this?

torpid raft
#

seems fine

sharp cove
#

oke, thanks

torpid raft
#

ignoring the static abuse

sharp cove
#

yes

#

please haha

#

its for myself so doesn't really matter here

torpid raft
#

🤷‍♂️

sharp cove
#

Its not open, just private

#

Why not use it then yk if its making some things so much easier

torpid raft
#

a lot of people would disagree with the premise that it makes things easier

tight junco
#

mostly because you generally want to keep the best practice throughout all your projects to make maintaining the projects way easier long term

#

you make a plugin that has generally bad practice all throughout

#

someone else [may] have to work on the plugin, they load it up

sharp cove
#

normally indeed i don't want to use static abuse or anything

tight junco
#

but regardless its still makes a project harder to maintain

#

the more you implement static abuse, the harder it gets to work worth the worse it is to maintain

icy shadow
#

it may be easier in the short term but it will absolutely make your life harder in the future

#

you could write all your code in a single class but you end up with very rigid inflexible code

#

Same principle

dense drift
river solstice
#

how do I make sure that the storage field map key/value types are the ones that I define?

grim oasis
#

How do I make it so when I have to specify an api version that it works on multiple server versions instead of just the api I specify?

river solstice
#

I call super with <String, String>, but IDE doesn't understand

shell moon
#

api-version: 1.13

river solstice
#

that the storage field has that type of key/value

grim oasis
shell moon
#

yes

#

however

#

i'm not sure about those brand new master daster features

#

of the new versions (if any)

#

but about materials

#

api-version: 1.13

#

doesnt affect 1.8 - 1.12

#

and still allows you to use new materials

#

without LEGACY_NAME

grim oasis
#

hmm ok

#

not sure why I need it so

#

lol

shell moon
#

including that thing called block data

#

or something like that

#

wonder what are you doing

#

xd

grim oasis
#

i think it's for cmd

#

so 1.14

shell moon
#

all my plugins are 1.8.8 - 1.19.3

#

and never had any issue with api-version

#

however people say "its not good"

#

or something

#

but, 1.8 doesnt care

grim oasis
#

i'll just set to 1.14 and see

#

thanks

pulsar ferry
river solstice
#

oh, ok, thanks, totally forgot about this approach

shell moon
#

api-version: 1.14

#

means minimum required version is 1.14

#

so should work too

#

however api-version: 1.13

#

allows you to use everything (afaik)

#

including ofc +1.14 exclusive features such custom model data

#

but if your plugin is +1.14 only, then api-version: 1.14 is fine

grim oasis
#

if you set 1.13?

vital drum
#

wie joine ich servern mit geyser per ip die auf meinem pc gehostet sind ich nutze port freigabe?

#

how do i join servers with geyser via ip that are hosted on my pc i use port sharing?

shell moon
#

the api version

#

means that version AND above

#

never below

#

thats why you see in spigot those reviews

#

"Not working in 1.14 ⭐ "

#

because the developer forgot to set api-version to 1.14

vital drum
#

how do i join servers with geyser via ip that are hosted on my pc i use port sharing?

shell moon
#

or 1.13 in case it allows it

#

no need to repost the message i think

shell moon
#

idk if its correct or not what i'll tell you tho

vital drum
#

yes

#

i wanna know

vital drum
shell moon
vital drum
#

its working thanks

pure crater
river solstice
#

yes

shell moon
west socket
#

Does anyone know if it’s possible to manipulate end crystal beams in 1.8?

proud pebble
#

according to the javadocs its not in the api, but could be done through nms i think

#

right, according to what i found, you can only set the location of the beams with 1.9

#

from what i gathered i dont believe its possible to change the position it points without modifying the server jar directly

west socket
#

Yeah its not in the APi

#

Trying to figure out what packet to send

#

Ah

#

Maybe I send fake dragon entity?

proud pebble
west socket
#

Yeah I guess that's what I'll have to do

proud pebble
#

probably the best option

kindred yew
#

Hey, so I made special items, but they appear to be very dark in the inventory, Not exactly sure what to do, I angled them so maybe the light source does not hit them correctly, but I want to disabled like the shading on them

dark garnet
#

i thought string implemented/extended object

past ibex
#

They do, but collections are weird in java

dark garnet
#

i can change what is required btw, i have it as Collection<Object> cause i wanna allow any type of collection to be used and any type of object

dusky harness
#

or smth

#

oh wait

#

yeah ig you have to just to map all the values to the new collection

#

like addAll

dark garnet
dusky harness
#

for which part

#

chances are IJ is correct

dusky harness
#

i mean like what code

dark garnet
#

it fixes it but it just seems so pointless

dusky harness
#

¯_(ツ)_/¯

dark garnet
dusky harness
#

i mean like what code exactly

#

oh shoot its midnight

#

wow

#

claim ur daily

dark garnet
#
public Collection<Object> onTabComplete(@NotNull AnnoyingSender sender) {
    return TeamManager.getTeamIds(); // <-- this
}
dusky harness
#

🤔

#

Hm

#

wait isn't that the code that doesn't compile

dark garnet
#

TeamManager#getTeamIds returns a Set<String>

dark garnet
#
public Collection<Object> onTabComplete(@NotNull AnnoyingSender sender) {
    return Collections.singleton(TeamManager.getTeamIds()); // <-- this
}
#

IJ tells me to adapt to that, which works, but again, seems super pointless

dusky harness
#

Nooo

#

that'll give you a Collection<Set<String>> basically

#

🥲

dark garnet
#

so true

#

ugh what do i do 😭

dusky harness
#

I'd recommend returning a Collection<String>

#

¯_(ツ)_/¯

#

if that doesn't work u can make a new list and add all of them in a loop

dark garnet
dusky harness
#

does Collection<? extends Object> work

dark garnet
dusky harness
#

I'm not sure how looping through ? works

dusky harness
#

ohh ok

#

then u can just do ?

#

I wasn't sure

dusty frost
#

iirc it should be a List<String> lol

dark garnet
dark garnet
dusky harness
#

so I just left it like that

dusty frost
#

regardless, I don't see what other objects you'd allow besides Strings

#

you have to put them in a Component at some point lol

dark garnet
dusty frost
#

so you just call toString() on whatever?

dark garnet
dusty frost
#

that sounds like a recipe for disaster lol

#

gonna get a lot of hashcodes

#

I would just keep it explicit, the whole point of a type system is that you limit what types things can be

#

and I feel like rarely do you want to return an entire object/that object's toString, you want to return a field of it or a name or something

dark garnet
#

its mainly just for things that ik will return a pretty string

dusty frost
#

so just call it explicitly

#
return things.stream().map(Item::toString).collect(Collectors.toList());```
leaden sinew
#

Or make a class like

interface Tabbable {

  String getAsTabCompletion();

}
dusty frost
#

but I mean then you're just moving the conversion from a method in the command to a method in the object

#

which I guess could be a good idea if you're using a lot of the same objects across various commands?

leaden sinew
dark garnet
#

ye ill probs just stick to Collection<String> (which is what i had before using Object anyways) to keep things simple

dusty frost
#

I would stick to List<String> to have a guaranteed order

dark garnet
dusty frost
#

i mean what if you do though lol

#

you'd at least want consistent order

#

might need alphabetical, might want to sort based on popularity or some other metric, etc.

#

at some point you're going to have to convert that into a List anyways

dark garnet
#
return suggestions.stream()
        .filter(string -> string.toLowerCase().startsWith(args[args.length - 1].toLowerCase()))
        .collect(Collectors.toList());```
dusty frost
#

once again you might as well let the producer decide what that order should be

dark garnet
#

couldnt i still return a List<String> since List extends Collection?

dusty frost
#

you could

#

but you could also return an unordered set

#

or an unordered tree

#

or an unordered hashmap

dusky harness
#

wait hashmap extends Collection?

dusty frost
#

it is indeed a collection lol

dusky harness
#

are you sure

dusty frost
#

it doesn't directly

#

Map does

dusky harness
#

Map isn't a Collection tho

#

since iirc Collection has like #add

dusty frost
dusky harness
#

ye but i mean the Collections class itself

#

or interface

#

I don't know what it is

#

oh it's an interface

dusty frost
#
The collection interfaces are divided into two groups. The most basic interface, java.util.Collection, has the following descendants:

java.util.Set
java.util.SortedSet
java.util.NavigableSet
java.util.Queue
java.util.concurrent.BlockingQueue
java.util.concurrent.TransferQueue
java.util.Deque
java.util.concurrent.BlockingDeque

The other collection interfaces are based on java.util.Map and are not true collections. However, these interfaces contain collection-view operations, which enable them to be manipulated as collections. Map has the following offspring:

java.util.SortedMap
java.util.NavigableMap
java.util.concurrent.ConcurrentMap
java.util.concurrent.ConcurrentNavigableMap```
dusky harness
#

for ex there's no #add

#

it doesn't inherit the Collection methods

dusty frost
#

all right I'll concede that it doesn't work for that exact case

#

but the point still stands that you can pass a lot of non ordered things into it when it should be ordered

dusky harness
#

also I just found out that java has a Dictionary class

#

by reading the 2nd line of the Map javadoc

#

lol

signal lintel
dusty frost
signal lintel
#

Oki, thank you!

pulsar ferry
#

Why is that not true by default? I feel like that'd be more common than the other way around

dusty frost
#

honestly not sure, backwards compatibility reasons I'm guessing?

#

don't worry - this'll all be fixed in PAPI 3.0 - coming 2030 😌

river solstice
#

Soon ™️?

stuck canopy
#

What method should I use to store ItemStacks in blocks

#

like furnace and brewing stand does

river solstice
#

Is it possible to disable block outlines/prevent players targeting specific blocks?
Similar idea like in adventure mode.

pulsar ferry
#

With resource packs yes, without it, probably not

river solstice
#

ah, shucks.

#

I'd need this functionality specifically for barrier blocks

hoary scarab
river solstice
#

I'm talking about the outline

hoary scarab
#

Oh thats odd.

#

Thought it didn't show

pulsar ferry
#

Only doesn't in adventure mode

hoary scarab
#

Well you could code a plugin that checks the block you're looking at and switches your gamemode from survival/adventure

pulsar ferry
#

lol

river solstice
#

yeah and no

#

I still want the game to be playable

#

lol

hoary scarab
#

Why would that make it unplayable?

river solstice
#

players fighting in the arena, suddenly get switched to adventure mode

#

back n forth

pulsar ferry
#

I look at a barrier block, oh no I am not invinsible

hoary scarab
#

I'm not seeing the issue lol. Adventure mode just stops you from using tools other then whats needed to mine blocks right?

signal grove
#

well you can still pvp in adventure mode, but its kind of a janky fix. plus players that lagged would randomly not be able to break/place things until they un-lag

river solstice
#

I'm not sure. Might mess with other plugin functionalities

#

if they only check survival/creative modes.

signal grove
#

i think the idea is to hide barrier blocks, which would still show a split second of the outline if this solution is used anyways

hoary scarab
pulsar ferry
#

It's vey unstable

hoary scarab
#

Well... If you don't mind the lag back from ghost blocks... (Running through and being tp'ed back) You can just send the player air blocks where the barrier blocks are.

pulsar ferry
#

What's so bad about the outline anyways?

river solstice
#

immersion

hoary scarab
signal grove
#

oh i gues not

pulsar ferry
#

If you want immersion throw in a resource pack then ;p

signal grove
#

i assumed your goal was to make like a hidden parkour jump or something. but if it's just meant to restrict players location than probably worldguard would work

river solstice
#

yeah well, I am using WG, but it get's annoying making N different regions for all the restricted areas

#

if this was possible it would've been nice, but owell

signal grove
#

you could also just make a polygonal region around where players are allowed to be

hoary scarab
signal grove
#

yes

hoary scarab
#

Will tp you back to before you left the region

past ibex
past ibex
#

adventure has been in the game since 1.8

past ibex
#

thanks mojang!

#

way to support poses

river solstice
#

world is complete now

#

all problems solved

dense drift
pulsar ferry
dense drift
edgy lintel
#

PlayerStatisticIncrementEvent
anyone have experience using this event?

it mentioned its not updated with high frequency
so how frequent exactly is it updated?

is it more like a combination of other events, such as health events and the others?
if it is similar to registering multiple listeners then im using it.
thx in advance!

river solstice
#
public class PlayerStatisticIncrementEvent
extends PlayerEvent
implements Cancellable
Called when a player statistic is incremented.
This event is not called for some high frequency statistics, e.g. movement based statistics.
edgy lintel
#

yes friend, I have checked the doc thx.

#

im just not sure if it behaves like normal listeners for specific events

#

or are there any other mechanisms

#

i need someone that has the experience of using it

edgy lintel
#

anyone that can help me? its kinda urgent so pls
ping me if you have actual info, thx a lot in advance!

sterile hinge
#

well the event isn't triggered for some statistics. but there isn't anything special about it

edgy lintel
#

so it is triggered from normal actions such as damage taken right?
like not the player statistics in the scoreboard or sth?
@sterile hinge (sorry for the ping but really kinda urgent, just a quick answer tho)

sterile hinge
edgy lintel
#

ahh damn this looks sus enough

#

i just wanna know if this event is triggered once the player does the action

#

or its just a stupid updating task that grabs statistics once in a while

#

i am interpreting the former from your last message, but i need your confirmation

#

yeah this certainly looks like a minecraft statistics
sorry im stupid
but i guess its fast enough

river solstice
#

these are not processed by the event

edgy lintel
#

alr thx for your info bro appreciate it

hoary scarab
#

Alot of things that should be in events but are "to spammy" should be sent atleast as an async event so it can atleast be tracked.

river solstice
#

so it 'can' at least be tracked you mean?

hoary scarab
#

Didn't read after I sent it

leaden sinew
hallow oak
#

trying to add papi support to my plugin but it is not parsing.
it recognizes it as a hook as it is listed in /papi list, but when I do /papi reload it only says 1 placeholder hook registered, that 1 being a different expansion we already have
Here is the class that I do this all in: https://pastebin.com/refaRCnv
and then I register it in the onEnable method in the javaplugin class:

        placeholderManager = new PlaceholderManager(instance);
        placeholderManager.register();

Any ideas?
at a loss here
(I added those log messages to see if it was even parsing, none of those show up in the log)

proud pebble
hallow oak
#

“%goal_TestGoal_parent”

proud pebble
hallow oak
#

wdym?

#

OHHH does it have to be “MetaGoals_”

#

At the beginning?

proud pebble
#

yeah

hallow oak
#

Ahh I see, ty

proud pebble
#

also im not sure if it matters if you have capital letters in your identifier

#

like the getIdentifier method

hallow oak
#

Using “MetaGoals_TestGoal_parent”, requested gets logged

#

though it doesn’t appear to get past the length check

proud pebble
#

cus its identifier, then parameters

#

so thats id + 2 parameters

hallow oak
#

Ah I see! Thank you for your help!

dense drift
pure crater
#

I want to protect my api from remote code execution (because one of the params it takes is a URL). Suppose I want the url to be accepted if it fits one of these websites: https://ytdl-org.github.io/youtube-dl/supportedsites.html

I could easily split the url with . and see if one of the elements is a valid domain (like youtube twitch), and check if the next element has the correct top-level domain (like .com, etc), but the thing is that I have no idea what the top-level domains for those specific websites are. The list only shows the domains but not the actual top-level domains, so someone could do an attack if they used youtube.net instead of the actual website youtube.com (this is obviously hypothetically speaking). Is there a better way to check url validity in this case?

river solstice
#

well, create a list of legit domains

proud pebble
#

like a whitelist of domains

torpid raft
#

oh wait i see, you don't have the tld

#

tbh that list seems pretty useless, like others have said just build up a list of approved domains as you go

gritty kayak
#

anyone know if the voteparty api is available though maven?

dusty frost
dusky harness
#

That's a lot of websites

dense drift
#

Cornhub, my fav place to watch yt videos on

lyric gyro
#

hi

#

How to remove currency symbol for %vault_eco_balance_formatted% ($)

#

i got double $

river solstice
#

how hard is it to see that this channel is for development

dusky harness
#

Not everyone knows that helpchat means plugin development

minor summit
#

#software-dev

vernal quail
#

How to add external plugin api(.jar) with gradle?

spiral prairie
#

maven local and install file

dusky harness
#

Google

#

👍

lyric gyro
#

Does DeluxeMenus work in 1.19.3?

dusky harness
forest jay
gritty kayak
forest jay
#

On there spigot page it doesnt mention an API, and the source code is private. You can join the discord and ask for it, or you can add it to your local repo. It doesnt look like they have a public api.

minor summit
#

(this is the discord)

#

wait is it lol

dusky harness
forest jay
stuck hearth
dusky harness
#

there's a VoteParty emoji

forest jay
#

I found a different plugin on Spigot called Vote Party

lyric gyro
#
override fun onPlaceholderRequest(player: Player?, params: String): String? {
        val rank = AlchemistAPI.findRank(player!!.uniqueId)
        val profile = ProfileGameService.byId(player.uniqueId) ?: return ""

        when (params) {
            "rankDisplay" -> {
                return rank.color + rank.displayName
            }

            "rankPrefix" -> {
                return rank.prefix
            }

            "activeTag" -> {
                return profile.getActivePrefix()?.prefix ?: ""
            }

            "rankWeight" -> {
                return rank.weight.toString()
            }
        }

        return ""
    }

Doesn't replace anythng -> /papi bcparse Nopox %rankPrefix%

dusky harness
#

it's whatever you return for getIdentifier()

lyric gyro
#

ah

tired olive
sharp cove
#

Is == equal to equalIgnoreCase()?

dense drift
#

no

sharp cove
#

Oh is === the same as EqualIgnoreCase?

#

Oh nvm

#

It checks the type too

#

Didn't even know that

tight junco
#

my brother in christ ```kt
when(params) {
"param" -> return "value"
}

#

player!! NOOO

tired olive
#
  @Nullable
  public String onPlaceholderRequest(final Player player, @NotNull final String params) {
obtuse ether
#

Hello, can someone tell me how to start a plugin with placeholdersapi?

tight junco
#

yes it is i believe

tired olive
#

very consistent usage of nullability annotations

dense drift
#

I currently use ngrok for a http tunnel to my computer's IP so I can test some paypal webhook shit (because they require a domain and dont accept IPs). The problem that I have with ngrok is that the domain is different from a session to another and it is annoying to constantly update the address. Since I host my own domain, I was thinking to redirect all calls to gabytm.me/test/paypal to my-ip:port for example and I was curious if nginx has something for monitoring, to see details about requests (host, headers, method, body, etc.)?

dusty frost
#

could you not just like use Wireguard and reverse proxy from your nginx to your web server and see connection details there?

dense drift
#

Im not sure what that means but I will do some research

#

How would this work, domain > wireguard > local-ip:port?

dusty frost
#

okay so

#

wireguard is a VPN that is awesome and requires very little setup and automatically reconnects when your ip changes and everything'

#

you'd use that to essentially put your server with nginx and your pc you want to receive things on on the same network

#

then, you can just use nginx reverse proxy to send them to like 10.0.0.1 or whatever you choose your wireguard ip to be, and bam your computer can listen on that channel and get all the webhooks

pure crater
dense drift
#

And how would that help, Star?

dusty frost
#

that would help because it would automatically update whenever your IP changed

#

and you could still listen to those sweet, sweet webhooks

dusty frost
dense drift
#

@dusty frost oh no, my ip is not changing that often, but the ngrok domain (they basically give you one like <code>-<ip>.ngrok.io), if I was to use my domain and regirect the traffic to my ip, I would like a monitoring tool, ngrok allow you to see all requests to your domain and your reponse

pure crater
sweet cliff
#

Hello, there's a way to tp the player instantly when touch nether_portal? Currently using the PlayerPortalEvent, but it fires when the player's about to tp, not when it touch. I'm trying to avoid PlayerMoveEvent!

lyric gyro
#

i'm attempting to make a plugin that will past a specific shematic at x y z (it will paste one for each player). what is the best way to do this? is it easy to save and load .schem files or is there a way to access worldedit's .schem files?

minor summit
icy shadow
#

np

royal cypress
#

Hi all, I see for quite a long time, PAPI has support for my plugin UltimateVotes, I wanted to expand the available placeholders but I could not find the repository in order to submit a PR to, is that repository no longer available or?

grim oasis
#

I don't believe there is a repo for it. It might be better to include the expansion in your plugin from this point on vs externally though

dark garnet
#

not sure if this is the place to ask, but im making a discord bot in jda;
im not sure how to go about storing data using mongodb that is per-server
should i create databases for each server or what? i tried googling a bit but found nothing useful

tired olive
#

Just store the guild id in each document

dark garnet
forest jay
#

Like Sparky said I would make each document their own guild, and then just have a "id" field that contains the corresponding guild id.

spiral prairie
#

double-sided copier

heavy wadi
#

When multiple plugins write to actionbar, do they simply replace eachothers texts or do they get queued / appended?

minor summit
#

replace

heavy wadi
#

alright, thanky

icy shadow
#

np

torpid raft
#

np

dark garnet
#

no

#

Autocorrect 😭

dark garnet
#

Wait what about user data? Do I do the same structure (except with user ids instead of guild ids)?

forest jay
dark garnet
torpid raft
#

user_levels probably wouldn't need a separate table/database

dark garnet
torpid raft
#

any data with a one to one relationship can be put into the same table (in general, not always the best idea tho)

#

any data that is not one to one probably deserves separate tables

dark garnet
#

one to one?

torpid raft
#

one to one meaning stuff like user <-> age

#

every user has exactly 1 age

dark garnet
#

what would be an example of not 1-1?

torpid raft
#

let's say exp gains

#

maybe you have a table that tracks every single exp gain event

#

which includes the user who gained it, the amount gained, the source of the gain, and the time

#

one user can have many exp gain events related to them

#

so you can have one table for users and one for the exp gains

dark garnet
torpid raft
#

tbh i'm not too versed in the differences in structure between mongo and sql, i'm giving you this from an sql perspective

dark garnet
#

o

torpid raft
#

but i think each exp gain is a separate document in my example

#

and each user is also a document

nimble vale
#

hey there, should i create a "async task queue thing" for mysql
because calls are async obviously i am wondering if it can be a mess

torpid raft
#

but in mongodb it might be more correct to embed the exp gain events within the user than to relate them externally, idrk

dark garnet
nimble vale
#

i don't know a queue for tasks

#

to execute the async tasks in order

torpid raft
#

not sure if that's the best way mongodb can do it but i dont see any immediate issues with it

torpid raft
nimble vale
#

like idk thats the question actually

#

does it need to be

torpid raft
#

i mean probably not, depends on your usecase though

nimble vale
#

like for example lets say i am creating a home and deleting after that
should create home first and then delete

torpid raft
#

maybe your later queries will depend on the actions of your prior ones and you can't reverse the order

nimble vale
#

but in a scenerio that idk if that can happen

#

delete action can switch with the create

nimble vale
#

it just sounds safe

torpid raft
#

i actually don't know enough to tell you that what you are worried about (generally) won't ever be a problem

#

but you probably won't have the issues you are worried about

#

as long as you don't do silly stuff like try to delete before you create a home

nimble vale
#

yeah lol

#

i considered lagging

#

may be the cause

torpid raft
#

are you using a thread pool manager to handle your sql connections

#

just out of curiosity

nimble vale
#

hikaricp

torpid raft
#

ok

nimble vale
#

if that is what you are asking about

torpid raft
#

yea

torpid raft
nimble vale
#

does that do this for me

torpid raft
torpid raft
#

ok

nimble vale
#

just wondering if tasks order can corrupt somehow because of lagging

nimble vale
torpid raft
#

idk if it applies to this exact case but i know there's a way for you to bundle multiple sql statements together and ensure that they are treated as atomic

#

so that you are guaranteed both the order and that either all or none of them are executed

nimble vale
#

you mean the

#

something like this

#

"create 1; create 2"

torpid raft
#

mm i dont think just that is enough, not sure tho

#

let me look into it one sec

nimble vale
#

like more than one queries in a single query

#

i found this

torpid raft
#

ah i found it, it's called a transaction

nimble vale
#

that would fix the problem mostly

torpid raft
#

yeah again not sure if transactions are exactly what you want but they offer a lot of protection for various situations

#

tbh if you're really worried about this you can always execute the query on the main thread/sync (obv not wait for it the whole time but just get it started), would solve the out of order worries i would think

nimble vale
#

yeah it makes sense

nimble vale
#

is there a thing such as starting in main thread and continuing async

torpid raft
#

actually maybe im lying

#

hold on a sec

nimble vale
#

also i think that queue thing that i said before it's not gonna work as a i expected

#

because even if you order them they are still async so eta depends on the execution speed of tasks etc.

torpid raft
#

yeah idk bottom line this is
a) a good question for someone who knows exactly what hikaricp / the jdbc / sql is doing
b) probably nothing to worry about

forest jay
nimble vale
torpid raft
#

yea

nimble vale
#

i will search it for a while

#

if i find something precious

nimble vale
#

i'll leave it here

torpid raft
#

yeah please do ping me if you find anything out

#

i'm invested now

nimble vale
#

lol thanks for the support 🤝

torpid raft
#

ofc ofc

dark garnet
forest jay
#

yeah, or at least most

#

In most cases there is not a need for multiple documents

dark garnet
#

what about global vs per-server data?

forest jay
#

for that, I would create a database for global, and a database per server, and then just store user data that way.

torpid raft
#

would you even want a database / collection per server

#

that's like, equivalent to making a new table per server in sql right?

forest jay
#

I am not sure about SQL, I know nothing

torpid raft
#

i'm referencing this image because i barely know mongodb

forest jay
#

yea

torpid raft
#

would you need to manually create each collection

forest jay
#

no

#

you can do it all through code

torpid raft
#

well right but

#

i should ask is it good practice to scale the number of collections which exist to N

#

or should you only ever have a constant amount

forest jay
#

I mean, if you have under 100 servers, there shouldnt be any problems

#

hell, under 1000000

#

like, there shouldnt be any issues, and the efficiency will be decreased, but not by much

#

but there would be some serious issues in your overall design for your code/server if you want that many collections

torpid raft
#

right

#

i think a nice and pretty solution would just be to have one table with documents which denote which server they belong to

#

that way it scales to however many servers you want

forest jay
#

but the code isnt as clean, and there would be a lot more documents in each collection

#

you would have to filter each document for the server you are looking for

torpid raft
#

that's true, at that point i'm sure you can index the documents though

forest jay
#

idk, imo it would be messier and I wouldnt do it that way, but that is just me. Idk the best solution.

torpid raft
#

if mongodb lets you do that

torpid raft
#

yeah idk either tbh

forest jay
#

mongodb is powerful if used correctly, and I dont know how to use correctly lol

torpid raft
#

xd

dark garnet
#

sry i just pinged u twice

forest jay
#

your good

supple oar
#

you're*

forest jay
#

your*

minor summit
#

both of you are wrong

dusky harness
#

I'm not wrong

#

😃

#

no

#

😺

supple oar
dense drift
#

warnings could be in their own database

sharp ibex
#

Hey,

I need to edit a plugin. The plugin has Custom effects in minecraft but i want it so it doesn't at certain areas. cause we want to make an event map but the custom effects still work in there and its unfair for the other people.

tight junco
#

nice

#

and?

river solstice
#

ok

sharp ibex
river solstice
#

well, you needing to do X doesn't tell much

tight junco
#

it wasn't even a question

#

it was just a statement saying you need to do something

arctic ermine
#

People I need your help

#

[!] Game is currently whitelisted, wait until whitelist is disabled.

#

I am getting this error every time, I tried everything. From checking startup commands, to all .ymls, to server properties.

#

Whitelist stays on.

tight junco
#

there's probably a different plugin thats causing that

arctic ermine
tight junco
#

Is your whitelist message in spigot.yml set to that

#

the message thats showing

#

if yes, the issue is something in spigot probably idk

#

if not, the issue is with aquauhc

lyric gyro
arctic ermine
tight junco
#

this is still not the right channel Sussy

lyric gyro
lyric gyro
arctic ermine
lyric gyro
tight junco
#

wow that sounds terrible

grand zodiac
#

Hey. I'm having an issue and I am so confused because I don't even know where to start in terms of debugging.

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        System.out.println("1");
        if (!event.getView().getTitle().startsWith("Corpse")) {
            System.out.println("Title does not start with Corpse");
            return;
        }
        System.out.println("2, Title does start with Corpse");
        ItemStack clickedItem = event.getCurrentItem();
        if (clickedItem == null || clickedItem.getType() == Material.AIR) {
            System.out.println("Item is null");
        //    return;
        }
        System.out.println("3");
        //if (event.getClick() == ClickType.SHIFT_LEFT || event.getClick() == ClickType.SHIFT_RIGHT) {
            System.out.println("4");
            // Declare
            Database db = new Database();
            Inventory inventory = event.getInventory();
            InventoryView inventoryview = event.getView();
            String npc_id = inventoryview.getTitle().replaceAll("[\\D]", "");
            System.out.println(npc_id); // Developer note
            System.out.println("5");

            // Update the inventory in the database
            String inventoryString = BukkitSerialization.toBase64(event.getInventory(), event.getView().getTitle());
            System.out.println("6");
            // update the inventory in the database
            try {
                System.out.println("7");
                PreparedStatement updateInv = db.getConnection().prepareStatement("UPDATE corpses SET base64=? WHERE id=?");
                updateInv.setString(1, inventoryString);
                updateInv.setString(2, npc_id);
                updateInv.executeUpdate();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        //}
    }```
#

The point of this method is to update the Database whenever the inventory is modified, as I store a base64 encoded version of the inventory in the Database. However, if a player takes an item out or puts an item in, it doesn't update -- However, if they take multiple items in or out, they all update except for one, how would one go about fixing this? I am so confused.

wary spindle
#

Quick question

#

Is this code using java syntax properly?

#

if (yours.getLeader().getCombo >= opponent.getLeader().getCombo) then (display "§a" + yours.getLeader().getCombo() + "Combo") else if (opponent.getLeader().getCombo >= yours.getLeader.getCombo) then (display "§c" + opponent.getLeader.getCombo + "Combo") else (display "§fNo Combo")

sterile hinge
#

no

wary spindle
#

How can I make it follow java's syntax?

sterile hinge
#

by learning Java

wary spindle
#

I'm currently learning java

#

@sterile hinge Is this better?

#

if (yours.getLeader().getCombo >= opponent.getLeader().getCombo)
then
(display "§a" + yours.getLeader().getCombo() + "Combo")
} else if {
(opponent.getLeader().getCombo >= yours.getLeader.getCombo)
then (display "§c" + opponent.getLeader.getCombo + "Combo")
} else {
(display "§fNo Combo")

signal grove
#

anyone know exactly what caused the newer versions bow boosting mechanics to change?

#

im making an "old bow boosting" plugin, i could jank it by having it boost under certain conditions, but i think it'd be best to find out what happened so i can reverse it better

dusky harness
#

servers with bow boosting have a custom plugin (even on 1.8)

#

i remember making a bow boosting plugin a while ago

#

was pretty fun to fly everywhere lol but wasn't that good

#

I think what happens is that if the arrow has been alive for too little then it won't do anything

#

that's just a guess though

#

high chance that's wrong

signal grove
#

if that's the case i could just make the life longer

wary spindle
#

What is wrong with this code?

dusky harness
#

because you can't really bow boost without modifying the velocity

signal grove
#

what do you mean

#

the normal velocity is fine, no?

#

or did that change in newer versions as well

dusky harness
#

no - whatever server you bow boosted on - they use a custom plugin afaik

signal grove
#

removing the randomness from shots is already handled

dusky harness
#

idk then
it's been months since I made the bow boosting plugin

signal grove
#

ill try adding to its ticks lived and see if that lands a hit

dusky harness
#

oh is that an actual variable?

signal grove
#

yes

dusky harness
#

maybe I just got that guess from deep inside my memory

signal grove
#

it doesnt seem to let me boost when i set to 100, so either something else has changed, or i'm setting it before it spawns or something

dusky harness
#

you can use either paperweight or sponge's tool to see the inner workings

#

both gradle only 🙃

#

i hope you use gradle 😌

signal grove
#

no, but ive only written an event listener really so its not hard to change

dusky harness
#

it's just to view minecraft server code

#

(without spigot)

#

and paperweight is typically used within plugins since it includes paper (and spigot)

#

lemme see if i can find it

signal grove
#

yeah im using spigot

dusky harness
#

bardy was the one that told me about it

pulsar ferry
wary spindle
#

It gives me an error

#

Saying that int cannot be converted to java.lang.String

signal grove
#

use int() instead of Integer()

#

or you may not even need to cast it at all

#

what does PlayerUtil.getPing() return

wary spindle
signal grove
#

what type

wary spindle
#

Int, I think

#

I'm just starting to code

#

I can give you the code, if you want.

signal grove
#

sure, put it in ?paste

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

signal grove
#

oh that works too

#

yes, PlayerUtil.getPing() returns an int

wary spindle
#

I don't know how to make it work, however

signal grove
#

im assuming this is someone elses github

#

since its a fairly large project

wary spindle
#

It's a fork

signal grove
#

im probably misunderstanding something, but to me it looks like it should be

.add("{target_ping}", String.valueOf(PlayerUtil.getPing(target)))
#

ah

signal grove
#

and what does it say then

wary spindle
#

It says that it can't be converted to java.lang.String

signal grove
#

earlier in your file,

PlayerUtil targetPing = PlayerUtil.getPing(target);
PlayerUtil senderPing = PlayerUtil.getPing(sender);
#

these should both be errors also, they should both be "int" instead of PlayerUtil types

wary spindle
#

They work, tho

signal grove
#

i dont think so... are you using an IDE?

wary spindle
#

not anymore

wary spindle
signal grove
#

what are you using to code

#

this should probably be figured out first

pulsar ferry
#

Also Integer(PlayerUtil.getPing(target)) is not a thing, and your IDE would yell at you

wary spindle
#

My computer can't run IDEs

#

13GB left

#

Actually 15GB left, but still

signal grove
#

okay, so when you say "it works", you probably are just committing to github right

pulsar ferry
#

What IDE are you thinking that you can't run with 15GB??

wary spindle
#

Eclipse?

#

That's in storage, btw

#

not in RAM

signal grove
#

i dont think you'll have a fun time coding without an IDE, it's necessary especially on big projects like that

wary spindle
#

I do one thing at a time

pulsar ferry
#

Well good luck

signal grove
#

but each step is never checked

#

lots of small commits can all be wrong (we see many are in this case)

lyric gyro
#

when creating a new file variable, what would the path be to get a .schem file in the plugin's folder? would i just do something like ./plugins/mypluginname/?

pulsar ferry
#

From your plugin instance you can use getDataFolder to get the exact folder your plugin uses

lyric gyro
#

oh that's nice! thank you

lyric gyro
#

getting the error Not all platforms have been registered yet! Please wait until WorldEdit is initialized. when attempting to execute this line of code Clipboard clipboard = reader.read();
not sure why this is happening?

signal grove
#

make sure WorldEdit is added as a dependency in your plugin.yml

#

that will force it to load first

lyric gyro
#

i have this in my plugin.yml depend: [WorldEdit]

signal grove
#

not sure, maybe you have to wait for some event for worldedit to initialize

minor summit
#

can't really say much without seeing the rest of the code

lyric gyro
#

ClipboardFormat format = ClipboardFormats.findByFile(file);
ClipboardReader reader = format.getReader(new FileInputStream(file));
Clipboard clipboard = reader.read();```
that's all the code that uses the worldedit api and the error occurs on the last line
signal grove
#

what method are we in, onEnable()?

wary spindle
#

Wanna see my creative fix?

lyric gyro
wary spindle
#

Will also help folks having the same issue.

dusky harness
#

too many times people accidentally shade the plugin in

wary spindle
#

.add("{target_ping}", String.valueOf(PlayerUtil.getPing(target))) Didn't work for me, and after alot of messing around, I got to this (fully works, btw):
.add("{target_ping}", Integer.toString(PlayerUtil.getPing(target)))

dusky harness
#

¯_(ツ)_/¯

wary spindle
signal grove
#

those two lines should really be doing the same thing

#

im guessing there was another issue somewhere down the line

#

but sure

dusky harness
#

yeah

#

that's what I assume

lyric gyro
dusky harness
#

yes

#

?paste

neat pierBOT
#
FAQ Answer:

Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
HelpChat Paste - How To Use

dusky harness
#

pastes.dev >

wary spindle
lyric gyro
dusky harness
wary spindle
#

@dusky harness Do you agree?

dusky harness
#

no - the purpose of String.valueOf is to have a general all-in-one method to combine other methods like Integer.toString

dusky harness
#

rye what IDE do you use

#

ex eclipse, intellij

#

you might be using whatever build system is inside the IDE instead of maven

lyric gyro
#

intellij

dusky harness
#

because your pom.xml only includes spigot-api

lyric gyro
#

i thought i had the worldedit stuff inside the pom.xml

wary spindle
#

I can give him the worldedit's pom.xml thingy

dusky harness
#

like what buttons do you press

lyric gyro
royal cypress
dusky harness
wary spindle
wary spindle
#

I use github for compiling

grim oasis
dusky harness
#

and you should be getting some errors

lyric gyro
#

added worldedit stuff to pom.xml and it says build success

dusky harness
#

that's how you create (or in maven's terms, package) a jar

dusky harness
#

so that i can make sure

royal cypress
lyric gyro
#

that's funny lmao i guess i've never used apis so i've never noticed

grim oasis
dusky harness
#

🙃

dusky harness
royal cypress
grim oasis
#

Yes, the example is linked

lyric gyro
#

yep haha thumbs thank you so much lmao PepeLove

dusky harness
#

np 😃

signal grove
#

for intellij i use an addon called "Minecraft Development", it basically generates a default plugin for you and sets up the build configuration

royal cypress
grim oasis
#

was edited in 😉

signal grove
#

makes it really easy

dusky harness
#

ah that's probably how you ended up using intellij's tool instead

signal grove
#

ah, you wont need to use build artifacts then, you can just run it (it comes with a default config)

dusky harness
#

since maven's the default ( 🤢 )

signal grove
#

it has a gradle option too

lyric gyro
#

the more you know

signal grove
#

yeah i jst click new "spigot plugin", fill in some details, and then click the big green arrow

#

ez plugins

dusky harness
#

I'm thinking of making a program to create a project (theres someone in another server who uses like a shell script but I don't know scripting enough to do that lol) since minecraft dev is a bit limited and i end up changing all the files anyways

#

but

#

i've been thinking of that for like a year and still haven't done it

#

even though it'd probably save me like 5 min

signal grove
#

im really surprised the tutorials on youtube dont use the Minecraft Development addon

dusky harness
#

yeah

#

well

#

I know one that does

#

I don't remember the name though

#

the one I used to learn didn't use it though

#

it used eclipse 💀

signal grove
#

me too

stuck hearth
#

Just make file templates tbh

lyric gyro
#

and worldedit has to be added to the libraries, right?

spiral prairie
#

nope

#

just maven

signal grove
#

when you compile itll do all that stuff for you

lyric gyro
#

o, so is the worldedit stuff being red fine?

signal grove
#

yeah, after build it should not be red

dusky harness
#

make sure u click the little maven refresh icon

#

it appears whenever you modify pom.xml afaik