#help-development

1 messages ยท Page 57 of 1

tardy delta
#

Uhh idk Stackoverflow it

shadow zinc
tardy delta
#

Most of the time it's all shit

quiet ice
#

I've been using Stackoverflow less often these days

shadow zinc
#

But we still got to respect the legends on stack overflow

shadow zinc
#

But thats mainly due to me learning how to code from stack overflow and other mediums lol

quiet ice
#

You probably need to either do that manually or use a lib

#

I haven't heard of anything within java's stdlib to convert between these representations

#

Actually I have been wrong

bitter bone
#

Can anyone help me with installing buildtools as for some reason its just not working for me

quiet ice
#

Something like

TemporalAccessor accessor = DateTimeFormatter.RFC_1123_DATE_TIME.parse("Mon Sep 12 12:23:07 CEST 2022");
Date.from(Instant.from(accessor));

(you probably need to use another standard there though)

shadow zinc
dry forum
trim surge
#

Is it possible to remove all elements of a Stream except the First and last element?

tardy delta
#

๐Ÿ˜ฉ

quiet ice
#

I.e. multi-module project

dry forum
#

wdym

quiet ice
#

(hence why I generally recommend to prefe grossr hacks over NMS)

dry forum
#

id need a 1.18.2 and a 1.19 one in my compile pom?

quiet ice
#

No four actually

tender shard
#

you need one module, e.g. one pom, per NMS version. And you must never have more than one spigot version per module

bitter bone
# shadow zinc Please elaborate by not working

I'm using the bat method rn and everytime I run the bat I enter the minecraft version(1.17.1) and then enter the java version (16) and it just doesn't do anything after that it makes a folder and inside that folder is just the jar file of buildtools and thats it

quiet ice
#

Or five depending on how you do it

compact cape
bitter bone
dry forum
#

i have a plugin pom, 1.18 pom, 1.19 pom, and api pom

tender shard
bitter bone
shadow zinc
tender shard
quiet ice
#

So a parent POM, a common nms api POM, a 1.18 pom, a 1.19 pom and a base impl pom

bitter bone
shadow zinc
#

I used that when I was using windows and it never failed me

bitter bone
#

Alright I'll try it

trim surge
#

Suppose i have an array

{1, 2, 3, 4, 5}

How can i remove 2, 3, 4 ???

bitter bone
#

Hmm it now just creates a buildtools log saying "Please do not run BuildTools in a Dropbox, OneDrive, or similar. You can always copy the completed jars there later."

shadow zinc
#

?

bitter bone
#

let me try something actually

shadow zinc
#

Just run it directly on your disk/drive

quiet ice
#

You'd need to create a new array that has those objects removed

compact cape
shadow zinc
#

lit

trim surge
# compact cape Do you know how to use `stream`?
    public List<Integer> higherLowest(String string) {
        List<String> listString = Arrays.asList(string.split(" "));
        List<Integer> listInteger = listString
                .stream().map(Integer::parseInt)
                .sorted()
                .collect(Collectors.toList());


        return listInteger;
    }```

Basically i need to enter a String of integers like `"1 3 4 5 2"` and then it needs to return a list of the highest and lowest. `[1,5]`
quiet ice
#

The easiest option would be to do

int[] array = {1, 2, 3, 4, 5};
int count = 0;
for (int x : array) {
    if (x == 2 || x == 3 || x == 4) {
        count++;
    }
}
int[] copy = new int[count];
count = 0;
for (int x : array) {
    if (x == 2 || x == 3 || x == 4) {
        copy[count++] = x;
    }
}
compact cape
trim surge
#

im so dumb

shadow zinc
#

okay

trim surge
#

i was doing List.of and things tryna cry ๐Ÿ˜‚

compact cape
#

no problem...

quiet ice
trim surge
shadow zinc
#

Does configFile.getName() include the yaml file extension?

quiet ice
shadow zinc
compact cape
shadow zinc
#

(that was a joke)

quiet ice
#

You can only make it async if it is like an insanely big string

compact cape
#

They will learn about performance later ๐Ÿ™‚

quiet ice
#

At which point you probably want to do something like radix sort

ornate mantle
#

guys how do i spawn a custom entity at a specific location

#

customentity.setlocation doesnt work

#

method doesnt exist

eternal oxide
#

spawn method takes a Location, unless its an NMS entity then its placed when you add to the world and have called setPos

ornate mantle
#

oh im dumb

ornate mantle
#

does addFreshEntity do the same thing as addEntity

tender shard
#

on what class?

compact cape
#

Thanks for help ๐Ÿคท I had to use a packet to close the inventory too ๐Ÿ˜‚

cosmic fjord
#

https://ibb.co/d4THcKM
Cannot resolve com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT
Cannot resolve net.bytebuddy:byte-buddy:1.12.12
im getting this`errors when trying to add prorocollib to my maven project

sonic sky
#

If I update an ItemStack's ItemMeta through a different instance, will it update?

undone axleBOT
cosmic fjord
sturdy frigate
#

Hey guys, is there a way to make a Specific Block object unbreakable?

    private void makeSafeLanding(Location location) {
        Block block = location.getBlock();
        Block blockBelow = block.getRelative(BlockFace.DOWN);
        Material initialType = blockBelow.getType();
        blockBelow.setType(Material.HAY_BLOCK);
        Bukkit.getScheduler().runTaskLater(Tyrants.getInstance(), () -> {
            blockBelow.setType(initialType);
        }, 2000);
    }```
#

I'm making a safe landing block and I don't want users to break it (either they can't break it or it won't drop an item)

sonic sky
#

Listen for players trying to break it in the BlockBreakEvent

drowsy helm
#

is keeping a collection of chunks mem safe?

sonic sky
#

I doubt it, maybe a reference to chunks?

sturdy frigate
drowsy helm
#

block break event returns a block

#

get teh location and compare

sonic sky
#

BlockBreakEvent#getBlock()

sturdy frigate
#

Oh, well that means I'd have to store this specific block into an array somewhere and then match it?

sonic sky
#

Use a static variable imo

#

If it's one block

sturdy frigate
#

Yeah, it's just one block

sonic sky
#

Static variable

sturdy frigate
#

But I mean players can be spawning these blocks many times, it comes from a random TP command

cosmic fjord
sturdy frigate
#

Okay, does this approach also work if i don't want the block to drop anything?

shadow zinc
#

the version to what is stated on the github repo

sonic sky
shadow zinc
cosmic fjord
sonic sky
#
  1. Get block which is being added to the 'spawn block' list.
  2. If you want these blocks to be kept after reloading/restarting the server it will need to be stored to a file and retrieved on startup.
  3. Listen for players trying to break blocks at the location of any of these spawn blocks.
  4. Cancel the event.
sturdy frigate
quaint mantle
#

how to convert projectile to item?

shadow zinc
#

did you remove your .m2 folder?

cosmic fjord
#

it says Im not able to remove it

#

or Im not allowed

#

wait

shadow zinc
#

close intellij?

#

change permissions on folder

cosmic fjord
#

I deleted it now

shadow zinc
#

sync that bad boy

cosmic fjord
#

nothing changed

#

it works on other maven projects

shadow zinc
#

whats your error again?

quaint mantle
cosmic fjord
#

but not on this one

cosmic fjord
shadow zinc
cosmic fjord
shadow zinc
#

they are very different

#

you might want to make your vice one look like the other one

cosmic fjord
#

should I try if the protocollib dependency works if I remove some other dependencies?

shadow zinc
#

no no no, let me change your existing pom to match the layout of your other one and you try that

cosmic fjord
#

ok

shadow zinc
#

why are you using java 1.8?

quaint mantle
onyx fjord
#

isnt projectile an entity

#

wdym convert

cosmic fjord
quaint mantle
shadow zinc
onyx fjord
#

stick with latest LTS

snow compass
#

is this a bug java.lang.IllegalArgumentException: y out of range (expected 0-256, got -50) on 1.18.1 server?
Is from method getBlockType();.

shadow zinc
#

anyways try this

shadow zinc
#

I only added the xml header and packaging tag

quiet ice
cosmic fjord
#

nothing changed

snow compass
onyx fjord
#

idk

#

update to latest minor ver

snow compass
boreal seal
#

The server you were previuosly on went down, you have been connected to a fallback server" cloud a plugin cause it?

#

or what cause in in first place?

#

since it drops players by parts like 20% each time out of all online players

sturdy frigate
#

How can I detect when a player touches a block with their hand or with whatever, right or left, to change it into a different block type?

grizzled pollen
#

use PlayerInteractEvent

#

check if event clicked block is not null and change it type

drowsy helm
#

Is it possible to clone PersistentDataContainer?

sturdy frigate
tardy delta
#

an sqlite connection should be opened permanently right?

#

just making sure

drowsy helm
#

yep

#

i havent had any issues having it constantly open

tardy delta
#

ah time to edit all my stuff again then

#

i made some utility methods which assume that the connection needs to be closed afterwards smh

drowsy helm
#

should be super hard to fix

#

i mean you can open it each time you wanna send a query

#

just a bit inefficient

tardy delta
#

i wont

#

lemme suffer

drowsy helm
#

lmao

carmine pecan
#

Hey guys! Working on generating loot from entities. Using Lootable and LootContext like this:

Lootable lootable = (Lootable) entity;
LootTable lootTable = lootable.getLootTable();

if (lootTable == null) { return new ArrayList<>(); }
LootContext.Builder contextBuilder = new LootContext.Builder(location).lootedEntity(entity).killer(player);
contextBuilder = contextBuilder.lootingModifier(0);
            
LootContext context = contextBuilder.build();
loot.addAll(lootTable.populateLoot(ThreadLocalRandom.current(), context));

Problem is that if a player is holding an item with the Looting enchantment, this generates more loot. Tried using #lootingMoodifier(0), but it doesn't seem to work. Anyone who can help me disable this enchantment behaviour? Thanks

tardy delta
#

๐Ÿ’€

quaint mantle
#

I'm currently trying to get the console output of spigot, but I can't think of a way. How to get console output?

tardy delta
#

hook into the bukkits logger ig

#

add a consolehandler

tender shard
#

add a custom logging filter

tardy delta
#

smth like this ig

tender shard
#

I'm not sure if that catches ALL logging messages though. E.g. vanilla ones are probably not going through the Bukkit logger

tardy delta
#

mye not sure about those

#

maybe theyre using sysout

tender shard
#

in that case you might need LogManager.getRootLogger()

#

that should catch stuff both from craftbukkit/plugins, and from vanilla logger

#

(but I am not sure)

quaint mantle
#

thanks... but it not capture all of log.. ex) chat, command, etc

supple abyss
#

Does anyone here know how to recenter an armorstand to its original position after constant head rotations ? (it would basically rotate while staying in the same original position)

shadow zinc
#

why is intellij being a bitch?

#

its stuck on Downloading from codemc-snapshots

#

it does this sometimes

#

and it takes 10 minutes to compile

#

when it normally takes 10 seconds

eternal night
#

maybe they finally got slapped for illegally distributing mojang owned software

shadow zinc
#

I'm not aware about the legalities of spigot

eternal night
#

Well, there is a reason why spigot does not offer you a downloadable jar but rather asks you to build spigot locally

shadow zinc
#

slightly sus

sonic sky
#
int count = 0;
for(Block nearby : brokenCrop.detectNearbyCrops(broken.getLocation())){
  count++;
  Material toBreak = nearby.getType();
  nearby.breakNaturally();
  System.out.println(toBreak.name());

  player.getWorld().dropItemNaturally(nearby.getLocation(), new ItemStack(toBreak, HoeAPI.getDropForLevel(brokenCrop, cropLevel)-1));
}

I've tried many approaches and I couldn't be more confused with why this isn't working. I don't see how this approach still throws Caused by: java.lang.IllegalArgumentException: Cannot drop air, the toBreak material literally outputs SUGAR_CANE.

My method for detecting nearby crops removes blocks of Material.AIR in the process.

shadow zinc
#

just check if the material is air first

cold tartan
#

im trying to use recursion to make a vein miner method, but it crashes the server with this:

#

thats the code

eternal oxide
#

Took too long. You are searching too far

sonic sky
#
if (block.getType().equals(Material.AIR)){
  toRemove.add(block);
  continue;
}

Under the detectNearbyCrops() it filters the AIR blocks.

shadow zinc
#

I made a vein miner a while ago, want to see my code?

shadow zinc
#

?paste

undone axleBOT
shadow zinc
eternal night
#

hence why build tools downloads vanilla from mojang themselves

#

and builds spigot locally on top of that

#

all the NMS repos out there just basically shit on that in the hopes mojang does not come after them

cold tartan
sonic sky
#

One of your lambda functions

shadow zinc
#

I guess its because you are iterating over the same blocks

#

My method keeps track of blocks that have been processed and skips them

#

That way we don't get errors or loops

#

yay it compiled after 6 minutes, that 4 minutes less than last time

sonic sky
#

The code still returns the IllegalStateException:

if (toBreak.equals(Material.AIR)) continue;

player.getWorld().dropItemNaturally(nearby.getLocation(), new ItemStack(toBreak,
HoeAPI.getDropForLevel(brokenCrop, cropLevel)-1));
#

I'm so confused

#

toBreak.name() returns SUGAR_CANE

shadow zinc
sonic sky
#

The #dropItemNaturally method

#

Cannot drop air

shadow zinc
#
``` use that as a check
eternal oxide
#

!item.getType().isAir()

sonic sky
#

What, the ItemStack?

shadow zinc
#

the item you are breaking

sonic sky
eternal oxide
#

Theres different types of air

sonic sky
#

Could you elaborate?

tardy delta
#

Material#isAir exists

eternal oxide
#

cave air

shadow zinc
#

nether air is a thing, its called something else tho

#

unless im tripping

sonic sky
#

Sorry, I haven't really programming Spigot since 1.8, I wasn't aware of this ๐Ÿคฃ

eternal oxide
#

it got me too the first time ๐Ÿ™‚

shadow zinc
#

happened to me when I was making a anti mob farm thingo

sonic sky
#

AIR
CAVE_AIR
VOID_AIR

tardy delta
#

well..

sonic sky
#

I know, I'm trying with that

tardy delta
#

elgarl beat me

sonic sky
#

Same error .-.

#

The same happens when I use my Crop interface's #getType which returns the Material of the crop

eternal oxide
#

I've not looked at your code or the error. Is it the server timing out?

sonic sky
#

IllegalStateException

eternal oxide
#

I can't open a browser while in this game

sonic sky
#

It's on the #dropItemsNaturally line

#

Exception message is cannot drop air

shadow zinc
#

what is nearby?

sonic sky
#

nearby is of type Block, I have a function from my Crop interface (variable brokenCrop) which detects surrounding blocks, within this detecting function it skips air which is what confuses me.

#

So each nearby block shouldn't be of type AIR because they simply wouldn't be added to the list

shadow zinc
#

Unless its trying to break it twice?

#

Are any blocks actually being broken?

sonic sky
#

It's sugar cane

< - This block breaks naturally but wouldn't be in the nearby blocks

< - I'm breaking this block

#

I'll debug to see if it's breaking twize

#

The "Breaking" log only printed once

#

I'm bewildered

shadow zinc
#

Can you put your current code in ?paste

#

Everything that is apart of the process of gettings blocks/items to breaking it

worldly ingot
#

Is the quantity of the item 0?

shadow zinc
#

Perhaps you should debug that as well ^

worldly ingot
#

Because ItemStacks with a quantity of zero will be converted to air

shadow zinc
#

Just log everything to get a sense of whats happening in the code

boreal sparrow
#

Hey guys, I have this stupid method to check if the world passed in as an argument is one of the defined worlds in the method, but I can't seem to call it anywhere in my class....? (Might be a really dumb beginner mistake)

public static boolean inWorld(World world){

        //CHECK IF IN RUNNER VS HUNTER TYPE WORLD
        if(world == Bukkit.getWorld("RunnerVsHunterMap1")){
            return true;
        }

        else if (world == Bukkit.getWorld("RunnerVsHunterMap2")){
            return true;
        }

        else if (world == Bukkit.getWorld("RunnerVsHunterMap3")){
            return true;
        }

        else if (world == Bukkit.getWorld("RunnerVsHunterhub")){
            return true;
        }

        else {
            return false;
        }

    }
shadow zinc
#

isn't it .equals?

#

wait

#

no

worldly ingot
#

I mean at that point just compare the name

rough drift
#

better than the for loop 100%

#

/s

quiet ice
#

Sorting is not really multithreaded

shadow zinc
rough drift
#

Also, for those warning about perf, that really isn't an issue

#

a modern cpu can handle that easy

quiet ice
#

Sure it could be if you are using something like radix sort, but the quicksort used by java isn't really that multi-threadable

shadow zinc
sonic sky
#

Thanks to everyone else who helped as well

quiet ice
#

Ignoring performance makes the difference between spigot's 5 minute shutdown time and paper's 3 second one

boreal sparrow
#

true, but why cant i call it in the same class with if(getWorld(player.getWorld()))

rough drift
#

I am saying ignoring perf if it's really small, or the alternative is unreadable/unmaintainable

sonic sky
boreal sparrow
#

i am...

past vapor
#

Is there an event that is called when a block breaks for any reason

sonic sky
#

With just player#getWorld()

#

BlockBreakEvent

past vapor
#

That's only called for players breaking blocks

boreal sparrow
#

if(inWorld(player.getWorld()))

worldly ingot
#

You'd have to listen for individual events. There's no all-encompassing event

shadow zinc
#

explosions, physics and a whole bunch of stuff could help

quiet ice
rough drift
#

though streams are lazily evaluated anyways

sonic sky
boreal sparrow
#

sorry

#

my method is called

#

InWorld

sonic sky
#

Use .equals for the world objects or compare world names

boreal sparrow
#

ok thanks

worldly ingot
#

Just compare the names lol

#

It's easier

quiet ice
shadow zinc
# boreal sparrow ok thanks

I also noticed they have similar names, you could simplify that code by checking if the string contains the generic identifier

rough drift
tardy delta
#

me going wild

rough drift
#
stream()
  .map(Test::new)
  .map(Object::toString)
```It won't run two iirc
worldly ingot
# tardy delta me going wild

You definitely don't have to wrap that in a WeakReference, right? You would want to weak wrap the result of your lazy value

rough drift
worldly ingot
#

The weak reference won't handle types inside of their wrapped instances

tardy delta
#

ye right

boreal sparrow
# sonic sky Use .equals for the world objects or compare world names

I use this


public static boolean inWorld(World world){

        //CHECK IF IN RUNNER VS HUNTER TYPE WORLD
        if(world.equals(Bukkit.getWorld("RunnerVsHunterMap1"))){
            return true;
        }

        else if (world.equals(Bukkit.getWorld("RunnerVsHunterMap2"))){
            return true;
        }

        else if (world.equals(Bukkit.getWorld("RunnerVsHunterMap3"))){
            return true;
        }

        else if (world.equals(Bukkit.getWorld("RunnerVsHunterhub"))){
            return true;
        }

        else {
            return false;
        }

    }

But i cant call this method in my class

quiet ice
#

new WeakRef(new X) is asking for trouble

worldly ingot
#

WeakReference will not hold a reference from being garbage collected. So if it gets collected by the GC, .get() will return null. The LazyValue (which is either something FourteenBrush wrote or from Apache Commons or something) will only initialize the value when it's first called upon

last swift
#

Iโ€™m updating a scoreboard every second, but for some reason the scoreboard stops updating after about a minute or two for some random reason. Iโ€™ve tried 3-4 different wrappers and APIโ€™s and the issue is the exact same. Is this a common issue? If so, is there a way to fix this?

rough drift
tardy delta
#

i was thinking smth was wrong with wrapping that into a weakref yes

rough drift
#

Not from what I remember

quiet ice
#

streams don't magically cache stuff

worldly ingot
quiet ice
#

unless it gets compiled down to a constantDynamic

tardy delta
#

i would put that in front of my name

quiet ice
#

which uhm I highly doubt

boreal sparrow
#

Says it shoud return void or smh

rough drift
tardy delta
#

actually i needed a LazyValue<WeakReference<Player>> lmfao

shadow zinc
rough drift
shadow zinc
#

It is, but a config would be better

#

especially if there are new worlds or name changes

rough drift
#

Fair point

shadow zinc
#

or an internal list in the code, that might be best for him

rough drift
#

However it depends, if there is always a prefix just check for the prefix

shadow zinc
#

Thats good if he keeps with the naming convention, and any other people involved in the development of hypothetical server

#

codemc-snapshots is having another stroke?

#

okay its back

tardy delta
#

sqlite not having a proper upsert command :(

sturdy frigate
#

I'd like to play a custom mp3 ambient music for my spawn and different worlds, what should I use for this?

onyx fjord
sterile token
tardy delta
#

lol

boreal sparrow
zealous osprey
tardy delta
#

weird things which i already changed

grim ice
#

the definition of a mess

tardy delta
#

lazy String hey

boreal sparrow
#

Invalid decleration, or declare abstract

tardy delta
#

rather save the worlds uuids in a set and do ::contains

#

list would work too

compact haven
#
val hey: String by lazy { "Hello World" }

๐Ÿ˜

tardy delta
#

val lazy fourteen: Fourteen = Fourteen::new()

compact haven
#

kotlin delegates OP, sorry to you kotlin haters

opal juniper
#

ive got a list of locations, whats the best way to make an entity just walk between them

grim ice
#

ah so like

#

u have a few boxes

#

u want the player to be able to only walk in them

#

not anywhere outside those

#

right

flint coyote
#

Oh I understood that totally different. I thought he wanted an npc (or mob) to travel from one location to the next one and repeat once at the end

opal juniper
#

well i mean its just like:

#

the distance between locations can be assumed to be no more than 1 block

rough drift
#

you don't insult scala

drowsy helm
#

I made a system 2 days ago that plots points x distance between two points

#

If you beed that

eternal night
drowsy helm
#

Or are you saying you need the pathfinder goal for it

dry forum
#

ServerLevel s = ((ServerLevel)loc.getWorld()); java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R2.CraftWorld cannot be cast to class net.minecraft.server.level.WorldServer (org.bukkit.craftbukkit.v1_18_R2.CraftWorld and net.minecraft.server.level.WorldServer are in unnamed module of loader java.net.URLClassLoader @7aec35a) how would i do this? someone earlier told me to cast to serverlevel (Im trying to get a world using nms 1.18.2

opal juniper
#

lol

eternal night
#

((CraftWorld)world).getHandle()

#

ye ye sorry xD I mean pathfinder still seems the easiest ?

#

a bit of NMS here and there just makes the plugin more spicy

opal juniper
#

i dont really need it to do any pathfinding though, i just need it to walk right there

drowsy helm
#

Lerp the position each tick

#

If itโ€™s linear

opal juniper
#

i could, but dont entities like move at different speeds? i forget

#

or is that a speed you can access

drowsy helm
#

Just use a speed equation

#

Keep in mind that doesnt account for jumping

#

Parhfinding is your best option as you dont have to handle jumping

sturdy frigate
#

How can I make the pathfinder of a zombie only attack certain zombies? (i want to make two teams and have them fight each other)

tardy delta
#

im fucking up my entire shit

#

might even leave the datasource away but then i need a unaryoperator as parameter in a constructor :/

#

kinda weird

dry forum
#

how can i create a packet entity that everyone can see

spare sky
#

Hello, does anyone know which packet works on %server_online%

river oracle
river oracle
dry forum
river oracle
#

Send it to the joined player after they join

earnest forum
#

or update with a runnable

#

nvm

spare sky
#

I make vanish plugin

river oracle
#

? Idk how to send scoreboard packets

tardy delta
#

๐Ÿ’€

river oracle
#

What is a sneaky throw lol

worldly ingot
#

It's essentially a way of throwing an exception without explicitly declaring that you throw an exception in the method declaration

tardy delta
#

i should be using lombok

#

but i refuse ๐Ÿ’€

worldly ingot
#

Sneaky throws are very ugly and hacky

worldly ingot
#

Though it's a way to allow callers to not be forced to create a try/catch

tardy delta
#

i'm catching every exception and then rethrowing it ah yes

river oracle
#

It's horrendous

worldly ingot
#

I mean checked exceptions are kind of gross to begin with

tardy delta
#

the rusts way of exception handling is cleaner in my opinion

#

by returning a Result<T, E> where T is the value you want and E the optional exception

worldly ingot
#

I mean that's basically a CompletableFuture lol

zealous osprey
#

Fourteen, you good? You've been typing for the past 2 minutes

tardy delta
#

theres a ton of fun stuff

let a :Result<char, smth::Error> = some_method();
println!(a.unwrap()); // prints the char or throws some ugly error which we cannot catch
println!(a.expect("we did not get the char :(")); //prints the char or throw an error with the message :/

#

smh

#

too long ago since i did rust

dry forum
#

im getting a circular dependency warning but i kind of dont have a choice i have a multi module project with each version 1.18.2, 1.19 etc and ofc the plugin itself needs these versions as a dependency and the version modules need the plugin dependency to get instance of the main plugin so what should i do

tardy delta
#

theres a map function which is like CompletableFuture::thenAccept

#
some_database_result().map(|loaded_player| loaded_player.login());```
#

theres some or_else thing too

#

but lemme shut up now

crimson scarab
#
    @EventHandler
    public void onSnowballThrow(ProjectileLaunchEvent event) {
        if (event.getEntity() instanceof Snowball) {
            ProtocolManager pm = ProtocolLibrary.getProtocolManager();
            final PacketContainer destroyEntity = pm.createPacket(PacketType.Play.Server.ENTITY_DESTROY);
            final int[] ids = {event.getEntity().getEntityId()};
            destroyEntity.getIntegerArrays().write(0, ids);

            Bukkit.getOnlinePlayers().forEach(online->{
                try {
                    pm.sendServerPacket(online, destroyEntity);
                } catch (InvocationTargetException e) {
                    throw new RuntimeException(e);
                }
            });
        }
    }
#

what is incorrect here

#

i get the FieldAcessException error

eternal oxide
#

why are you trying to fake destroy all snowballs when launched?

#

You are also doing it too early. The launch event fires before any clients have been notified of the entity

crimson scarab
#

so i can mount entites to it

quaint mantle
#

Hi, im trying to convert array of materials - Material[] to array of ItemStack[]. I have no idea how to do it. Can anyone help me?

crimson scarab
#

and they can move in various ways

tardy delta
#

Arrays.stream(materialList).map(ItemStack::new).toArray(ItemStack[]::new)

eternal oxide
#

Thats the correct event, if thats what you want to do, but you have to delay it all by a tick or so

tardy delta
#

or for loop

eternal oxide
#

the snowball will not exist on teh clients until that event finishes

#

so sending a destroy packet for an entity they know nothing about will do nothing

quaint mantle
eternal oxide
#

I can;t comment onm your use of Protocolwhatsit

crimson scarab
#

or is that one of many

eternal oxide
#

one of many

lost knoll
#

So I have a simple InventoryClickEvent that is cancelled when a player clicks on a specific item while having another on the cursor. Everything works fine, but when I cancel it, it just duplicates the clicked item. (Deleting the item on the cursor)Am I using the wrong event for this or it's just not possible to cancel in this event?

crimson scarab
#

do you know if protocol lib has a discord server

#

i feel like i may not be able to get support here and i would be wasting time

arctic moth
#

how would i get info about a player that's not online?

#

for example, get uuid from name

desert frigate
#
Block clicked = e.getClickedBlock();
            if (clicked.getType().equals(Material.CHEST)) {
                TileState chestState = (TileState) clicked;``` why does this error happen when i already check if it s a chest?
arctic moth
opal juniper
#

can i remove a zombies AI

arctic moth
#

nvm

opal juniper
#

just make it stand there

arctic moth
crimson scarab
arctic moth
#

oh thx

crimson scarab
#

that requires uuid

arctic moth
#

will that get them even if they are online?

#

:(

eternal oxide
desert frigate
ancient plank
#

?jd-s

undone axleBOT
lost knoll
opal juniper
desert frigate
# desert frigate same error
Block clicked = e.getClickedBlock();
            if (clicked.getType().equals(Material.CHEST) && clicked != null) {
                TileState chestState = (TileState) clicked;```
tardy delta
#

how can i access a protected field here lol, this class just has a persistencehandler field

arctic moth
opal juniper
#

oh wait i can cast it to living entity right?

arctic moth
#

like (TileState) clicked.getState();

crimson scarab
ancient plank
arctic moth
desert frigate
crimson scarab
arctic moth
tardy delta
#

aah what

desert frigate
tardy delta
#

didnt know it just exposes protected fields to the package

arctic moth
#

lol

opal juniper
#

well, its quite unlikely

eternal oxide
#

UUIDfromString is expecting the UUID in a very specific string format

arctic moth
#

yep

eternal oxide
#

You either Bukkit.getOfflinePlayer(name) and risk a Mojang lookup, or you loop over Bukkit.getOfflinePlayers()

crimson scarab
#

EgarlL should I switch to NMS instead of protocol lib?

eternal oxide
#

that depends on how much you are willing to put into maintaining yoru plugin

tardy delta
#

both kinda suck lol

eternal oxide
#

even with remap

ancient plank
#

I enjoy making plugins and never touching them ever again except for bug fixes

eternal oxide
#

same here

crimson scarab
#

Its just a fun lil thing that is not for anyone else but me

eternal oxide
#

but I also like messing with nms

#

then I'd recommend using nms packets over protocol lib

#

using Mojang mappings makes packets so simple now

#

but version specific

ancient plank
#

Ngl the only instances where I've needed nms was for pathfinding (then I discovered paper has an API for it)

eternal oxide
#

yeah, spigot needs some logic API

ancient plank
#

time to pr

eternal oxide
#

I've no time, but I'd never get a PR accepted. Too many typos ๐Ÿ˜ฆ

ancient plank
#

๐Ÿ˜” I don't have the knowhow to do a pr

vocal cloud
#

I want to PR @since onto everything but I'll need to ask hashman first

drowsy helm
#

Big job

tardy delta
#

hmm i love it, something is closing my db connection while it shouldnt

eternal oxide
#

a "try with" I'd expect

tardy delta
#

hmm looks cursed

#

mye i guess a try with resources which i forgot

cedar yoke
#

is there a way to get the entity a player is looking at ?

tender shard
#

you can use World#rayTrace()#getHitEntity()

#

in fact I currently have code open that lets you spawn an explosion at an entity you're looking at when interacting at it from far away

tardy delta
#

i should try to avoid all try catch blocks in my impl classes ๐Ÿค”

eternal oxide
#

depends

#

I'd do an interface, then an implementation depending on the type

#

you could SQLite as a base (with no try with) then extend that and override or wrap methods for SQL

desert frigate
#
chestState.getPersistentDataContainer().set(new NamespacedKey(plugin, "ATTACHED_MINION"), PersistentDataType.STRING, stand.getUniqueId().toString());

System.out.println(persistentChestData.get(new NamespacedKey(plugin, "ATTACHED_MINION"), PersistentDataType.STRING));```
#

any idea why this give null

eternal oxide
#

you are using a BlockState and I bet you are not pushing teh changes back to the Block

#

chestState().update()

desert frigate
eternal oxide
#

all BlockStates are snapshots

desert frigate
#

do i have to do that for remove too?

#

oh

tardy delta
#

i think i fixed it but im not really happy bout this class

worldly ingot
#

I also don't like that class. It's the reason most people just use HikariCP

tardy delta
#

i really cant with sqlite

#

i have dif db implementations which make it a pain

worldly ingot
#

Ah, SQLite. Gotcha

#

Well even still, a lazy connection really isn't all that worth it ๐Ÿ˜…

desert frigate
#
 if(chest.getType().equals(Material.CHEST)) {
((Chest) chest).getInventory();``` cannot cast to Chest even though i already checked if block is chest
worldly ingot
#

Just get a connection and try-with-resources it

tardy delta
#

its to leave my connection opened :/

worldly ingot
#

No, close it when you're done with it

cedar yoke
worldly ingot
#

block.getState()

tardy delta
#

ah hmm some people say that i should leave it opened and you dont :/

worldly ingot
#

There's no reason to leave a connection to a database open

#

Again, connection pools do keep them open but they close them after (by default) 60 seconds of no use

tardy delta
#

i'm not using hikari so creating a new connection could be quiet heavy no?

worldly ingot
#

It depends entirely on how frequently you intend on sending/receiving data from your database I suppose

tardy delta
#

hmm not that often

#

more like loading players

worldly ingot
#

For what it's worth, HikariCP does support SQLite iirc

tardy delta
#

ye

worldly ingot
#

but yeah it's really not all that terrible. Just perform your SQL asynchronously and you'll be fine

tardy delta
#

sure lmao

crimson scarab
#
    
@EventHandler
    public void onSnowballThrow(ProjectileLaunchEvent event) {
        if (event.getEntity() instanceof Snowball && event.getEntity() instanceof Player) {
            Player player = (Player) event.getEntity();

            ((CraftPlayer) player).getHandle().b.a(new PacketPlayOutEntityDestroy(event.getEntity().getEntityId()));
        }
    }
#

there is no error

#

but nothing happens

eternal oxide
#

entity is both a snowabll AND a player?

crimson scarab
#

omfg

#

i meant to get shooter

#

fixed it now lol

#

aight

reef lagoon
#

channel=KodySimpso

balmy valve
#

anyone know if giving an Allay an item is the PlayerInteractEntityEvent

reef lagoon
#

Is it possible to do nbt without nms

sage dragon
#

Is there a method provided by Bukkit which lets me see how much food an item restores?

#

Or do I need to compile a list myself?

echo basalt
sage dragon
#

Okay, thanks

echo basalt
reef lagoon
#

Oh right I forgot about PDC

#

ty

tender shard
#

should get getNutrition()

#

btw wtf is isFastFood() for lmao

#

DRIED_KELP is fastfood, but nothing else, as it seems

sage dragon
tardy delta
#

villages having their own mcdonalds?

tender shard
#

there is no non-nms way I think

echo basalt
#

no there is not :)

#

you can just compile your own nms list from sources with a basic plugin

tender shard
#

interesting. a whole tropical fish has only half the nutrition of a single berry

echo basalt
#

so gapples and stuff

tender shard
#

yeah

sage dragon
tender shard
#

always eat is:

  • chorus fruit
  • enc gapple
  • gapple
  • sus stew
tender shard
#

i'd imagine in normal life you need longer to chew some DRIED kelp than you'd need for the same amount of juicy beef lol

echo basalt
#

what about soup

#

just chug it

sage dragon
echo basalt
#

no

#

it's all constant

tardy delta
#

stew very sus

tender shard
echo basalt
#

one funny thing that I hate about minecraft's food system

#

is that the food sound is sent every 3-4 ticks

#

because it's just a single bite

sage dragon
#

Sent it twice.

It might send it another time ๐Ÿคท

tardy delta
#

whole game lagging

tender shard
#

seems like NMS code never checks the isFastFood method

#

what's FastBoard line 357?

tardy delta
#

vanished

river oracle
#

Not memorized

tawdry python
#

A creeper blew up a block, is there a way to know who placed the creeper and blew up the block?

ornate patio
#

itโ€™s twice as fast compared to any other food

sage dragon
#

Oh, okay

sterile token
echo basalt
#

maybe

fiery prairie
#

is there a good api for discord integration with bots/webhooks?

waxen plinth
#

d4j, jda

ancient plank
waxen plinth
#

I've never had seaweed on its own

#

How are you supposed to eat it

#

I've only had it as part of sushi

ancient plank
#

If it's the dried salted seaweed u bite a bit, then it undries in ur mouth and u swallow gg

#

If u chew it too much it becomes a wet squishy rug

river oracle
#

Only had seaweed with sushi as well

#

Didn't know anyone just ate it alone

ancient plank
#

It's a decent snack

river oracle
#

Bruh what

fiery prairie
solid cargo
#

Seaweed โ€œcrispedโ€ above gas stove is SUPREME. dont burn ur fingers tho

river oracle
#

Nah

solid cargo
#

Have you tried it?

river oracle
#

No

solid cargo
#

Try it then

river oracle
#

I don't eat plants I'm not a beta loser

#

I only eat red meat

#

My diet is 100% red meat

#

Because im a based alpha male

solid cargo
#

Beef>>>

#

Pork is mid

rapid aspen
#

i want to do /gm 0 and my gamemode turns to survival and /gm 1, 2, 3

@Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player p) {
            if (args.length != 1) {
                p.sendMessage(ChatColor.RED + "Tu precisas de especificar um argumento.");
                return true;
            }
            if (args[0] == "0") {
                p.setGameMode(GameMode.SURVIVAL);
                p.sendMessage(ChatColor.GREEN + "Modo de jogo mudado para Subrevivรชncia.");
                return true;
            }
            if (args[0] == "1") {
                p.setGameMode(GameMode.CREATIVE);
                p.sendMessage(ChatColor.GREEN + "Modo de jogo mudado para Criativo.");
                return true;
            }
            if (args[0] == "2") {
                p.setGameMode(GameMode.SPECTATOR);
                p.sendMessage(ChatColor.GREEN + "Modo de jogo mudado para Espectador.");
                return true;
            }
            if (args[0] == "3") {
                p.setGameMode(GameMode.ADVENTURE);
                p.sendMessage(ChatColor.GREEN + "Modo de jogo mudado para Aventura.");
                return true;
            }
        } else {
            System.out.println("Tu precisas de ser um jogador para executar este comando.");
        }
        return true;
    }```
#

is this good?

echo basalt
#

You can negate the first statement

#

and also reuse args[0]

#

and use better naming like player instead of p

rapid aspen
#

ok

rapid aspen
hazy igloo
rapid aspen
hazy igloo
#

Yeah

rapid aspen
#

ok

#

@echo basalt

#

how do i reuse args[0]

rough drift
#
DateTimeFormatter
    .ofPattern("HH:mm:ss.SSSS", Locale.ROOT)
    .withResolverStyle(ResolverStyle.LENIENT)
    .parse("48:00:00.0000", TemporalQueries.localTime());

Why doesn't this parse correctly? It just returns 0 for MILLI_OF_DAY (which is the correct value to get)

rough drift
rapid aspen
#

ok

#

thx

balmy valve
#

Anyone know how to fix the visual bug of giving an Allay an Item?
If I cancel the Event which is PlayerInteractEntityEvent the player will keep the item
But the item will still appear in the allays and, and if the player takes the item they dont actually get the item back
Its a visual bug but an annoying one and I don't know how to go about fixing it

crimson scarab
#

Optional<Entity> optionalEntity = nearbyEntities.stream()
.filter(entity -> entity instanceof LivingEntity && ((Projectile) arrow).getShooter() != entity)
.min(Comparator.comparing(entity -> entity.getLocation().distanceSquared(entity.getLocation())));

#

how can i add another factor to .min

#

i would like to also compare against how much health the entity has

echo basalt
#

well

#

which one comes first

#

health or distance

#

you'd need to make a comparator that checks for both

crimson scarab
#

equally as important

echo basalt
#

or basically you gotta make a graph that maps health-distance to a point factor

crimson scarab
#

i could multiply distance by health

#

would that do it

echo basalt
#

could do it

#

yeah

worldly ingot
#

?jira

undone axleBOT
worldly ingot
#

Attach a plugin we can use to replicate the issue, but it's definitely a fixable bug in CraftBukkit

boreal seal
#

what would be the best storage method for data?

iron glade
#

Could simply use a switch statement

#

And save args[0] and this "preString" of your messages into variables

echo basalt
#

preString is not the best naming

#

even naming it as "argument" is better honestly

carmine pecan
#

Loot context

iron glade
#
String howAreYallDoingToday = "Modo de jogo mudado para ";```
echo basalt
#

that's cool but I remember a guy naming his variables "yipee" and "asdasd"

iron glade
#

Well, I don't even know why someone would do that

echo basalt
#

this dud

iron glade
#

xd

sturdy frigate
#

How can I spawn in prebuilt-structures into the world?

echo basalt
#

depends on what you mean by prebuilt-structures

sturdy frigate
#

Just builds I've made

echo basalt
#

just use worldedit's api

sturdy frigate
#

will check that out thanks

chrome pewter
#

Hi is there a way to give all entity's and effect when left click on item

#

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;

public class m1ttenEvents implements Listener {
    @EventHandler
    public static void onLEFTCLICK(PlayerInteractEvent event){
        if(event.getAction() == Action.LEFT_CLICK_AIR){
            if (event.getItem() != null){

                if (event.getItem().getItemMeta().equals(ItemManager.wand.getItemMeta())){
                    Player player = event.getPlayer();


                }
            }
        }
    }

}
echo basalt
#

oh god

chrome pewter
#

this dosent work for some reason

#

LivingEntity livingEntity = (LivingEntity) entity;

boreal seal
#

what this thing

#

should do

echo basalt
#

This reminds me of that one hypixel interview that just said "spot all the wrong things in this class"

boreal seal
#

why static

#

good one Imillusion

echo basalt
#

but they didn't stoop this low

#

sure they did web requests on a PlayerMoveEvent listener but they were actually listening to events lmao

boreal seal
#

m1tten did you learn java before trying to code minecraft plugins?

#

since like i would like to help you but it seems like the real problem here not gonna solve spoon feeding

chrome pewter
boreal seal
#

not gonna change the case

#

so

echo basalt
#

Look into design patterns and beginner mistakes

boreal seal
#

where is your constractor to main class?

#

if(event.getAction() == Action.LEFT_CLICK_AIR){?

#

why player cannot do magic trick on other block?

#

i dont think you learned java please dont tell us wrong information

#

ImIllusion you know i own a big network and there an fan player that always sent me those kind of codes

chrome pewter
boreal seal
#

dont be sorry its ok

echo basalt
#

I might reapply at hypixel next summer

boreal seal
#
public void interactPlayer(PlayerInteractEvent event) {
} 

if(event.getAction == Action.RIGHT_CLICK_AIR) {
player.setHealth(0.5)

ArrayList<String> list = new ArrayList<String>

add.Mob(Zombie);
add.Mob(Skeleton;

public enum class
playerinteractevent;
playerheldevent;
blockplaceevent;

}
#

like

#

this is the samething for me

#

i tell him that this is illegal and he will go to prison

#
  • his computer will explode if he try to run it
glossy lily
#

how do you convert a regular world into this format

boreal seal
#

where is your constractor to main class?

glossy lily
#

regular world looks like this

echo basalt
#

well

boreal seal
#

oh sorry

echo basalt
#

you just delete most of the folders

#

ยฏ_(ใƒ„)_/ยฏ

glossy lily
#

thats what i was thinking

glossy lily
#

alright will try

echo basalt
#

only the region and entities folder

#

are relevant honestly

#

region contains all the tiles and chunk data

#

entities stores the entities

boreal seal
#

playerdata is needed as well

echo basalt
#

playerdata is fun if you want stuff like inventory

#

but in my case I just have my datasync plugin handle it

boreal seal
#

like someone posted here his code

#

and like we didnt want to be rude but he didnt try to even learn java

echo basalt
#

also playerdata is usually only stored in the first world folder

#

so that inventories persist across deleted worlds

boreal seal
#

btw guys i have something really wierd to tell you

brave goblet
#

is it possible to exclude DataPacks from worlds? while on this topic ๐Ÿค”

boreal seal
#

but i know an african guy

#

that codes without IDE

#

but editng files from his mobile

brave goblet
#

Oh

boreal seal
#

so @chrome pewter dont lose motivation

brave goblet
#

i thought u were gonna say me for a second

echo basalt
#

that's how my programming teachers learned to code, according to them

boreal seal
#

i have a friend who uses his cellphone to code and play minecraft

iron glade
boreal seal
#

mc plugins?

#

fr?

boreal seal
#

so he turned his android into linux or something not sure

iron glade
#

No i was just joking hahaha

boreal seal
#

i was serious about it lol

#

imaging coding with IDE

iron glade
#

but like for everything you can do, there's a 4 yrs old chinese who can do it too

boreal seal
#

yeah

#

they win every math competition

#

lololol

brave goblet
iron glade
#

seen a meme recently

boreal seal
#

lol

iron glade
#

where the US Math team beat china for the first time in 40 yrs

brave goblet
#

exactly

boreal seal
iron glade
#

and they were all chinese in the US team xd

boreal seal
#

๐Ÿ’€

#

i know

#

lmao

brave goblet
#

i wonder tho

echo basalt
#

I mean it's possible

boreal seal
brave goblet
#

how would project structure work?

boreal seal
#

till it worked

echo basalt
#

my classmates found it weird when I was opening up a hex viewer to debug my code ๐Ÿ’€

iron glade
boreal seal
#

RaiderRoss1 i really dont know but i have seen he uploaded a pluin

#

plugin i decompile it

#

and asked him how

#

he told me he made it in his mobile

brave goblet
#

Wow

boreal seal
#

3kb's tho

echo basalt
#

I mean there are java ides

glossy lily
iron glade
#

Give this man an IDE and he codes minecraft 2

brave goblet
#

also btw u can call me Raider/Ross or jusy ping me idm

boreal seal
#

for android?

echo basalt
#

ye

iron glade
brave goblet
#

what?

#

wow

boreal seal
#

i didnt know it too

#

but i can imagine how bad is coding on small screen

#

with mobile keyboard

#

๐Ÿ˜ข

brave goblet
#

Yeeee

dense laurel
#

can someone help me? I'm trying to make a plugin that shows FirstJoinMessage only to players that have a staff rank (or simpler, to players that have permission)

iron glade
#

imagine debugging your code

glossy lily
iron glade
#

and you made a simple mistake or your keyboard fucked up somehow

brave goblet
#

how do they have the staff rank if it's their first time joining?

glossy lily
#

i wonder do plugins on bedrock exist

brave goblet
#

nvm console exists

iron glade
dense laurel
iron glade
#

Have a look at the hive server

brave goblet
echo basalt
#

evan talking about that guy makes me feel sad for all the expensive shit I bought for coding

iron glade
#

bedrock exclusive

glossy lily
#

just looked it up

#

no plugins

iron glade
#

How the hive doing it then

brave goblet
#

i can't read my bad

glossy lily
brave goblet
#

ye i got no idea sorry

glossy lily
#

aswell as im pretty sure bedrock supports datapacks

boreal seal
#

im pretty sure

#

it was made without any IDE

#

tbh

glossy lily
#

and command blocks are a thing

echo basalt
#

you can code a bedrock server with java

glossy lily
#

yea

echo basalt
#

just takes a lot of networking

dense laurel
#

its ok, maybe there's someone that can help me

boreal seal
#

like he put main at the end

#

when IDE will put it first

iron glade
#

I also always put main at the end

#

manually

glossy lily
#

i should try to make a server jar that can handle atleast 1 bedrock player and 1 java player from the ground up

#

that would be hell though

boreal seal
#

what i never put it anywhere i dont even touch plugin.yml only when i add commands and shit

echo basalt
#

I think it got discontinued in order for geyser to work

glossy lily
#

from the ground up completely

echo basalt
#

geyser has a standalone option

glossy lily
#

like handle every preexisting minecraft packet

#

and detect whether a player is on bedrock or java

echo basalt
#

yeah that's geyser standalone

glossy lily
#

cool

#

i wonder if anyone has written 1.0 and 1.19 crossplay

frosty tinsel
glossy lily
quaint mantle
#

yo lads. hope you're all having a good day. if i wanted to format a message from config using hex colour codes and also add a clickevent, how would i do that? using the component api i havent been able to get hex to behave well. thanks in advance!

#

i tried using TextComponent.fromLegacyText but the message formats weirdly and &r doesn't work

#

        String string = txt;

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            string = PlaceholderAPI.setPlaceholders(target, string);
        }

        Pattern pattern = Pattern.compile("&#[a-fA-F0-9]{6}");
        for (Matcher matcher = pattern.matcher(string); matcher.find(); matcher = pattern.matcher(string)) {
            String color = string.substring(matcher.start(), matcher.end());
            string = string.replace(color, net.md_5.bungee.api.ChatColor.of(color.substring(1)) + ""); // You're missing this replacing
        }
        string = ChatColor.translateAlternateColorCodes('&', string); // Translates any & codes too
        return string;
    }```
this is my format method

this is the source text: "&#D39FF0&l>&r &#A39E7CJoin our discord! &r&#F0E6AA&o(click here)"

the output is correct but the entire message is bold - &r doesn't work.

```ComponentBuilder test = new ComponentBuilder().append(TextComponent.fromLegacyText(ColorUtils.format(string, p)));
                for(BaseComponent c : test.getParts()) {
                    c.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));
                }
                p.spigot().sendMessage(test.create());```
#

any ideas?

rough drift
#

you should run the translateAlternateColorCodes before

#

as TextComponent uses the translated &

#

so it uses ยง

#

if you translate after then it won't work

quaint mantle
#

i mean my format method has worked everywhere else so im not sure?

rough drift
quaint mantle
#

string = ChatColor.translateAlternateColorCodes('&', string); // Translates any & codes too and it does translate it

rough drift
#

try from the start

quaint mantle
#

ok give me a minute

#

brb

boreal seal
#

Is Json is good file storage ?

rough drift
#

no

boreal seal
#

I mean good for storing data ?

rough drift
#

It uses a lot of space

boreal seal
#

What would be good ?

#

Not matter space or cache usage on load โ€ฆ

#

Yml are bad

quaint mantle
#

@rough drift i changed it but its the same message

boreal seal
#

Data loss , config file ๐Ÿ˜ญ

quaint mantle
#

        String string = txt;

        if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
            string = PlaceholderAPI.setPlaceholders(target, string);
        }
        string = ChatColor.translateAlternateColorCodes('&', string); // Translates any & codes too

        Pattern pattern = Pattern.compile("&#[a-fA-F0-9]{6}");
        for (Matcher matcher = pattern.matcher(string); matcher.find(); matcher = pattern.matcher(string)) {
            String color = string.substring(matcher.start(), matcher.end());
            string = string.replace(color, net.md_5.bungee.api.ChatColor.of(color.substring(1)) + ""); // You're missing this replacing
        }
        return string;
    }```
rough drift
#

you'd rather want a byte array output stream, or a data output stream (less recommended, I suggest just using a dop to baos then write the content's of baos at once for extra speed if you really need dop)

quaint mantle
#

its still bold and doesnt &r

rough drift
rough drift
#

the pattern is still old there

#

you're doing &# in the pattern

#

rather than ยง#

quaint mantle
#

the issue isn't the format method fam, its the other part

#

the format method has worked fine for ages

rough drift
#

aaaaaaah

#

what's not working about that

quaint mantle
#
                for(BaseComponent c : test.getParts()) {
                    c.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));
                }
                p.spigot().sendMessage(test.create());```
#

&r works in all other places

#

but just not with components

rough drift
#

oh I see

quaint mantle
#

yeah idk ๐Ÿ˜ฆ

rough drift
#

Basically

#

just try doing

#
BaseComponent[] components = TextComponent.fromLegacyText(ColorUtils.format(string, p));

for(BaseComponent component : components)
  component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));

p.spigot().sendMessage(components);
#

If that does not work

quaint mantle
#

na it doesnt

rough drift
#
TextComponent comp = new TextComponent();
BaseComponent[] components = TextComponent.fromLegacyText(ColorUtils.format(string, p));

for(BaseComponent component : components) {
  component.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, link));
  comp.addExtra(component);
}

p.spigot().sendMessage(comp);
#

nope

quaint mantle
#

ike ill try both

#

brb

#

changing it to an array of components works. it actually makes sense because componentbuilder probably treats each component separately meaning the &r wouldnt affect other components. whereas an array would treat them collectively

#

thanks

#

๐Ÿ˜„

rough drift
#

np

#

the builder does make each separate, the array is just bunched together and sent as one, rather than being split

quaint mantle
#

kk

#

where do you learn that?

#

i couldnt find docs lol

rough drift
#

mostly deduction

#

As it does make sense

quaint mantle
#

i dont understand why componentbuilder doesnt work vs array tbh

#

haha

rough drift
#

I just think it adds an &r at the end

quaint mantle
#

i mean maybe

#

my brain

rough drift
#

to make the components not affect eachother

#

(removing the possibility for mistakes when using a builder)

quaint mantle
#

that would make sense but i tried a different string where the &r didnt have a space before the next elements and it still outputted bold text

#

either way: note to self: use basecomponent arrays rather than builders

#

๐Ÿคฃ

rough drift
#

to make the components not affect eachother

#

discord

#

are you ok

#

I sent that message 5 minutes ago

quaint mantle
#

xDDD

#

toaster internet???

rough drift
#

nah, sometimes it dies

rough drift
#

but then discord resent it

quaint mantle
#

haha fair

wise mesa
#

what's the best way to do tab completions

#

ok so like for example

rough drift
#

Either brigadier or strings

lunar zealot
#

could someone make plugin for me that Server gives 1 mystery player a bounty to kill someone else and if they kill their bounty they get 1 heart, but if they don't kill them for 24h if they are on the server and die to their bounty the mystery player loses a heart

wise mesa
#

ill use brigadier

rough drift
#

aaaaaaaaaaaa

#

?services

undone axleBOT
wise mesa
#

does brigadier have target selector support?

lunar zealot
#

ok

lunar zealot
#

yes

rough drift
wise mesa
#

so yes

rough drift
#

yeah

#

anything vanilla commands do brigadier can

quaint mantle
#

what is brigadier

rough drift
#

Minecraft's own command library

#

(Made by Mojang themselves)

#

It's extremely verbose and kind of a pain to work with

#

but it allows you to do so many things

#

it's insane

#

Hell it allows for auto completions ON THE CLIENT

sturdy frigate
#

Is there a form of fog mod in spigot? I'm trying to build a sandy map with light sandy/dusty weather

rough drift
#

not reall

#

really

#

that requires some client stuff

sturdy frigate
#

Aww, so there's no way?

rough drift
#

nope

#

yeah

sturdy frigate
#

RIP okay

rough drift
#

You can however make a sort of blood moon if you want that

sturdy frigate
#

oo what's that?

rough drift
#

The sky turns red
The rain turns red
Water turns red etc

#

requires a lot of tinkering

#

but it is possible

#

Normally a huge wave of enemies appear when this happens

sturdy frigate
#

Ah, is this part of minecraft?

rough drift
#

not really, it's some old obscure forgotten things

#

but it does exist in the protocol

crimson scarab
#

is there a way to make sure there are no blocks between two entites

sturdy frigate
#

How does one achieve that?

desert frigate
#

I'm getting Asynchronous chunk getEntities error. Why is that?

rough drift
#

sorta like that

rough drift
#

as mc is signle threaded

rough drift
#

namely one to change the biome color, and one to change the weather state