#help-development

1 messages Β· Page 1106 of 1

summer scroll
#

If the client crashes, it doesn't matter, the server has the data.

wraith delta
#

but, you say on join add the player to a hashmap and load their key count from file to that map, then on leave write it to yaml and save?

wraith delta
#

because saving the file each time a player clicks the crate would be bad?

#

whichever is faster. because sometimes 10 ppl will be opening crates at the same time

#

sometimes 20 ppl earn a key at the same time

summer scroll
#

I think it's mainly because of performance issues.

wraith delta
#

which is why im not doing auto save timer

summer scroll
#

It's better than to modify the file everytime the key count changes.

wraith delta
#

sounds fair

mellow edge
#

I mean even mojang itself uses saving every 5 minutes.

wraith delta
wraith delta
#

but ig i could store all of the joins into a map, and eventually when the server stops then save it to the yaml

summer scroll
summer scroll
wraith delta
#

Hm. fair idea thanks

#

and so if say 300 players were in a hashmap, it wouldnt be bad? to write each of those uuid -> key values into the yaml

#

sorry for the extensive questions, just want to make sure before I complete it

earnest girder
#

if I'm having a player shoot snowballs and I want each snowball to shoot a bit to the left of where the player is looking, how would I do that?

#

is there a vector method?

#

vectors use x, y, and z so if I just add a vector it wont depend on where the player is looking

#
        float yaw = player.getLocation().getYaw();
        double D = 1.0;
        double x = -D * Math.sin(yaw * Math.PI / 180);
        double z = D * Math.cos(yaw * Math.PI / 180);

        Projectile snowball = player.launchProjectile(Snowball.class, player.getLocation().add(x, 1.25, z).getDirection().normalize());

        snowball.setShooter(player);

        Vector dir = player.getLocation().getDirection().multiply(4);

        Vector recoil = new Vector(-10, 0, 0);

        dir.add(recoil);

        snowball.setVelocity(dir);

this is my current code and it only works when the player is looking a specific direction

wraith dragon
#

Good day, I am trying to figure out how to make a system in which I can store millions of blocks called "BuilderBlocks" which essentially are just blocks that require a certain permission to interact with. The current system I am using does the following:

Stores blocks in a json file (file gets too big)
Loads on server startup into a hashset (laggy)
Then, when I start adding or removing blocks, gets laggy as well.
Lastly, I have a task that runs every minute that saves all the blocks.

I also use FAWE API.

All the code will be sent below.

https://github.com/YesNoBruhbruh/BuilderDelight

profiler (tested with 2 million blocks)
https://spark.lucko.me/IfmrJgvI7S

summer scroll
sly topaz
#

storing anything in the range of the millions in a single file is generally a bad idea

#

using json for storage when it is pretty simple data is also kind of an overhead at this point, I'd consider a proper binary format

#

as for the file, you could split them up by chunks, so it'd be more easily index-able

wraith dragon
rough ibex
#

for millions? use a db

sly topaz
wraith dragon
#

SQlite would work right? Or would using mongoDB better for performance

rough ibex
#

no but its better than a custom binary format

sly topaz
wraith dragon
#

I see

rough ibex
#

I really wouldn't go with a binary format

#

reinventing the wheel

#

dbs are made for scaling

wraith dragon
#

Also, in regards with the DB option, would just having it all in one table be a bad idea?

sly topaz
#

I mean, you could but why

sly topaz
wraith dragon
#

What even is a custom binary format? Is it like the file extension .txt, .json, .yml stuff?

sly topaz
#

those are human-readable formats, aka text formats

#

a binary format would be one that is only made to be read and written by a machine, so it'd just be serialized binary data of some kind

#

say, zip is a binary format, jpg and mp4 too, as they are only ever read and written by machines (though these examples specifically are interpreted/read by a machine, only then to be displayed to the user)

wraith dragon
sly topaz
#

if you want to do it properly, maybe

wraith dragon
#

Hmmmm, also apart from loading and saving the blocks, another issue I'm having is when actually adding and removing blocks using a hashset. Whenever it gets to 2m blocks or onwards, it starts failing on me, though I'm not sure if having multiple hashsets would solve the problem.

sly topaz
#

the general gist is, you define a header which needs to contain:

  • a magic number - this is used for identifying the file since the extension isn't enough as you could always just change the name
  • the size of the data
  • any other metadata of the format, varies depending on the format itself
    then just the data serialized into bytes, for primitive types this is easy since you can just use a ByteBuffer or a DataOutputStream
sly topaz
#

well, there might be a ton of hash collisions with that kind of data though so it can happen

wraith dragon
umbral ridge
#

(O) (O) complexity

sly topaz
#

just putting everything on a collection isn't gonna do it for this amount of data

wraith dragon
#

Oh, hmmm, then just getting rid of the set, and just going for the database the reliable solution?

sly topaz
#

I mean, sure, if you don't want to think about it, just let a database deal with the problem, they're built for that

wraith dragon
#

Alright, I'll start coding the stuff up and ill be back here for an update. Thanks for all the help πŸ™

earnest girder
#

if I'm having a player shoot snowballs and I want each snowball to shoot a bit to the left of where the player is looking, how would I do that?
Is there a vector method? I basically want to add a vector relative to the direction of the player. Vectors use x, y, and z so if I just add a vector it wont depend on where the player is looking

        float yaw = player.getLocation().getYaw();
        double D = 1.0;
        double x = -D * Math.sin(yaw * Math.PI / 180);
        double z = D * Math.cos(yaw * Math.PI / 180);

        Projectile snowball = player.launchProjectile(Snowball.class, player.getLocation().add(x, 1.25, z).getDirection().normalize());

        snowball.setShooter(player);

        Vector dir = player.getLocation().getDirection().multiply(4);

        Vector recoil = new Vector(-10, 0, 0);

        dir.add(recoil);

        snowball.setVelocity(dir);

this is my current code and it only works when the player is looking a specific direction

summer scroll
#

Also, I used a library from somewhere that I believe is something that you're looking for.

private Vector rotateAroundY(Vector vector, double angle) {
    double cos = Math.cos(angle);
    double sin = Math.sin(angle);
    double x = vector.getX() * cos - vector.getZ() * sin;
    double z = vector.getX() * sin + vector.getZ() * cos;
    return new Vector(x, vector.getY(), z);
}
#

So basically you can apply it like

Vector leftDirection = rotateAroundY(player.getEyeLocation().getDirection(), Math.toRadians(-10));

Snowball snowball = player.launchProjectile(Snowball.class);
snowball.setVelocity(leftDirection.multiply(2)); // Feel free to apply the speed multiplier
upper hazel
#

How add plugin in repository online. If this possible add in global maven repos

vast solar
#

good evening, can someone help me? I'm doing the hcf modality with core azurite but I can't find the permissions for this plugin to configure the ranges.

echo basalt
#

immutability is nice though

upper hazel
#

this possible create module in global project without parent connection?

#

i just have 2 parents....

shadow night
upper hazel
#

nah omg

unkempt peak
#

?paste

undone axleBOT
patent quarry
#

Hello, SUGAR_CANE is considered as Ageable
But always return:
Age = 0
AgeMaximum = 15

Someone know if there is a reason to get these info, or is it a bug ?

shadow night
#

are you sure it always returns 0?

spare hazel
#

i making a shell script to quickly deploy SMPs for people but i have a problem here:

apt update && apt upgrade
apt install openjdk-21-jre-headless

i also added the freedom of choosing the version but idk if java 21 will be able to work with all versions. whats the case for java versions and minecraft versions? like what version will be able to work with what java version

spare hazel
#

thanks

peak depot
#

Np

spare hazel
#

so 1.17 wont work with java 17?

peak depot
#

No I don’t think so

spare hazel
#

alright thanks!

chrome beacon
#

It might

#

Give it a try

sand spire
#

Does anyone know how to turn the default overworld generation to void using the configuration files?
or if this is possible with plugins without manually removing every block after after it is generated

I set it to flat and I think I can use generator-settings: to remove the last few layers of the world but I have no idea what to put there. I tried the official void preset but it doesn't work

chrome beacon
sand spire
buoyant hinge
#

is there a way to stop my hand from swinging when i click on a note block?

hushed spindle
#

how does this work?

#

how can getView() throw a NoSuchMethodError when its there?

slender elbow
#

outdated server

hushed spindle
#

its 1.21

slender elbow
#

outdated build

hushed spindle
#

alright

alpine urchin
#

πŸ˜‚

quaint mantle
#

buddy got rejected over on paper bc hes using offline mode and now comes here πŸ₯²

river oracle
#

are you using offline mode per chance

blazing ocean
icy beacon
#

is it possible in bungeecord to get the server name of the player that's logging in in LoginEvent
normally you can do ProxiedPlayer.getServer().getInfo().getName() but LoginEvent.getConnection() is not ProxiedPlayer

slender elbow
#

no, that first happens in the connect event

icy beacon
#

yeah figured out after rummaging through all the variables available

peak depot
#

but you can get his name with UUID using mojang api

slender elbow
#

yeah i mean if you ignore the original question, you can get an entirely different piece of information

blazing ocean
slender elbow
#

i mean you have the whole ProxiedPlayer object

#

but even still that's an entirely dfifferent thing from what they were asking lol

peak depot
#

how on LoginEvent get their name or not

slender elbow
#

they want to get the server name

#

not the player name

peak depot
#

mb

earnest girder
wintry dagger
#

what’s best itemsadder or otalen

#

is there any like objectively better one

chrome beacon
#

Other than that I'm not sure how big the diff really is

halcyon hemlock
#

hi everyone

halcyon hemlock
blazing ocean
#

next stupid discord feature

pliant topaz
#

i like how i cant even see it lmao

slender elbow
dawn flower
#

how do i get all classes of a package? (with a classloader)

halcyon hemlock
#

discord is ass now

blazing ocean
#

embrace slack πŸ’€

halcyon hemlock
#

i might just quit talking tbh

#

too many sweats

peak depot
#

lets all get back to teamspeak

#

just go back to real letters

#

going back to smoke signals

halcyon hemlock
#

going back to googoo gaagaa

echo basalt
#

mood

remote swallow
#

too late

#

spigot irc is dead

blazing ocean
#

?irc should be removed

undone axleBOT
umbral flint
#

Java 11+ maven artifact:

<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>5.1.0</version>
</dependency>

In their documentation

remote swallow
#

you might need an older version of hikari for java 8

blazing ocean
#

why use j8 anyway

hazy parrot
#

Hikari 4 should still be receiving security updates

lunar current
#

Hey guys i'm curently making a plugin allowing to build a structure that only you can see and then letting you place it or cancel it. It basicly add your modification to a hashmap<Location, BlockData> and then intercept packets regarding the desired block. My issue is that when trying to place a block on a block (they both dont actually exist), it replace the block that was previously placed. How could I make it possible to place a ghost block on a ghost block

blazing ocean
hazy parrot
#

Well you are on the ancient version, you have to use ancient software

echo basalt
#

gongas alt

#

also username doesn't check out

blazing ocean
echo basalt
#

default pfp, brand new acc

#

1.8 and knows a lil about coding

rain moss
#

Can you use still the net.minecraft libraries with spigot plugins for developing since 1.18.+? I can't implement anything from net.minecraft anymore since I have to build my library with BuildTools.

blazing ocean
#

fuckin ell

halcyon hemlock
#

dar

ivory sleet
#

?ban @hardy jewel ban evasion

undone axleBOT
#

Done. That felt good.

shadow night
#

who are they

blazing ocean
#

i was already wondering when we're gonna see him back

blazing ocean
#

aka freeakyZ πŸ₯Ά

halcyon hemlock
#

what did bro do

echo basalt
#

aka ola

remote swallow
echo basalt
ivory sleet
#

someone write down all the names this individual goes by lol

echo basalt
#

runs cracked servers n shi

echo basalt
#

from lisbon but operates in brazilian real

#

kinda yeah

#

and keeps joining here and asking stupid questions overall

dawn flower
rain moss
blazing ocean
halcyon hemlock
#

%20 would be space innit

karmic falcon
#

hi, iwas wondering what is the name of those menu things

remote swallow
#

doesnt surprise me tbh

halcyon hemlock
#

but for paths i dont think it should be there

dawn flower
#

hhow would i remove it?

halcyon hemlock
#

try change the folder name perhaps

#

idk

echo basalt
#

also cracked network skullWazowski

karmic falcon
remote swallow
#

how does he have so many alts and why doesnt he just realise he isnt wanted here

halcyon hemlock
echo basalt
#

he just makes a new one

chrome beacon
rain moss
left epoch
#

Hey can someone tell me how to get the spigot api from the new buildtools gui? I can't figure it out, it keeps generating me the server jar

rain moss
thorny cypress
#

Hello, can someone explain to me how exactly I can use NMS to code a sheep that, for example, rotates in a circle, can't find anything about it and would like to learn to code with NMS

#

Or does anyone have a nice site where you can see everything?

hazy parrot
left epoch
remote swallow
#

?maven

undone axleBOT
left epoch
#

I'm not using maven, i'm using eclipse

remote swallow
#

so go to the url it specifies as the repo

left epoch
#

gothca

#

gotcha*

#

Thanks I'll check this out

crystal goblet
#

Does anyone know how to check if an evoker summoned a vex?

left epoch
#

I'd guess it's some sort of listener event on evoker but that's all I can think of

earnest girder
dapper flower
#

i need to scan an area for the contents of certain chests, how do i make sure that double chests aren't scanned twice?

grim hound
#

scan if that inventory has not already been scanned

slate siren
#

.

#

While coding the plugin with Java, I added a right click action to Armorstand, but the Armorstand colored name

#

And right click doesn't recognize this name either

ancient forge
#

import com.gmail.nossr50.util.platform.Platform;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;

public class LaserPointerCmd implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
        if (!(sender instanceof Player)) {
            sender.sendMessage("Only players can use this command");
        }

        Player player = (Player) sender;
        ItemStack wand = new ItemStack(Material.STICK);
        ItemMeta metaWand = wand.getItemMeta();

        metaWand.setItemName(ChatColor.GREEN + "Magic Wand");

        wand.setItemMeta(metaWand);

        player.getInventory().addItem(wand);


        return true;
    }
}
```p1
#

import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Particle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.util.Vector;

public class pointerParticles implements Listener {



    @EventHandler
    public void onPlayerRightClick(PlayerInteractEvent event) {
        switch (event.getAction()) {
            case RIGHT_CLICK_AIR:
            case RIGHT_CLICK_BLOCK:
                break;
            default:
                return;
        }


        ItemStack item = event.getItem();
        if (item == null) {
            return;
        }


       if (!(item.getItemMeta() == null)) {
           PersistentDataContainer dataContainer = item.getItemMeta().getPersistentDataContainer();
           if (dataContainer.has(new NamespacedKey(CowCannon.getInstance2(),"metaWand"), PersistentDataType.STRING)) {
               shootParticleBeam(event.getPlayer().getLocation(), event.getPlayer().getLocation().getDirection(), 15);
           }
       }



        }
    private void shootParticleBeam(Location startLocation, Vector direction, int length) {
        direction.normalize();
        length = 15;

        for (int i = 0; i < length;i++ ) {
            Location currentLocation = startLocation.clone().add(direction.clone().multiply(i));
            startLocation.getWorld().spawnParticle(
                    Particle.DRAGON_BREATH,
                    currentLocation, 1, 0, 0, 0, 0

            );
        }
    }


}
#

when i give myself the wand it doesnt shoot the particles

#

(ping me on response)

tulip slate
#

how do you grab the point a vector ends at from the location its origin is defined as?

eternal oxide
#

a vector has no origin, but if you use a point you could use the vectors length to calculate an end point

tulip slate
#

oh so like
given location [x y z] + vector [a b c] = resulting point

eternal oxide
#

yes

#

most vectors are unit vectors. so only a length of 1

#

1 unit = 1 block in game

torn shuttle
#

hey, is there a way to prevent a world from doing a world save

#

I thought setting autosave to false when initializing it would do it

rain moss
# remote swallow ?maven

I have now imported the API with Maven, but I still doesnt have access to net.minecraft. etc. only to net.md_5.bungee etc.

rough ibex
#

NMS is not the API

#

net.minecraft.server is not spigot API

eternal oxide
#

?nms

rain moss
# eternal oxide ?nms

Ye thats what I mean with imported with Maven. But how can I get access to net.minecraft then?

eternal oxide
#

read that link

torn shuttle
#

bump on my world autosave question

#

I wonder if it's bugged

#

it's causing problems

#

I don't want to overhead of world saves for some of these worlds

rain moss
eternal oxide
#

if you can't understand that you should not be trying to use nms

rain moss
#

Its not just NMS.. its complete net.minecraft what I cant use

eternal oxide
#

that IS nms

#

read the link and learn

umbral flint
#

What should I call a class that represents a duration and has the ability to be infinite?

pseudo hazel
#

Duration

#

Timespan

torn shuttle
#

counter

rain moss
pseudo hazel
#

Net.Minecraft.Server, N.M.S

umbral flint
# pseudo hazel Timespan

Your two suggestions conflict with other framework classes, should I just ignore the conflict and use the names?

rough ibex
#

is there a reason you cannot use the existing classes

chrome beacon
#

^

umbral flint
#

I want a method called isInfinite()

lunar current
#

Hey guys i'm curently making a plugin allowing to build a structure that only you can see and then letting you place it or cancel it. It basicly add your modification to a hashmap<Location, BlockData> and then intercept packets regarding the desired block. My issue is that when trying to place a block on a block (they both dont actually exist), it replace the block that was previously placed. How could I make it possible to place a ghost block on a ghost block

pseudo hazel
#

InifniteDuration

#

and then wrap duration

tulip slate
umbral flint
dull schooner
#

hey guys

#

is there a way to save a list of list of strings on the config file?

pseudo hazel
#

otherwise use duration

#

you can probably ask gpt for other names

umbral flint
#

How would that work from a consumer stand point

dull schooner
pseudo hazel
#

but as long as those things arent in your packages why are you worried about the same name

#

google got like every class that exists in the world

umbral flint
#

I'm just going to use Timespan since in the jdk framework it is an annotation

dull schooner
dull schooner
#

hey guys, is there an event from when the player uses the wind burst enchantment?

left epoch
sleek creek
quiet ice
quaint mantle
#

how would i get the ip of a player with bungeecord cuz all the things are deprecated

lunar current
#

At this point just use the Deprecated lol

quaint mantle
#

yeah thats kinda what i was thinking

#

but i just wanted to make sure there isnt another non deprecated method

lunar current
#

In intelij it shows the replacement

quaint mantle
lunar current
#

Uh

#

I guess you can still use it

dull schooner
#

hey guys

lunar current
dull schooner
#

how do i spawn a double chest?

#

i tried to change the type of the chest to left or right but couldnt manage to do it

lunar current
#

?doublechest

#

I tough it had every commands 😭

#

Havent read it all but I saw that md_5 responded

dull schooner
#

Oh i was reading this forum rn haha

#

The Chest type doesnt have the method setType to Chest.Type

#

If it does, my ide is trolling me

grim hound
#

use ProtocolLib

#

Use PacketEvents

inner mulch
#

what happens when i set the inventoryholder to something else than null on Bukkit#createInventory()?

echo basalt
#

it'll work but keep in mind that any calls to getHolder have horrible performance when the check does fail

#

Because the vanilla impl copies the block state or whatever

inner mulch
echo basalt
#

In short it's more of an internals thing

#

Lets you track that "this inventory belongs to this block" so that when 2 players open the same chest they see the same inventory

#

Spigot exposing it makes no sense and it's only around because legacy stuff

inner mulch
#

okay

#

thanks

stuck oar
#
        if (this.hasKills(playerName))
            return this.playerKills.get(playerName);

        return(0);
    }```

how do i use this function in another class?
echo basalt
#

Pass your kill tracker object to the other class

#

?di basically

undone axleBOT
stuck oar
#

this is using 3 class files

#

im just trying to transfer a function to another

#

or make it accessible

#

whatv

inner mulch
#

yes for this you need to use dependency injection

#

im assuming you want to access your kill tracker in a command?

wraith delta
stuck oar
#

im just making it so that when they run /kills command it shows their kills

manic delta
#

How can I make a text display be on top of another? I want to make a text system that is under the player's name, but it doesn't work for me. I tried it like this. I want to posicionate them under the player name but the second one is buggued with the player skin

carmine mica
#

you probably need to set the height or smth

dawn flower
#

how in the world does "damage" work

#

how do i get the durability

chrome beacon
dawn flower
#

yeah

chrome beacon
#

Cast item meta to damageable

#

Do make sure you import the meta one and not entity

sterile breach
#

Hi whats the best way to get a value in main thread from async ?

Callsyncmethode? runtask? Using completable future ?

dawn flower
#

there is no getDurability

dawn flower
#

how do i trace where a method is called? (debugging purposes)

quaint mantle
blazing ocean
dawn flower
#

you can do that when working with spigot plugins?

blazing ocean
#

you can attach a remote debugger yes

dawn flower
#

that sounds like too much work tbh

#

how do u do it

blazing ocean
dawn flower
#

will it shutdown the server at breakpoints btw

blazing ocean
#

i believe it does on paper

dawn flower
#

dam

blazing ocean
#

if watchdog is enabled at least

dawn flower
#

thats not enabled by default right?

blazing ocean
#

if you are on paper (?whereami 😑) you can disable it in your paper config

#

i am not sure about spigot

quaint mantle
#

β€˜throw new Exception()’ πŸ—Ώ

dawn flower
#

i don't want to stop code execution

#

it works

#

it's boo'iful

#

how is this thing supposed to work

blazing ocean
#

is your server running on localhost

#

or remotely

dawn flower
#

local

blazing ocean
#

then just add those flags to your startup command

dawn flower
#

ok

blazing ocean
#

and use the 1. guide

dawn flower
#

and it's supposed to magically work

blazing ocean
#

yes

dawn flower
#

debug mode would prob be better

chrome beacon
quaint mantle
#

Istg discord mobile is the worst

shadow night
#

I agree

dawn flower
#

Plain Target: {@event-player}
Before Target: {{@event-player} @held-item}

public static String resolvePlaceholder(String placeholder, ParsedElement parsedElement, SyntaxParser syntaxParser) {
        ParsedElement parsedPlaceholder = syntaxParser.parseElement(parsedElement.getEvent(), parsedElement.getSection(), placeholder);
        System.out.println("Plain Target: " + parsedElement.getPlainTarget());```

```java
@Override
  public ParsedElement parseElement(Event event, TurboSection section, String element) {
    Pattern targetPattern = Pattern.compile(TARGET_REGEX);
    Matcher targetMatcher = targetPattern.matcher(element);
    String target = null;
    if (targetMatcher.find()) {
      target = targetMatcher.group(0);
      System.out.println("Before Target: " + target);
      element = targetMatcher.replaceFirst("");
    }
    String[] split = element.split(" ");
    return new ParsedElement(
        split[0],
        event,
        section,
        target,
        this,
        ArrayUtils.fromIndex(split, 1)
    );```
how in the world does this make sense, getPlainTarget() doesn't do anything, it just returns ``this.plainTarget``
#

why did it just strip out the rest of it

#

oh crap, i'm doing parsedElement not parsedPlaceholder

#

500 iq right there

umbral ridge
#

does anyone here use Zelix KlassMaster

#

ProGuard?

dawn flower
#

not me

umbral ridge
#

is it possible to reverse engineer a compiled plugin

#

and change the source code

blazing ocean
#

juts look at the jar

umbral ridge
#

i'm trying to implement checksum validation but ig thats just pointless and most obfuscators are crap

#

do I really need to spend 500 bucks for a premium obfuscator

#

is it gonna be any different

blazing ocean
#

wha

#

$500??

#

tf

umbral ridge
#

Zelix KlassMaster

blazing ocean
#

skull

dawn flower
#

if i'm spending 500 bucks for an obfuscator, it better be more secure than gta 5's obfuscation

dawn flower
#

is the max damage an item can have equal to the item material's max durability

#

(before it breaks)

lunar current
dry hazel
dawn flower
#

^

dry hazel
#

scrambling the names and removing debug attrs with proguard is enough for minecraft plugins if you really want to

dawn flower
#

plus you're not trying to hide top secret code

#

the best you can do is ©️, since people can still copy paste your obfuscated plugin into their server

quaint mantle
#

β€œBro I stole your code”
β€œIt’s not my code”

chrome beacon
#

People will decompile it no matter what you do

eternal oxide
#

The only time you should obfuscate is if you have a commercial product. Then you are required to make (some) effort to protect your IP.

#

Just as Mojang/MS do. Its not really to protect the Minecraft code, it's to comply with legalities so they "can" sue poeple if they want.

latent sierra
#

How do you make certain things tick/update less often, for example making arrows tick once every 2 ticks?

remote swallow
onyx fjord
#

whats the difference between me only throwing a runtime exception vs also adding throws to my method?

dry hazel
#

adding a runtimeexception or a subclass to the throws clause is redundant

#

it's always unchecked

orchid iron
tardy delta
#

decompile time?

orchid iron
#

ty

#

ill give that a try

sterile breach
tardy delta
#

wdym players online list? Bukkit.getOnlinePlayers()

sterile breach
topaz cape
#

is there a library that is able to modify region files

grim hound
#

doesn't break for no reason unlike ProtocolLib

#

it's faster

#

it's cross-platform

#

it's much more intuitive and clear

#

there's absolutely no reason to use PL

lunar current
#

Even if I am lazy?

grim hound
acoustic pendant
#

Hey, if getConfig().options().parseComments() is true for default why aren't my comments saving when using this?


        getConfig().options().copyDefaults(true);
        saveConfig();```
#

It is saving the comments that are inside a line but not the comments that are alone (#Level needed to prestige is saving)

grim hound
#

What're the gradle names for nms & craftbukkit src?

#

I've ran BuildTools

chrome beacon
#

Take a look at the remapping plugin for gradle

#

It tells you what to add

#

1 sec let me find link

spare hazel
#

hey, i wanted to make it so if a value was not found in the config, it would automativally create it and save it. my first idea was to extend the FileConfiguration but im wondering, is that even possible and are there any better ways?

eternal oxide
#

getOrDefault

spare hazel
eternal oxide
#

you can provide a default value if the entry is not found

spare hazel
#

but it will not save it to the config file

eternal oxide
#

Correct

hushed spindle
#

handy lil thing

eternal oxide
#

You'd have to test it to see if it adds it as a default

#

options().copyDefaults(true)

hushed spindle
#

if value in your plugin config is not present in server config, its added

#

so you can make changes to your plugin config and have em updated on servers too

spare hazel
#

alright thanks

hushed spindle
#

im wondering, using Player#breakBlock(Block) frequently(ish) seems to cause a lot of lag. Is there a method of breaking blocks naturally that doesn't cause as much lag

#

im confused by this regardless because with my current setup im using that method about as frequently as players break blocks themselves, yet that isn't lagging

#

having a bunch of players on the server break blocks in this way is using up like 15% of server tick

chrome beacon
#

Try getting a spark report

#

The API does have some overhead but it shouldn't be that bad

eternal oxide
#

unless your server is a potato

chrome beacon
#

Or you're breaking a bunch of blocks in unloaded chunks

#

Causing a bunch of blocking chunk loads

dawn flower
#

does PlayerInventory#getItemInMainHand return a copy of the item, or the actual item instance

dawn flower
#

how do i break an item

summer scroll
dawn flower
#

alright

summer scroll
dawn flower
#

i want the animation

hushed spindle
#

some of the effects play the equipment break animation

inner mulch
#

how do i save minigame maps in 1.21, I heard about SlimeWorldManager, but it doesnt seem up to date

river oracle
#

Or a tar file if you're really crazy

inner mulch
#

just saving the world in its plain format?

river oracle
#

Yeah

#

What's wrong with the plain format?

#

Trim all the excess data you don't need

inner mulch
inner mulch
river oracle
#

Or that were loaded on accident

inner mulch
#

can i do this automatically?

river oracle
#

No clue

#

We always used void world at my work

#

So the maps didn't really take much space

inner mulch
#

ok

sterile breach
#

Il what case its better to call runtask() than callsyncmethod() ? (From async)

eternal oxide
#

not much difference

ivory sleet
sterile breach
echo basalt
#

future.get will block the thread until the thing runs

#

its aite if you're doing it async but even then you could just do a thenAccept

sterile breach
#

So its same that
Callsyncmethod its same that

Completablefuture f = new CompletableFuture():
Runtask(f.complete(value))

int myvalue = f.get();

Or f.thenaccept(myvalue -> ())

echo basalt
#

f.get will block, f.thenAccept will run the task later

#

properly name your variables pls

#

and read my guide

river oracle
#

also initializing a CompletableFuture like that is wild

#

lol

dawn flower
#

how do i get the server version as an int?

#

1.8 would be 18

river oracle
#

parse Bukkit.getVersion

dawn flower
#

what format is getVersion

river oracle
#

I forgoet

#

I think its the Bukkit version

sterile breach
echo basalt
#

Correct

sterile breach
#

The callback concept (with functionnal interface) was replaced with completable future in java 8 or its again usefull on certain case ?

slender elbow
#

well, it's still a form of callback

#

but yes, there is no reason not to use CompletableFuture

echo basalt
#

coroutines

tardy delta
#

pthreads

#

ignore that

grim hound
#

yo

#

guys

#

Is it possible to have a spigot server running and create a seperate server (in the same java process), just on a different port and redirect the players to that server?

#

talkin' about a custom server implementation here

chrome beacon
#

You can use Minestom

#

And then launch that from your plugin

grim hound
#

a lot of possibilities

chrome beacon
#

Yeah

grim hound
#

whether it's a viable option to redirect the player

#

so the spigot server doesn't know

#

I know how to make the spigot server never see the player's connection

#

but not sure about how the redirecting would work

chrome beacon
#

No idea

#

What you're doing should really just be handled by a proxy anyways so πŸ€·β€β™‚οΈ

grim hound
#

i would also need to save the packets the player sends and then resend them to the spigot server when I'd like to have the player join the spigot server

grim hound
#

just without Velocity, Bungee or Gate

grim hound
chrome beacon
#

You're making a plugin yes

#

Not a full proxy

grim hound
#

a separate server process?

chrome beacon
#

A regular proxy will run in a different process

#

It won't inject itself in to the targets

grim hound
slender elbow
#

a proxy server is an entirely separate process that could be running on an entirely different machine

#

god forbid the vm crashes on the server because then the proxy goes down as well

#

you could in theory have a proxy running on the same vm as a spigot server, but not more than one because spigot relies on global static state

#

but it's also gonna overload the GC eventually and you lose the ability to split servers across separate machines if needed

#

there is just no good reason to do it

chrome beacon
#

They're doing a login auth plugin for offline mode servers

#

So the player count wouldn't be that different

#

but still it's a bad idea

#

Overly complex and intrusive for no reason

slender elbow
#

yeah you can't just make that s plugin lol

nova shoal
#

Dear,

I got a problem with my POM.XML, which is never finding the spugot dependencies.
Here the file:

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/POM/4.0.0">

<modelVersion>4.0.0</modelVersion>

<groupId>com.yourname</groupId>
<artifactId>autoreplantplugin</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>AutoReplantPlugin</name>
<description>Un plugin qui replant les plantes automatiquement lorsqu'elles sont cassΓ©es.</description>

<properties>
    <maven.compiler.source>17</maven.compiler.source>
    <maven.compiler.target>17</maven.compiler.target>
    <spigot.version>1.20.4-R0.1</spigot.version>
</properties>

<repositories>
    <repository>
        <id>spigot-repo</id>
        <url>https://repo.spigotmc.org/nexus/content/repositories/public/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
    <groupId>org.spigotmc</groupId>
    <artifactId>spigot-api</artifactId>
    <version>${spigot.version}</version>
    <scope>provided</scope>
    </dependency>
</dependencies>

</project>

slender elbow
#

pretty sure 1.20.4 requires java 21, not 17

chrome beacon
chrome beacon
#

1.20.5 changed that I believe

slender elbow
#

ah

slender elbow
grim hound
#

I've been developing my auth plugin for 2 years now

blazing ocean
slender elbow
#

it's not even an Auth plugin lol

nova shoal
grim hound
#

and I always come to the same conclusion: I need to separate the spigot server from the verifying user

slender elbow
#

it's an "everything for cracked people" plugin

blazing ocean
slender elbow
#

so just run a separate limbo server lmao

#

that has been solved time and time again

chrome beacon
#

Did you use ChatGPT to generate your pom or smth

#

https://hub.spigotmc.org/nexus/content/repositories/snapshots/

#

is the correct one

nova shoal
onyx fjord
#

i have this line of code to load my json objects

List<Area> loadedAreas = gson.fromJson(reader, new TypeToken<List<Area>>() {}.getType());

however if one element is null during deserialization Gson just freaks out and throws an NPE instead of skipping that element
how can i make it skip null objects?

slender elbow
#

well it can't skip null objects, at best it will put a null in the list

#

do you have a custom TypeAdapter for Area?

coarse linden
#

Hey. So I recently came across a little feature that the newer versions of spigot have that the older ones do not. When cancelling events, the server seems to cancel them, but the client packets like sound or potion effects don't and they get sent to the player.

For example: If you cancel the event for spawn eggs in 1.8 they will also cancel the sound. But it newer versions like 1.21, it will not cancel the sound and still send the packet. This isn't a huge deal as you can just cancel the packet using something like ProtocolLib which I ended up doing, however this happens with thinks like suspicious stew.

If you cancel the consumed food event and it has custom potion effects, it wont stop the packets being sent to the player that gives them the potion efffects. This creates a weird situation where they have the potion effect but cannot use milk to get rid of it or any commands as its on the client. (Yes, rejoining gets rid of it but thats not the point).

Im just wondering why this change was made.

late sonnet
coarse linden
#

Okay, thank you. I will.

late sonnet
# coarse linden Okay, thank you. I will.

not problem.. in another cases (i hope dont) the sound/particle its client side and mojang dont suppose to think you can cancel them but its strange that happen now... then its most probably that things and handled in another way where the event currently cant or can cancel things like sound/particle

coarse linden
late sonnet
#

?jira

undone axleBOT
onyx fjord
#

whats the event for wind charge pushing a player?

late sonnet
coarse linden
# late sonnet ?jira

Before I make one, do you think this could be a paper issue? The spigot plugin isn't using any paper dependencies or the paper appi, however it is running on the paper 1.21.1 server and could that be causing these problems?

runic kraken
#

Can spigot manipulate oxygen underwater?

late sonnet
rough drift
coarse linden
#

Just tested it on a spigot server and it looks like it's not the server.

#

I am going to make a JIRA ticket now, thanks.

rough drift
#

awww okay

slender elbow
rough drift
#

let them find the bug

#

on their own

#

not from this chat

slender elbow
#

:Clueless:

rough drift
late sonnet
rough drift
#

otherwise, I know there is paper staff in this dc

late sonnet
#

I dont see the issue in that

dawn flower
#

why does ItemStack#setType not automatically change the item?

#

(if the instance is not a clone)

echo basalt
#

Because we still need to send a packet back to the client saying the item has changed

coarse linden
rough drift
slender elbow
#

the whole point of submitting a bug report to spigot is to reproduce that bug on a spigot server πŸ’€

coarse linden
#

If you guys would read it

#

I said i tested it on a spigot server aswell.....

#

same results...

rough drift
#

report it for spigot

#

not for paper

#

specify the spigot version

#

not paper's

#

lmao

coarse linden
#

Its the spigot api

slender elbow
#

then at least put the spigot /version on the version lmao

runic kraken
#

I'm trying to set everyone on the server to have 1 bubble to breathe underwater. Can someone explain to me why it keeps showing me two even though I want one?

    @EventHandler
    public void onEntityAirChange(EntityAirChangeEvent event) {
        if (event.getEntity() instanceof Player) {
            Player player = (Player) event.getEntity();

            int oneBubbleAir = 20 * 2; 

            if (player.getLocation().getBlock().getType() == Material.WATER) {
                event.setAmount(oneBubbleAir);
            } else {
                event.setAmount(player.getMaximumAir());
            }
        }
    }
coarse linden
#

dont blame me

#

blame urself for not reading

dawn flower
rough drift
#

you're multiplying by 2

#

I mean

coarse linden
#

paper is better anyways

rough drift
#

I ain't no genius

coarse linden
#

on the server

rough drift
dawn flower
#

?whereami

rough drift
#

Please, if they fixed all of the game breaking glitches, have fun

coarse linden
#

???

#

heated a bit

#

holy

#

im just trying to fix something

#

let someone have an opinion

dawn flower
#

what are you trying to fix

eternal oxide
#

You are on spigot so report spigot not paper

coarse linden
#

its a bug

rough drift
coarse linden
#

with spigot api

eternal oxide
#

If your logs are paper it will likely be ignored

nova shoal
#

I got a problem with my imports. My plugin is saying cannot find symbol carrot etc.

heres my imports packages:
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Crops;
import org.bukkit.block.data.type.Beetroot;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.entity.Player;

pseudo hazel
#

show code

#

and what IDE are you using

nova shoal
#

Too long to send there

rough drift
#

?paste

undone axleBOT
coarse linden
#

you are no help to anyone

pseudo hazel
#

stop fighting

rough drift
#

Keep whining

nova shoal
#

Huh ?

rough drift
#

not you

nova shoal
pseudo hazel
#

what IDE are you using

coarse linden
nova shoal
#

Maven

coarse linden
#

no

#

the ide

pseudo hazel
#

no I mean like intellij?

nova shoal
#

I think so

pseudo hazel
#

what program do you use to code in

nova shoal
#

VSCode

eternal oxide
pseudo hazel
#

interesting choice I guess

nova shoal
#

name: AutoReplantPlugin
version: 1.0
main: com.yourname.autoreplant.AutoReplantPlugin
api-version: 1.20

eternal oxide
#

?paste your config

undone axleBOT
eternal oxide
#

carrot not carrots

nova shoal
#

Same error

pseudo hazel
#

can you show the full error?

nova shoal
#

It seems like the imports I've set aren't the good ones

dawn flower
#

what's the default walk / fly speed?

coarse linden
#

1

dawn flower
#

that's way too fast

coarse linden
#

0.1

slender elbow
#

.1 iirc

dawn flower
#

for walk or fly

pseudo hazel
slender elbow
#

they aren't using BlockType at all though?

dawn flower
slender elbow
#

no clue

#

fly probably

#

idk about walk

dawn flower
#

ok

pseudo hazel
#

well I assume thats what they want, since thats where the CROPS and CARROTS are

nova shoal
#

Nah, still the same error..

pseudo hazel
#

right..

slender elbow
pseudo hazel
#

there is Crops, but thats deprecated

blazing gyro
#

hello, is it possible for me to make connected blocks like redstone?

pseudo hazel
#

there is no such class as Beetroots or Potatoes or Carrots though

slender elbow
#

yeah idk they're coding in notepad or smth?

pseudo hazel
#

vsc, so yeah

#

switching to a proper IDE for this like intellij could help as well

blazing gyro
pseudo hazel
#

I mean how do you think redstone works

#

its probably gonne be less performant since its in a plugin

#

but like

#

I dont think the difference would be that big

nova shoal
#

Hod do I change my IDE?

solid spoke
#

Who can help with setting up weaknesses. I would like to make sure that the damage inflicted on the mob using a snowball is large. Who can help implement this (Mythic Mobs)

chrome beacon
#

?services

undone axleBOT
pseudo hazel
#

download Intellij Comunnity edition and open the project in there

zenith bobcat
#

Hey guys can someone tell me how I can change Playernames I already tried changing GameProfile throuth reflection and then send the appropriate packets but this doesnt helped

nova shoal
#

Okay, doing it right now

runic kraken
#

can someone help me with the correct air removal system because I have a problem that when I should have 10 bubbles, I have 7

    @EventHandler
    public void onPlayerDeath(PlayerDeathEvent event) {
        Player player = event.getEntity();
        UUID playerId = player.getUniqueId();

        int bubbles = playerBubbleCount.getOrDefault(playerId, 10);

        bubbles--;

        if (bubbles > 0) {
            playerBubbleCount.put(playerId, bubbles);
            player.sendMessage(ChatColor.RED + "StraciΕ‚eΕ› jeden bΔ…belek oddychania. ZostaΕ‚o Ci " + bubbles + " bΔ…belkΓ³w.");
        } else {
            playerBubbleCount.put(playerId, 0);
            player.sendMessage(ChatColor.RED + "StraciΕ‚eΕ› wszystkie bΔ…belki oddychania!");
        }
    }

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        UUID playerId = player.getUniqueId();

        playerBubbleCount.putIfAbsent(playerId, 10);
    }

    @EventHandler
    public void onEntityAirChange(EntityAirChangeEvent event) {
        if (event.getEntity() instanceof Player) {
            Player player = (Player) event.getEntity();
            UUID playerId = player.getUniqueId();

            int bubbles = playerBubbleCount.getOrDefault(playerId, 10);
            int maxAir = bubbles * 20; 

            if (player.getLocation().getBlock().getType() == Material.WATER) {
                if (event.getAmount() > maxAir) {
                    event.setAmount(maxAir);
                }
            } else {
                event.setAmount(player.getMaximumAir());
            }
        }
    }
}
#

Something's wrong with my bubble system

zenith bobcat
runic kraken
#

Yes

#

I try to subtract one bubble with each player death

zenith bobcat
runic kraken
zenith bobcat
#

when does this happen?

nova shoal
#

Hod do I compile with Intellij then ?

zenith bobcat
eternal oxide
#

an int is a primitive which is impossible to be null

#

Integer can be null, int can not

runic kraken
eternal oxide
#

player.setMaximumAir(player.getMaximumAir() -1)

left epoch
#

Hey, I'm running into an issue. In Spigot 1.20.2 this was working perfectly. Now that i've ported it to 1.21.1 latest snapshot my plugin is failing to retrieve itemMetas from items like crossbows, tridents, and netherrite items. Was there a change to how itemMetas need to be retrieved in the latest spigot?

river oracle
#

sounds like it could be a bug

#

could you provide the snippet of code causing errors?

left epoch
river oracle
#

This seems like it may be a spigot bug please do the following steps

  1. Create a Minimum plugin to reproduce the error (Simply retrieve item meta of the problematic items)
  2. Create a Jira account for spigot if you don't already have one (A link to the jira will be posted below)
  3. Report the bug on jira with an explanation of your issue and the minimum code needed to reporduce the issue.

Your code should look something like this if I'm understanding the issue correctly

public void MyIssue extends JavaPlugin {
  @Override
  public void onEnable() {
    final ItemStack item = new ItemStack(Material.TRIDENT);
    item.getItemMeta();
  }
}
#

then post the accompanying stacktrace

#

?jira

undone axleBOT
left epoch
#

Thanks I'll work on this

zenith bobcat
#

Can someone tell me how I can change Playernames I already tried changing GameProfile throuth reflection and then send the appropriate packets but this doesnt worked i am using 1.20.6

zenith bobcat
eternal oxide
#

-20 it looks like

#

its in ticks

#

I'd assume each bubble would be 1 second

#

but whatever math works

untold compass
#

I can't add spigot in "JRE System Library", "external jars" is not clickable

eternal oxide
#

Eclipse?

untold compass
#

yeah

eternal oxide
#

use maven

left epoch
#

I'm using gradle for eclipse

#

if you decide to go that route I can help you set up a project

eternal oxide
#

?maven

undone axleBOT
zenith bobcat
carmine oracle
#

is there a way to create a datapack through spigot code?

eternal oxide
#

you could but it would be more work than its worth

#

you'd still have to host it

carmine oracle
#

I want to be able to edit an already existing dp, but the developer told me it might be better to overwrite it's values with another datapack so idk

carmine oracle
eternal oxide
#

you can use multiple packs now

#

client has to be able to download the pack

carmine oracle
#

I think you are mistaking datapack for resourcepack

#

datapack is server sided, unless it has textures or something the player needs

dire marsh
#

no you can't really make datapack features through api

#

api is severely outdated in this regard

carmine oracle
#

that's what im trying to figure out

chrome beacon
#

not clientside

#

You're thinking of resource packs

eternal oxide
#

ah okies, I was getting them mixed up then

carmine oracle
#

yup yup

nova shoal
#

Dear,

I need your help. I have a plugin that need sto use a command when a player use an item. I've my code there, the plugin should add the player to a LuckPerms group, but nothings happening, and I have no error

chrome beacon
eternal oxide
#

In which case, yes you can create datapacks from a plugin, but you'd have to restart the server after

carmine oracle
carmine oracle
eternal oxide
carmine oracle
nova shoal
#

Found, thank's

carmine oracle
#

and just write the json as any json would be written

eternal oxide
#

yes but zipping is easy in java

carmine oracle
#

so any zipping method for java works fine for spigot deving?

eternal oxide
#

yes

carmine oracle
#

nice, ty

eternal oxide
chrome beacon
#

Any modding environment should have them easily accessible

eternal oxide
#

perhaps not. only ones the server already detected. so yes a restart

chrome beacon
#

The Minecraft Worldgen discord might also be of interest to you

carmine oracle
carmine oracle
#

I'm not in a modded env btw

gaunt talon
chrome beacon
#

I was just saying that you can use one to help generate the required json files

#

I'm not entirely sure if they allow datapack gen but I'd assume so

chrome beacon
gaunt talon
#

But it's not possible for setDeathMessage right ?

I have to do something like :

event.setDeathMessage(null);
for (Player player : getServer().getOnlinePlayers())
  player.sendMessage(message);

?

chrome beacon
#

You should use Bukkit.spigot().broadcast()

#

if you want to send to all players

#

but yes you'd have to something like that

#

When it comes to components Paper does have a lot better API

#

so if you plan on using that I recommend depending on their API instead

gaunt talon
#

okok thx : )

gaunt talon
# chrome beacon Use `player.spigot().sendMessage()`

Bruh, now I got this xD

com.google.gson.JsonParseException: Failed to parse either. First: Failed to parse either. First: Not a string: {"with":[{"translate":"entity.minecraft.polar_bear"},{"text":"LeWeeky"}]}; Second: Not a json array: {"with":[{"translate":"entity.minecraft.polar_bear"},{"text":"LeWeeky"}]}; Second: No matching codec found

my code : ```Java
target_player.spigot().sendMessage(message);


EDIT: 

## Solution : 

Default constructor doesn't create starting string
```java
TranslatableComponent message = new TranslatableComponent();

Add "" inside constructor to do an empty string

TranslatableComponent message = new TranslatableComponent("");
restive mango
#

I'm having some trouble tracking a star over time with a particle effect. Does anyone know why this might be the case? I have a vector for the star at time = 0, and then I rotate it on the z axis by player.getWorld().getTime()/24000.0)2Math.PI, but it seems to drift.

#

it lines up at 18000

tardy delta
#

Bukkit.spigot() kek

umbral flint
#

should I do argument checks inside a CompletableFuture, or outside?

tardy delta
#

what

umbral flint
#
public @NotNull CompletableFuture<@NotNull Saved<PlayerMutePunishment>> mutePlayer(
            @NotNull UUID target, @Nullable UUID issuer, @Nullable String reason, @NotNull Duration duration
    ) {
        /*Do Preconditions#checkArgument*/
        PunishmentService punishmentService = this.noonieManagement.getDatabaseManager().getPunishmentService();
        return punishmentService.getPlayerMuteHistory(target)
            .thenAccept(history -> {/*Do Preconditions#checkArgument*/});
}
tardy delta
#

check what args? params?

#

if so yes

umbral flint
#

Inside?

tardy delta
#

ah outside

#

just validate params on the beginning of a function

umbral flint
#

Ok thanks

stuck oar
#

attacker.sendMessage(Killstreak.killStreaks(attacker.getName())); why does this have a problem?

#

it says implement method but that doesnt work

#

method call expecte

nova shoal
#

Dear, I got a problem, here my code there : world.playSound(spawnLocation, Sound.BLOCK_NOTE_BLOCK_PLING, 1.0f, 1.0f);, but this is not working. Is this sound even in Minecraft?

restive mango
#

Is rotation not measured in in 2pi or something?

glad prawn
echo basalt
#

and then just have the future return the punishment object after it's done saving

umbral flint
echo basalt
#

I'm not a fan of polluting the method params when it can be nicely wrapped in a reusable data class

umbral flint
#

I mean

#

Hm

#

I also have this method

    public @NotNull CompletableFuture<@NotNull Saved<PlayerMutePunishment>> unMutePlayer(
            @NotNull UUID target, @Nullable UUID pardoner, @Nullable String reason
    ) {/*...*/}
stuck oar
#

<String, Integer>

glad prawn
#

Yeah returned value is Integer, it's expected a String

stuck oar
#

can i just do like (String) infront

hazy parrot
#

just call .toString()

zinc moat
#

How do i spawn a mob in a BukkitRunnable
How do i even spawn a mob

stuck oar
wraith delta
# zinc moat ~~How do i spawn a mob in a BukkitRunnable~~ How do i even spawn a mob
    public void joinEvent(PlayerJoinEvent e) {
        Player player = e.getPlayer();
        
        new BukkitRunnable() {
            @Override
            public void run() {
                // Spawns a cow at the player's location after 1 second
                player.getWorld().spawnEntity(player.getLocation(), EntityType.COW);
            }
        }.runTaskLater(YourMain.getPlugin(YourMain.class), 20L);
    }
```thisll spawn a mob, you need a event or to pass a location. 20L = ticks so 1 second
zinc moat
#
    private void SpawnCustomBoss(){
        int delay = getConfig().getInt("delay");
        Location location = getConfig().getLocation("location");

        new BukkitRunnable() {
            @Override
            public void run() {
                
            }
        }.runTaskTimer(this, 0, delay);
    }
wraith delta
zinc moat
# wraith delta Where do you want it to spawn
    public boolean onCommand(CommandSender sender, Command command, String s, String[] args) {
        if (sender instanceof Player){
            Player player = (Player) sender;
            Location location = player.getLocation();

            plugin.getConfig().set("location", location);
        } else{
            sender.sendMessage("This command can only be ran by a player");
        }
        return false;
    }

Got a command for that

wraith delta
# zinc moat ``` public boolean onCommand(CommandSender sender, Command command, String s...
    new BukkitRunnable() {
        @Override
        public void run() {
            if (location != null) {
                LivingEntity themob = (LivingEntity) location.getWorld().spawnEntity(location, EntityType.COW);
                themob.setCustomName("ScareCow");
                themob.setCustomNameVisible(true);
            }
        }
    }.runTaskTimer(this, 0, delay);
```oh then youll go this route. and use it in the main class. or fill out similar info to my last msg
chrome beacon
#

When spawning a mob that you want to modify use the spawn method that accepts a consumer

zinc moat
hazy parrot
#

it have to do something xd

wraith delta
hazy parrot
#

expected behavior

lunar current
#

Hey guys i'm curently making a plugin allowing to build a structure that only you can see and then letting you place it or cancel it. It basicly add your modification to a hashmap<Location, BlockData> and then intercept packets regarding the desired block. My issue is that when trying to place a block on a block (they both dont actually exist), it replace the block that was previously placed. How could I make it possible to place a ghost block on a ghost block

grim hound
#

otherwise I refuse to help

lunar current
#

okay i will

grim hound
lunar current
#

wher

grim hound
quaint mantle
#

Average packet manipulation code

lunar current
#

man i didnt do java for like a year

#

and just got back

#

pardon me lol

grim hound
lunar current
#

HOLY WHAT IS MAIN.GETINSTANCE

#

HOW DARE I

#

I SHOULD REPEND

#

I AM SORRY IF I OFFENDED YOU, I DIDNT MEAN TO DO SUCH A THING

coarse linden
#

no

#

its not that

zenith bobcat
#

Can someone tell me how I can change Playernames I already tried changing GameProfile throuth reflection and then send the appropriate packets but this doesnt worked i am using 1.20.6

coarse linden
#

its the public static hashmap

#

after you call getInstance()

#

its not really normal or safe

zinc moat
#

Can someone help me i am trying to add a potion effect to a living entity i've red the docs but nothing seems to work

coarse linden
#

the entity must be a livingentity

#

and then call .addPotionEffect

zinc moat
#
new BukkitRunnable() {
            @Override
            public void run() {
                if (location != null) {
                    LivingEntity Boss = (LivingEntity) location.getWorld().spawnEntity(location, EntityType.WITHER_SKELETON);
                    Boss.setCustomName("Ghost prime jr.");
                    Boss.setCustomNameVisible(true);
                    Boss.setGlowing(true);
                    Boss.addPotionEffect();
                }
            }
        }.runTaskTimer(this, 0, delay);
#

The boss.AddPotionEffect dont give me anything else then this wait

coarse linden
zinc moat
quaint mantle
#

Constructor

coarse linden
#

you have to create a new PotionEffect

quaint mantle
#

new PotionEffect

zinc moat
#

Ohh

coarse linden
#

new PotionEffect(PotionEffectType.Whatever)

#

if you need help make sure to look on spigotdocs

quaint mantle
#

ex c# dev right there

coarse linden
lunar current
grim hound
#

static

#

done.

coarse linden
#

that solves his problem

#

then makes another one

#

πŸ€¦β€β™‚οΈ

lunar current
coarse linden
#

just let him keep it static if he wants to

#

yeah

#

dont bully him

lunar current
#

no static is ugly

#

i hate static

coarse linden
#

for you

#

its good

lunar current
#

but i didnt find how to not make it static

#

like constructor aint working

#

@coarse linden

chrome beacon
#

That's fine

#

You just can't access a variable like that outside of a method/variable declaration

lunar current
#

bruh what i'm lost

#

i do like that in every other class

chrome beacon
#

You do not

lunar current
chrome beacon
#

Yeah

#

That's correct

chrome beacon
lunar current
#

no i mean

coarse linden
#

buddy

chrome beacon
#

Do follow naming conventions

lunar current
#

That the plugin is not defined

coarse linden
#

you didn’t even fix the original problem

#

what is going on

lunar current
#

what was it

coarse linden
#

The hashmap

lunar current
#

yeah?

coarse linden
#

Not the plugin instance

#

that was fine

lunar current
#

HAshmap is fine

#

Well

#

When i log off, my server crash if i have a session enabled

#

Basicly a session is when every time i place or break a block

#

it just adds it to a hashmap

#

And overwrite the packets (blockupdate)

coarse linden
#

yeah

lunar current
#

let me try to crash it to show log

#

And i was thinking the problem came from the getInstance()

coarse linden
#

the singleton is fine

paper viper
#

(not rllyyy but fine)

lunar current
#

tf is singleton

#

gosh i forgot everything

#

Anyways, the reason why i asked help here is for placing a ghost block on a ghost block

#

@coarse linden could i maybe show a ss of what i mean

grim hound
#

uh

#

this doesn't really get the spigot api

grim hound
#

wait, no, it does work

#

nice

coarse linden
#

what other way are you going to get the plugins instance

remote swallow
#

Di

onyx fjord
#

does setStorageContents in playerinventory also count slot bar?

stuck oar
#

how do i make my arguments an integer instead of a string in a cmd?

slender elbow
#

you don't, you take the string and parse it as an integer

#

Integer.parseInt

left epoch
stuck oar
#

Result of 'Integer.parseInt()' is ignored

tardy delta
#

Because you receive a string Array?

stuck oar
#

nvm

#

silly me

sterile token
#

How are you? How would you do to create an instance of an object by reflections but knowing that each class to initialize could have any constructor with parameters. The problem here is that to initialize you have to know the parameters, something that I would not know. That's why I need to find a way to initialize objects without knowing the constructors using the one that doesn't have any parameters. But I understand that if you don't specify an empty one, java doesn't create it by default. I know that some libraries already handle these, one of them is Gson

coarse linden
#

You can try using sun.reflect.ReflectionFactory

#

or gson

slender elbow
#

i mean, it really just depends on what you're doing exactly and why

paper viper
fading beacon
#

anyone knows how to make strays give you the freezing effect from 1.17 when hitting you

coarse linden
paper viper
#

?

coarse linden
#

you do not need it imo. a singleton works great and a di just makes things more complex and adds more code for no reason. is it more flexible? yes, but there is no need to be flexible with a class that can only be instantiated once. unless you are creating a hierarchy with the javaplugin class, a singleton is better.

#

here is an example of how a di should be used

#

when there is flexability; not when there is none

#

spring boot makes this easier, but there are no disadvantages with using singletons for this example.

river oracle
#

singleton for plugin instance makes sense

#

unless you want to go pure DI which is a literal nightmare

rose lichen
#

I'm making a Minecraft java class that going to communicate with a website with socket.io when they are in a WorldGuard region it'll read a config file named audio.yml made by the main class, made regions in the config looks like below and when it see if they are in a valid region that has audio linked it'll take a audio file from the websites side and play it through the webhook using socket.io, each player will be in different regions and each player has a link generated for them using there UUID, the link looks like: https://www.mcilluminations.net/audio.html?user=3fc8ef6d-420e-4b5b-91ae-e625e9bb2fe7 all of the audio is stored in the website under the Audio folder path

Regions:
wdw: main.mp3
epcot: entrance.mp3

slender elbow
coarse linden
#

yes

#

but you do not need DI to get the plugin's instance

#

if there is i would love to hear it

river oracle
# slender elbow singleton and DI are not mutually exclusive β˜οΈπŸ€“ they can work together perfectl...

they are mutually exclusive you dumb idiot why else would I need

class Player1 {}
class Player2 {}
class Player3 {}
class Player4 {}
class Player5 {}
class Player6 {}
class Player7 {}
class Player8 {}
class Player9 {}
class Player10 {}

Nice thing about this is I know I'll never have a memory leak and no errors will occur because there is no chance I get more than 10 players anyways

river oracle
#

otherwise I'll usually make it a singleton

#

or again if you want to go pure DI approach and feel the burn

slender elbow
#

with proper design, your plugin instance isn't even needed outside of platform hooks (listener registration etc)

river oracle
#

and its not very happy

coarse linden
#

lmao