#help-development

1 messages · Page 668 of 1

upper hazel
#

listen, if i read the entire backkit documentation in full, will i be able to write good plugins?

flint coyote
#

No

#

There's more to it

#

Knowing every engine and car type won't make you a good driver

upper hazel
#

I have 2 years of practice if that's what you mean

remote swallow
#

no

#

hes saying by knowing the entire bukkit api wont make you a better plugin developer

#

time making plugins and using the features and learning them as you need will

lilac dagger
#

which one is more readable?

#

to me they both look the same

flint coyote
#

ticks and 20 is pretty known, I'd say second

upper hazel
#

hell if I read the documentation I would make a plugin for spawning structures 2 times faster

mortal hare
#

first one if i was new to bukkit

flint coyote
#

faster != better

sterile breach
#

i think

flint coyote
#

Usually you learn a lot while coding. It's not like I got all my knowledge about best practices by constantly reading documentation and guides

upper hazel
#

but if there is practice, then it will definitely become better because you already know 50 percent how everything works

#

I spent a week on the plugin due to ignorance of damn 1 event like so

sterile breach
#

the most important thing for me is to acquire a certain programming logic, which I think you develop by coding.

upper hazel
#

But how do you like the idea of ​​​​taking 1st class at the docks and using it for practice, and so every time until the end?

#

teach class - practice - teach class - practice

sterile breach
#

yes, but I'm still a beginner in programming. I'm saying what I think I understand, but maybe that's not it.

tender shard
#

Nobody reads the docs, they are not a book lol

flint coyote
#

Also they are huge. If you think something you currently need could be part of the api, you google and find the docs (or not)

#

If still unsure you can always ask here

sterile breach
#

yes, we often understand better when we find forums with people who have already had our questions

flint coyote
#

I mean most of the time we even answer questions that could be answered if the person typed their question into google.

sterile breach
#

yeah

eternal oxide
#

?jd-bc

eternal oxide
#

and

#

?jd-bcc

sterile breach
#

is the same

#

i have a quesition with serverinfo.senddata. I've been looking for 3 days but I don't understand. serverinfo.senddata() sends a message plugin to all players on the server in question? or a random player on the server?

sullen marlin
#

random

#

can easily check the source to confirm

hushed spindle
#

im trying to use Class#getResourceAsStream but i seem to be unable to actually get to a resource in my jar file. I use this method on my main class which is located in Plugin/src/main/me.athlaeos.plugin. If I want to get a file in my resources folder which is in Plugin/src/main/resources. When I use getResourceAsStream I understand it attempts to find a file within the module the class is located in, and this would be Plugin I understand right? so the path to enter to go to that file in resources should be src/main/resources?

#

or would the modile in this case be me.athlaeos.plugin in which case i need to go up a folder first

remote swallow
#

getResourceAsStream("plugin.yml") for src/main/resources/plugin.yml

hushed spindle
#

yeah idk then it keeps saying it cant find the file

#

sec lemme try again

remote swallow
#

check the spelling

#

and run a clean build

sterile breach
hushed spindle
#

what do you mean with clean build? like remove targets?

remote swallow
#

mvn clean package

#

gradlew clean build

hushed spindle
#

still nothing

#

ill try something else

tender shard
#

getResourceAsStream("/skills/smithing.yml")

hushed spindle
#

god damn it

#

thank you alex ily

#

or jeff

remote swallow
#

any reason for not using JavaPlugin#getResource also

sullen marlin
tender shard
hushed spindle
twilit creek
#

Is it possible to send a Packet to the player that only plays the effect of an explosion but not the sound? (1.20)

tender shard
#

isn't the effect just a particle?

twilit creek
tender shard
#

there's spawnParticles for that

hushed spindle
#

Player#spawnParticle will display particles to only that player yeah

#

or do you want it to do damage and do knockback also

#

so just an explosion minus the sound

twilit creek
#

Oh i must think more simple. xD I try it.

kindred sentinel
#

how to clear player's server resourcepack?

sterile breach
tender shard
#

the NMS Explosion class has a method finalizeExplosion(boolean) that, when the boolean is false, does not play any sound

#

but bukkit doesn't seem to have a method for that

#

nvm I am stupid

#

what the heck is Level.isClientSide

twilit creek
echo basalt
#

when you're running a singleplayer world it creates an internal server

#

and sets that to true for some special special checks

tender shard
#

just spawn particles with either EXPLOSION_HUGE or EXPLOSION_LARGE or EXPLOSION_NORMAL.

tender shard
tender shard
echo basalt
#

I think there's some client-sided preditions that the client does

#

Like this for shears

tender shard
#

funny

#

why doesn't it just let the builtin server do that job lol

echo basalt
#

weird optimizations or it'd look clunky with predictions

#

There's also a class for debugging that's just left empty on the server

tender shard
#

yeah well but if the client "predicts" the explosion on a normal server, why not just also let the client "predict" it for the builtin server

echo basalt
#

network latency perhaps?

twilit creek
tender shard
#

vanilla uses HUGE for explosions greater than 2.0, otherwise it uses LARGE btw

echo basalt
twilit creek
tender shard
#

or when an entity steps on turtle eggs lol

twilit creek
tender shard
#

that's from PathfinderGoalRemoveBLock

#

idk where the "eggs" part comes from, I only read that in the craftbukkit comment

twilit creek
tender shard
#

found it - the zombie is the only entity that uses this goal, and they are having TURTLE_EGG in the constructor for that pathfinder goal

#

so it seems like zombies walk to turtle eggs on purpose and destroy them lol

#

i didnt know that

slender elbow
#

yeah they attract zombies

twilit creek
slender elbow
#

or, well, the other way around I guess lol

tender shard
#

what do zombies have against turtles

twilit creek
#

Ah i see, but it is a very low chance that this effect appears. I think only by the last egg.

remote swallow
twilit creek
#

They are both green haha

tender shard
#

true

twilit creek
#

This effect seams that they have a 10% chance to spawn this particles.

tender shard
#

Is it fine to name a main class Main (standalone application) lol

twilit creek
#

But they only hate the eggs not the turtle self.

slender elbow
#

sure

lilac dagger
#

i'm looking for a public repository to host my apis, which one is the best?

tender shard
slender elbow
#

central?

tender shard
#

Maybe i‘d also step on it

twilit creek
twilit creek
tender shard
twilit creek
river oracle
#

or plugins I do (PluginName)Plugin

twilit creek
river oracle
#

Spigot(Implementation)

twilit creek
remote swallow
#

CraftEvil

slender elbow
#

CraftMine

twilit creek
#

CraftCraft

tender shard
#

CraftCraftingTable implements CraftingTable

eternal night
#

can you ever craft enough

slender elbow
#

can you?

tender shard
#

can you?

eternal night
#

can you ever cast enough

tender shard
#

my neighbour's a craftman

#

a mason to be precise

slender elbow
#

NO

#

NO CASTING

eternal night
#

never

slender elbow
#

1.5s

eternal night
#

we hate casting

#

5mins got me to 9.7s

#

anyway, I can craft enough 💪

tender shard
eternal night
#

wtf

echo basalt
#

Ye

upper hazel
#

code debug?

#

tell me how you can get a specific block in the dungeon in AsyncStructureSpawnEvent. Relative what

near mason
#
public class Bone {
    private Vector start;
    private Vector end;
    private double length;
    
    public Bone(Vector start,Vector end ,double length){
        this.end = end;
        this.start = start;
        this.length = length;
    }
    
    public void moveTo(Vector target){
        double distance = target.distance(start)-length;
        end = target.clone().subtract(start).normalize().multiply(distance);
    }
    
    public Vector direction(){
        return end.subtract(start);
    }
    
    public Vector getStart() {
        return start;
    }
    
    public Vector getEnd() {
        return end;
    }
    
    public void apply(BlockDisplay disp){
        Transformation transformation = new Transformation(
                disp.getTransformation().getTranslation(),
                disp.getTransformation().getLeftRotation(),
                new Vector3f(1.0f, (float) this.length, 1.0f),
                disp.getTransformation().getRightRotation()
        );
        
        disp.setTransformation(transformation);
        disp.teleport(disp.getLocation().clone().setDirection(direction()));
    }
    
    public BlockDisplay summon(World world){
        Location loc = start.toLocation(world);
        BlockDisplay disp = loc.getWorld().spawn(loc, BlockDisplay.class);
        Transformation transformation = new Transformation(
                disp.getTransformation().getTranslation(),
                disp.getTransformation().getLeftRotation(),
                new Vector3f(1.0f, (float) this.length, 1.0f),
                disp.getTransformation().getRightRotation()
        );
        
        disp.setTransformation(transformation);
        disp.teleport(disp.getLocation().clone().setDirection(direction()));
        return disp;
    }
}
``` when i use apply(BlockDisplay) it throws IllegalArgumentException (pith not finite) how do i fix it?
remote swallow
#

how is a bone a block dispaly

near mason
#

😐

#

im trying to make procedural animations

#

and the block displays will be legs

remote swallow
#

ah

#

i getit

tender shard
#

so your math is weird

near mason
#

oof

#

i hate math 😭

unreal quartz
#

Probably a divide by zero somewhere

near mason
#

the only math is here```java
public void moveTo(Vector target){
double distance = target.distance(start)-length;
end = target.clone().subtract(start).normalize().multiply(distance);
}

public Vector direction(){
    return end.subtract(start);
}
#
public static HashMap<UUID, List<Bone>> boneMap = new HashMap<>();
    public static HashMap<Bone, BlockDisplay> displays = new HashMap<>();
    @EventHandler
    public void onMove(PlayerMoveEvent evt){
        final UUID uid = evt.getPlayer().getUniqueId();
        final Player pl = evt.getPlayer();
        
        if (!boneMap.containsKey(uid)){
            List<Bone> bones = new ArrayList<>();
            for (int i = 0; i <5; i++){
                bones.add(new Bone(pl.getLocation().toVector(), pl.getLocation().toVector(), 5));
            }
            
            boneMap.put(uid, bones);
            
            for (Bone bone: boneMap.get(uid)){
                displays.put(bone, bone.summon(pl.getWorld()));
            }
        }
        
        for (int i = boneMap.get(uid).size()-2; i>=0; i--){
            Bone bone = boneMap.get(uid).get(i);
            BlockDisplay display = displays.get(bone);
            if (i==boneMap.get(uid).size()-2){
                bone.moveTo(pl.getLocation().toVector());
            } else {
                bone.moveTo(boneMap.get(uid).get(i+1).getStart());
                bone.apply(display);
            }
        }
    }
``` maybe math is weird here?
glad prawn
opal juniper
#

if the magnitude is 0 then normalise throws that error

near mason
#

ohhhh yeah it is

#

tysm im_tptuaasn

lunar wigeon
#

hello

orchid trout
#

fleet :steamhappy:

tender shard
#

are you not extending JavaPlugin?

unreal quartz
#

I heard Fleet's diagnostic is a bit scuffed

tender shard
#

fleet was completely useless garbage when I last tried it, but that was months ago

unreal quartz
#

Such as showing errors where there shouldn't be

orchid trout
#

it compiles just fine lol

round finch
#

are you using maven or just a jar?

near mason
#

than IJ cant decompile the dependency

orchid trout
orchid trout
tender shard
#

fleet is just bad

orchid trout
#

im gonna have to switch back to eclipse

orchid trout
kindred sentinel
#

How to hide or remove command like /plugin-name:command
And leave only /command?

orchid trout
#

ill probably test out vs

near mason
#

did u reload pom?

tender shard
orchid trout
#

the ui is a lot like eclipse

round finch
#

hehe use notepad++

#

wait are we joking?

kindred sentinel
#

Oh ok thanks

orchid trout
#

the player will still be able to execute them right?

#

you would have to listen for commands if you want to disable that as well

kindred sentinel
#

I just want to disable tab completion of commands like /pluginname:command

orchid trout
#

ok

orchid trout
#

ahhh time to go back to eclipse

#

and burn my eyes out

kindred sentinel
#

What's wrong with intelij idea?

tender shard
#

try IntelliJ without the minecraft development plugin

orchid trout
#

i like having multiple projects on in the same window and intellij bsods me sometimes

#

i uninstalled it

#

pretty sure i was still crashing

tender shard
#

huh but IJ can do that

remote swallow
#

I would love fle eclipses file system in intellij

orchid trout
#

idk im just tired of ij a bit

tender shard
#

but weridly only when it's on fullscreen

kindred sentinel
#

When i was trying to do something with Eclipse it was too uncomfortable..

orchid trout
#

eclipse's ui is ass

tender shard
#

yeah but IJ's new UI is also shit

kindred sentinel
#

But we don't have any replacement except intelij idea & eclipse

orchid trout
#

ij is a grey spot in my mind so i cant comment

mortal hare
#

i wonder right now, does java prehash records so that hashcode() would return the same hash code internally without having it to compute everytime

near mason
mortal hare
#

seems like a cheap way to optimize hash based objects

orchid trout
tender shard
near mason
#

idk

#

but it cool

orchid trout
#

you have to hover over everything to get a vague idea on what it does

orchid trout
#

when hand eye coordination at 5am fails on you

mortal hare
kindred sentinel
mortal hare
#

i dont get the hate for new ui

tender shard
#

I explained it already, its a waste of space

#

And many buttons are gone

mortal hare
#

the only thing i dont like in new ui is this glint

orchid trout
#

you went from seeing 70 classes to 60 or something right?

mortal hare
orchid trout
#

he talked about that too

tender shard
mortal hare
tender shard
mortal hare
#

its a waste of space right?

tender shard
#

I dont use the desktop

#

I press cmd+space

mortal hare
#

i prefer new ui since you could easily more focus on the code

near mason
#

new ui better

tender shard
mortal hare
orchid trout
#

i dont know what any of those buttons do

mortal hare
#

that were provided there

#

i prefer context menus, at least they tell me what they briefly do

tender shard
mortal hare
#

not all of them

tender shard
#

all this is useless. I mean, why don't they at least get rid of this bar completely then

#

the editor window could at least be bigger then

#

now it just displays a completely empty thing

mortal hare
#

well that's correct

#

maybe they will change it

tender shard
#

the git buttons are also all gone

#

push, pull, ...

mortal hare
#

version control button exists

#

where you access everything

tender shard
#

where is that?

mortal hare
tender shard
#

there is neither a push nor a pull button in that menu

#

they have moved it into the menu at the top so you now need an extra click. and it's also the only useful button in that whole unused bar at the top

mortal hare
tender shard
#

why are you not using maven or gradle?

orchid trout
#

i hate eclipse mostly because i just click a random button and my project explorer, problems or something else just disappears and i have to spend a few minutes clicking random buttons for it to reappear

unreal quartz
tender shard
#

you should use maven, otherwise nobody can clone your project without manually setting up a thousand things

tender shard
orchid trout
#

what does jeff-media do

unreal quartz
#

oh

mortal hare
#

yea you should use either maven or gradle, since those can store your build setup for the next contributor or cloner

tender shard
mortal hare
#

trust me its better than what i've saw here before 😄

orchid trout
#

i will apply to work at jeff-media when i turn 18

tender shard
#

we're already full

orchid trout
#

will you still be full in 3 years?

mortal hare
#

damn mfnalex

#

its so hard to read your website for me

tender shard
#

how so

mortal hare
#

those bordered white edges literally makes my eyes out of focus

tender shard
#

huh

orchid trout
#

ultrawide issue

tender shard
#

idk I didnt make that website lol

mortal hare
#

oh

#

i always thought you are managing it

#

😄

tender shard
#

yeah well but I didnt do the website

mortal hare
tender shard
#

the blog uses a bought theme

orchid trout
#

those are fine

mortal hare
#

on my monitor they're like flashbangs

#

at night

tender shard
#

idk if the main website theme is also bought or whether one of the other dudes made it

mortal hare
#

it just not comfortable to focus

tender shard
#

all I remember is that the blog theme costed like 100€

mortal hare
#

grayish borders would be better imo

tender shard
#

if I could decide, the blog wouldn't even use dark mode

#

visit the blog again now

#

this is how I'd make it look

#

i never understood why everyone is so obsessed with dark mode lol

orchid trout
#

if your brightness is at 100 and you hate the sun then dark mode is fantastic

near mason
#

how to place features with spigot like /place feature birch?

tender shard
#

what features are there? for trees there's World#generateTree

lunar wigeon
#

use spigot api

sullen copper
#

hey i have a little question, i'm developing a minigame server and i'm on bedwars and skywars i had a question the best is to make a world by map with multiverse core or everything on the same one and best for optimization ?

quaint mantle
#

javasockets

near mason
#

bungee cord

sullen copper
lunar wigeon
sullen copper
#

ok thanks i will look into this

lunar wigeon
#

also nats but sockets are built in java

ivory sleet
#

If you wanna scale on it def use a more sophisticated service like rabbit or kafka

quaint mantle
#

how would i go about changing a user's skin? cant find any tutorials on it or gameprofiles online

pseudo hazel
#

doesnt really sound like something you can do easily if at all

tender shard
#

the player info packet includes the skin

#

it won't work for yourself, ofc

#

and you'll need signed texture data

#

so yeah ClientboundPlayerInfoPacket is what you'll need I guess

simple schooner
#

E

#

Good morning chat

quaint mantle
#

is playerconnectionvar.a() the correct syntax for sending packets

tender shard
#

the correct way is Connection#send(Packet<?>)

young knoll
#

Obfuscated NMS

#

🤮

tender shard
#

yeah I'd rather change my underwear than using obfuscated mappings

quaint mantle
sweet sonnet
#

I keep getting this god damn warning

[13:12:05 WARN]: Nag author(s): '[SnowzNZ]' of 'SnowReports v1.1' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).

Use in my code:

getLogger().info("Discord Integration is enabled but webhook-url is not set!");
tender shard
tender shard
#

if it doesn't exist, that means you're not using mojang mappings, although you should

sweet sonnet
#

it didnt use to happen

tender shard
#

it will not happen on spigot

#

you're using paper

#

anyway, what is getLogger()? your plugin's logger?

sweet sonnet
#

org.bukkit.plugin.java.JavaPlugin getLogger()

tender shard
#

idk then. but as said, this message is from paper, not spigot

young knoll
#

You should be able to see the sysout message right above it

sweet sonnet
#

Theres nothing

#

just some debugging stuff for sqlite which im not using getLogger for

#

🤦‍♂️ thats why

young knoll
#

We need a rubber duck emoji

tender shard
young knoll
#

Perfect

#

Md plz

#

We can do proper rubber duck debugging

lunar wigeon
#

fuck ducks only coconuts 🥥

slender elbow
#

no don't fuck ducks

lunar wigeon
#

but coconuts better

placid moss
#

do you fuck coconuts wtf

#

is that normal

rough ibex
#

reddit reference

tender shard
#

"and then it should work"

tender shard
orchid trout
#

Kills: 1, Kills: %kills%, Kills: %kills%, Kills: %kills%, Kills: %kills%, Deaths: %deaths%, Deaths: 5, Deaths: %deaths%, Deaths: %deaths%, Deaths: %deaths%, Streak: %streak%, Streak: %streak%, Streak: 0, Streak: %streak%, Streak: %streak%, Gems: %gems%, Gems: %gems%, Gems: %gems%, Gems: 3, Gems: %gems%, Combat: %timer%, Combat: %timer%, Combat: %timer%, Combat: %timer%, Combat: 0 thats the output, why does it duplicate it so much?

#

also tell me if there is a better way to do this

tender shard
#

you loop over all lines and then add 5 lines everytime

orchid trout
#

oh right

#

thanks

tender shard
#
for(String line : translatedLines) {
  linesWithStats.add(
    line.replace("%kills%", kills)
        .replace("%deaths%", deaths)
        .replace("%whatever%", whatever)
  );
}

sth like this

hardy shell
#

hi

#

any idea why when I serialize a item stack to byte array and then deserialized it back to a itemstack it changes the lore?

orchid trout
orchid trout
#

code

hardy shell
#

sec

#

byte[] serialized = player.getInventory().getItemInMainHand().serializeAsBytes();

#

just adds it sqlite db for later use

orchid trout
#

uh

#

i serialize it differently

young knoll
#

I think that’s a paper method

#

👀

orchid trout
#

uh oh

hardy shell
#

yea

orchid trout
#

anyways

hardy shell
#

how do you do it?

orchid trout
#
try {
            ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(base64));
            BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
            ItemStack[] items = new ItemStack[dataInput.readInt()];
            for (int i = 0; i < items.length; i++) {
                items[i] = (ItemStack) dataInput.readObject();
            }
            dataInput.close();
            this.items = items;
        } catch (ClassNotFoundException | IOException e) {
            e.printStackTrace();
            this.items = null;
        }```
#

serialize ^

hardy shell
#

i need byte arrays 😦

orchid trout
#
        try {
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);

            dataOutput.writeInt(items.length);

            for (ItemStack item : items) {
                dataOutput.writeObject(item);
            }

            dataOutput.close();
            return Base64Coder.encodeLines(outputStream.toByteArray());
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }```
#

uh

echo basalt
#

remove the base64 stuff

orchid trout
#

oh yeah

hardy shell
#

do i have image perms here?

orchid trout
#

?verify

#

?link

hardy shell
#

swag

orchid trout
#

you need to verify

hardy shell
#

ill do later

#

its weird what happens though

orchid trout
#

you can use imgur

hardy shell
#

ight sec

#

so thats the item before serialization

#

then thats after its been retreived from the database

orchid trout
#

paper issue

hardy shell
#

yea figured

wary topaz
#

rs = LobbyManager.sqlCon.createStatement().executeQuery("USE Players; SELECT Lang FROM 'PlayerData' WHERE UUID = '?';");

How could I replace the ? with a string

hardy shell
#

does paper have a bug report?

orchid trout
#

probably

#

go to their website

hardy shell
#

ight appreciate the help.

orchid trout
wary topaz
#

tyvm

orchid trout
#

simplest and easiest fix

hardy shell
#

duly noted

wary topaz
#

how do I get a prepared statement from a connection?

abstract sorrel
#

does anyone know how i would create an effect similar to how the treecapitator works on hypixel skyblock: where if i mine a block it will iterate over the connected blocks of the same type and break them

echo basalt
#

Flood fill

orchid trout
#

try (PreparedStatement preparedStatement = connection.prepareStatement("USE Players; SELECT Lang FROM 'PlayerData' WHERE UUID = '?';")) {
}

echo basalt
#

.

quaint mantle
#

what's the correct repository for remapped mojang
this works

            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
this doesn't work
```        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>```
wary topaz
#

tyvm

orchid trout
#

?mappings

undone axleBOT
orchid trout
#

uh

wary topaz
#

PreparedStatement preparedStatement = LobbyManager.sqlCon.prepareStatement("USE Players; SELECT Lang FROM 'PlayerData' WHERE UUID = ?;");
preparedStatement.setString(0, playerUUID.toString());

Cannot resolve query parameter '0'

orchid trout
#

there is no 0

#

put 1

wary topaz
#

Cannot resolve query parameter '1'

orchid trout
#

remove use players;

wary topaz
#

oh yeah thats right

#

thank you good sir

vapid grove
#

Is there a way I can add custom items to loot chests for a specific structure?

#

Using ChunkPopulateEvent perhaps?

#

Or is there a way I can just eedit the loottables of a specific strucutre via a plugin

vapid grove
young knoll
#

Get the loot table and then get its Namespaced key

vapid grove
quaint mantle
#

why, when using remapped mojang, does nms not work?

river oracle
#

?nms

river oracle
#

follow this tutorial to use nms

wary topaz
#

https://paste.md-5.net/lomebihano.sql
public static String getMessage(UUID playerUUID) { String language = null; ResultSet rs = null; try { PreparedStatement preparedStatement = LobbyManager.sqlCon.prepareStatement("SELECT Lang FROM PlayerData WHERE UUID = ?"); preparedStatement.setString(1, playerUUID.toString()); while (rs.next()) { language = rs.getString("Lang"); } return language; } catch (SQLException e) { throw new RuntimeException(e); } }

#

why is language null?

quaint mantle
glad prawn
wary topaz
wary topaz
#

?

#

I did

river oracle
#

?bt

undone axleBOT
wary topaz
#

do I put it in a specific folder or smthing?

quaint mantle
# river oracle what errors

remapped mojang builds fine but i get errors like

[ERROR]   symbol:   class PlayerConnection
[ERROR]   location: package net.minecraft.server.network``` as i can't access net.minecrat.server anymore
river oracle
#

show your pomxml

river oracle
#

use java 17 first off

#

its just a nickpick, but you should be using java 17 with later minecraft versions

river oracle
#

also you sohuld beable to just reload your project and it should work

quaint mantle
wary topaz
river oracle
#

spigot has PlayerProfile API now

quaint mantle
#

oh

river oracle
river oracle
#

if that doesn't work invalidate caches

river oracle
#

what command did you use to run buildtools

wary topaz
#

java -jar BuildTools.jar --rev 1.20.1

river oracle
#

are you trying to make remapped or just create a server jar

wary topaz
#

remapped

river oracle
#

you need the remapped flag

#

the gui will be easier for you one second

#

delete all old BuildTools related folders created from past runs

#

download that jar file

wary topaz
#

tyvm

river oracle
#

select you're version from the drop down

#

in options tab click generate remapped jars

#

go back to general and click compile then wait. A menu will popup when build tools has finished

quaint mantle
wary topaz
river oracle
# wary topaz

did you delete all BuildTools related directories as I said

#

etc Work, Spgiot, BuildData, Bukkit, CraftBukkit, build etc

wary topaz
#

no

river oracle
#

do that

#

then rerun build tools

wary topaz
#

alr

quaint mantle
river oracle
#

close the gui before you do that then reopen

river oracle
wary topaz
#

alr its loading

quaint mantle
opal carbon
#

just 17

quaint mantle
#

mb yea 17

opal carbon
#

what is the error lol

#

also not enough args

#

i think

river oracle
#

?jd-s

undone axleBOT
opal carbon
#

im pretty sure it needs at least location float

river oracle
#

you should probably learn java

opal carbon
#

you need to specify the blast power

river oracle
#

or atleast learn how to utilize your IDE properly

opal carbon
#

💀

opaque scarab
#

Is there an event that triggers when a player loads in a chunk already loaded? What I mean is, for example, if player B was in a loaded chunk, and player A just got the chunk in their render distance. Is there a way to efficiently detect when a player gets a new chunk sent to the client?

opal carbon
#

are you suuuure you know how to read javadocs

opal carbon
#

mqestical

#

use them

#

they are a resource

river oracle
#

what IDE do you use

#

your IDE gives you autocomplete read it :P

opal carbon
#

this is the exact sort of thing javadocs could have helped with

#

that too

#

this is the second day in a row you have suffered from a javadocs solvable issue

quaint mantle
river oracle
opal carbon
#

oh god not again

#

nah its chill im kiddin

#

but yeah if you are confused about how to get info from a class

#

or how to run a method

quaint mantle
opal carbon
#

or what params it needs

#

javadocs coulda helped with knowing how to get the damage cause yesterday and what parameters you needed just now

river oracle
opal carbon
#

pls use them before asking here from now on lol

opal carbon
quaint mantle
opal carbon
#

intellij

#

close it

#

and reopen it

#

before trying y2ks thing

quaint mantle
#

still nothing changes

opal carbon
#

after restarting intellij?

quaint mantle
#

yea

opal carbon
#

wait send your dependencies

quaint mantle
#
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.20.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
    </dependencies>```
bitter rune
#

https://imgtr.ee/image/bcM7j is there a better way to do this? I recall you can make a list or two lists, and one list says the block the other list says how much it increases the double.

opal carbon
#

when reloading

#

the project

quaint mantle
#

rebuilding or reopening?

opal carbon
bitter rune
#

I will google, thank you

opaque scarab
#

Does anyone know of good resources for listening to packets sent out from the server? The problem is I need to use the mojang remappings.

quaint mantle
opal carbon
quaint mantle
#

yep

opal carbon
#

and you reloaded and have no errors

quaint mantle
#

i don't get any maven errors, just project errors

opal carbon
#

and you closed and reopened intellij and it sfill doesnt show

opaque scarab
opal carbon
bitter rune
#

switch statement isnt what i remember but its more neat than what I am doing so i will use it instead. Thanks!

opal carbon
#

the other stuff might not be now that i think abt it

#

ill send you an example from my own ckde

quaint mantle
opal carbon
# opaque scarab This tutorial works with the mojang remappings?
public class Glowing {

    private final JavaPlugin plugin;
    private final HashMap<UUID, PacketListener> listenerMap = new HashMap<>();

    public Glowing(JavaPlugin plugin) {
        this.plugin = plugin;
    }

    public void glow(Player user, Player badGuy){
        PacketListener listener = listenerMap.get(user.getUniqueId());
        if (listener == null) {return;}
        listener.addGlowing(badGuy);

        ServerPlayer itemUser = ((CraftPlayer)user).getHandle();
        ServerPlayer badBoi = ((CraftPlayer)badGuy).getHandle();

        badBoi.getEntityData().refresh(itemUser);

        new BukkitRunnable() {
            @Override
            public void run() {
                listener.removeGlowing(badGuy);
                badBoi.getEntityData().refresh(itemUser);
            }
        }.runTaskLater(plugin, 100);

    }

    public void startListener(Player p) {
        PacketListener handler = new PacketListener();
        listenerMap.put(p.getUniqueId(), handler);

        ((CraftPlayer)p).getHandle().connection.connection.channel.
                pipeline().addBefore("packet_handler", p.getName() + "-skyglow", handler);
    }

    public void stopListener(Player p) {
        listenerMap.remove(p.getUniqueId());

        Channel channel = ((CraftPlayer)p).getHandle().connection.connection.channel;
        channel.eventLoop().submit(() -> channel.pipeline().remove(p.getName()+"-skyglow"));
    }
}
#

obviously it wont do the exact thing u want rn

#

but you can sorta see whats goin on

#
public class PacketListener extends ChannelDuplexHandler {

    private final HashSet<Integer> players = new HashSet<>();

    public void addGlowing(Player p) {
        players.add(((CraftPlayer)p).getHandle().getId());
    }
    public void removeGlowing(Player p) {
        players.remove(((CraftPlayer)p).getHandle().getId());
    }
    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        if (!(msg instanceof ClientboundSetEntityDataPacket packet)) {super.write(ctx, msg, promise); return;}
        if (!players.contains(packet.id())) {super.write(ctx, msg, promise); return;}
        List<SynchedEntityData.DataValue<?>> values = packet.packedItems();
        byte bitMask = 0;
        boolean adjusted = false;
        for (Iterator<SynchedEntityData.DataValue<?>> it = values.iterator(); it.hasNext(); ) {
            SynchedEntityData.DataValue<?> value = it.next();
            if (value.id() != 0) {continue;}
            bitMask = (byte) value.value();
            bitMask |= 0x40;
            it.remove();
            adjusted = true;
            break;
        }
        if (adjusted) {values.add(new SynchedEntityData.DataValue<>(0, EntityDataSerializers.BYTE, bitMask));}
        super.write(ctx, msg, promise);
    }

}
#

the listener itself

#

the startlistener, stoplistener, and the packetlistener is the important stuff

#

sorry for text wall

wary topaz
opal carbon
#

it means that multiple jars have a manifest.mf

#

and its only gonna use one

#

for spigot plugins it basically means nothing

wary topaz
#

how can I remove the warning though? its annoying

opal carbon
#

well the manifest.mf

#

means nothing

#

the other stuff could possibly be more concerning

opaque scarab
opal carbon
#

not sure if that helps you but overall again the main thing you really need to understand is the ChannelDuplexHandler and the start/stop listener code

#

i will say my handler only uses "write" so only when a packet is sent does it detect it

#

for incoming packets use the "channelRead" method

#

similar overall concept in that case where you can use instanceof to differenciate and act on it

#

the reason i call super.write before returning in all the spots where i return is if you return WITHOUT calling that it wont actually write the packet

#

same thing for super.channelRead if you are reading packets, the server will basically not know the packets exist if you return without calling super.channelRead

orchid trout
#

it returns the usage when i run the command

#

when there is no return false

quaint mantle
opal carbon
#

what exact command did you run in buildtools

quaint mantle
orchid trout
#

did you watch the guide i sent you rye?

wary topaz
#

this is frustrating

opal carbon
orchid trout
quaint mantle
orchid trout
#

preparedStatement.executeQuery(); returns result set pretty sure

orchid trout
wary topaz
#

alr and then what about setmessage

quaint mantle
orchid trout
#

what are you trying to do?

wary topaz
#

set args[0] to the string in sql

orchid trout
#

just do execute()

#

not executeQuery()

quaint mantle
orchid trout
#

i dont think that that's mojang's mappings

#

can you put import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer;

#

in your imports

opal carbon
#

is it not showing in autocomplete

#

i thought that was the issue

wary topaz
#

okay the set works but the get doesnt

#
public static String getMessage(UUID playerUUID) {
        String language = null;
        try {
            PreparedStatement preparedStatement = LobbyManager.sqlCon.prepareStatement("SELECT Lang FROM PlayerData WHERE UUID = ?");
            preparedStatement.setString(1, playerUUID.toString());
            ResultSet rs = preparedStatement.executeQuery();

            while (rs.next()) {
                language = rs.getString("Lang");
            }
            return language;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }```
opal carbon
#

i thought the issue was seeing nothing in autocomplete

quaint mantle
wary topaz
#
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.IllegalArgumentException: message cannot be null
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
        at org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer.sendRawMessage(CraftPlayer.java:317) ~[paper-1.20.1.jar:git-Paper-108]
        at org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer.sendRawMessage(CraftPlayer.java:312) ~[paper-1.20.1.jar:git-Paper-108]
        at org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer.sendMessage(CraftPlayer.java:329) ~[paper-1.20.1.jar:git-Paper-108]
        at me.lobbymanager.commands.testcmd.onCommand(testcmd.java:29) ~[Lobbymanager-1.1.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.20.1-R0.1-SNAPSHOT.jar:?]
        ... 23 more
opal carbon
orchid trout
#

maybe intellij isnt set to your local maven repository

wary topaz
#
public```
opal carbon
wary topaz
#

it does

opal carbon
#

are you suuuuure

wary topaz
quaint mantle
opal carbon
orchid trout
#

where does buildtools install your spigot jar

opaque scarab
quaint mantle
wary topaz
orchid trout
#

@wary topaz i suggest using completablefutures if you are going to be saving to mysql while there are players online

wary topaz
#

huh?

wary topaz
#

why?

opal carbon
wary topaz
#

why not run it on a new thread?

opal carbon
#

why use a thread lol

opal carbon
wary topaz
#
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class LobbyManager {

    private static Executor databaseExecutor = LobbyManager.sql
    public static java.sql.Connection sqlCon; 

    public static CompletableFuture<String> getMessage(UUID playerUUID) {
        return CompletableFuture.supplyAsync(() -> {
            String language = null;
            try {
                PreparedStatement preparedStatement = sqlCon.prepareStatement("SELECT Lang FROM PlayerData WHERE UUID = ?");
                preparedStatement.setString(1, playerUUID.toString());
                ResultSet rs = preparedStatement.executeQuery();

                while (rs.next()) {
                    language = rs.getString("Lang");
                }
                return language;
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }, databaseExecutor);
    }

    public static CompletableFuture<Void> setMessage(UUID playerUUID, String msg) {
        return CompletableFuture.runAsync(() -> {
            try {
                PreparedStatement preparedStatement = sqlCon.prepareStatement("UPDATE PlayerData SET Lang = ? WHERE PlayerData.UUID = ?");
                preparedStatement.setString(1, msg);
                preparedStatement.setString(2, playerUUID.toString());
                preparedStatement.execute();
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }, databaseExecutor);
    }
}
orchid trout
#

dont shorten language to lang

wary topaz
#

why not?

orchid trout
#

and its supposed to be lowercase

#

as with the playerdata.uuid

#

just name it uuid

orchid trout
wary topaz
orchid trout
#

oh

#

i dont use mysql sorry

opal carbon
#

ohhhhhh

orchid trout
#

but its still supposed to be lowercase

opal carbon
worldly ingot
#

A CF is totally fine lol

#

The scheduler uses threads too

slender elbow
#

i think you're lying

worldly ingot
#

wtf rude

slender elbow
worldly ingot
#

Why would I lie 🥺

orchid trout
opal carbon
#

they both work

quaint mantle
wary topaz
#

Message.getMessage(player.getUniqueId()).thenAccept(player::sendMessage);

orchid trout
quaint mantle
orchid trout
#

what

wary topaz
#

Message.getMessage(player.getUniqueId()).thenAccept(player::sendMessage);

#

why it doing this

#

im not getting any message sent

quaint mantle
# orchid trout what

you were talking about my local maven repository and then asked where my buildtools spigotjar was located

orchid trout
#

buildtools puts a jar in a maven repository

#

if your intellij isnt set to that maven repository then it wont work

quaint mantle
#

o

#

i think it's the right repository

worldly ingot
#

thenAccept() just won't run if an exception is thrown and nothing will be shown to console. I suggest using whenComplete() if you want to handle the error

#
Message.getMessage(player.getUniqueId()).whenComplete((language, e) -> {
    if (e != null) {
        e.printStackTrace();
        return;
    }

    player.sendMessage(language);
});```
#

You might just have some malformed SQL or something and it's being hidden by your CF

orchid trout
#

please

orchid trout
#

sfd

quaint mantle
#

nms is working but i don't have things PlayerConnection

river oracle
#

you'd be looking for using ServerGamePacketListenerImpl

#

you can obtain it by getting ServerPlayer using CraftPlayer#getHandle() then using ServerPlayer#connection

quaint mantle
#

oooh, alright, and then i have the .send() to send packets. tysm!

opaque scarab
#

How can I convert a chunk to a LevelChunk?

river oracle
#

whether they are exposed or not

#

Chunk -> CraftChunk which has a handle for LevelChunk

#

usually the handle is in a #getHandle method

#

there are some weird cases where some bukkit classes don't always have to be their Craft equivalent, this is common with ItemStacks so just be aware

opaque scarab
river oracle
#

idk look at CraftBukkit source and see what its used for

#

?stash

undone axleBOT
river oracle
#

I was making a PR i'll see since I have my IDE open this time

river oracle
#

fuck around with it tbh

quaint mantle
#

I did ChunkStatus.FULL

#

And it works in the past

#

not sure what you are trying to do but I believe it accesses the full chunk as opposed to chunk columns maybe??

#

Thats what I would guess

orchid trout
river oracle
#

ChunkStatus.BIOMES, ChunkStatus.STRUCTURES

opaque scarab
#

ClientboundLevelChunkWithLightPacket is the packet to send chunk blocks right?

quaint mantle
#

yes

river oracle
#

ohhh fake blocks are fun :P

quaint mantle
#

I wrote an entire system for tehem

river oracle
#

you can do some pretty crazy stuff with fake blocks

quaint mantle
#

butnits so messy

#

its so aids

river oracle
#

I believe Illusion has a pretty good fakeblock thing that he made

quaint mantle
#

I was making a per player prison mine system all in the same error

opaque scarab
#

Alright. My end goal is to listen for said packet, and edit the blocks. How can I do this?

quaint mantle
#

but I had soem issues with concurrency and the way I handled stuff (Using packet events)

river oracle
quaint mantle
#

PacketEvents is real nice

river oracle
quaint mantle
#

I think protocollib has stuff for listesning to recieving packets

#

and sending

river oracle
#

I'd prob use PacketEvents if I ever did have to do that stuff

opaque scarab
#

Can I use ChannelDuplexHandler?

quaint mantle
#

Just use some sort of wrapper

#

you will save yourself so much time

opaque scarab
#

Wdym

quaint mantle
#

like use protocollib or packet events if u are trying to ujse packets

#

trying to set the player's skin with playerprofiles. when i execute this, the first time i got. there are no errors but i can visibily see on tab i was removed, but i don't get added back.

ServerPlayer plyr = ((CraftPlayer)player).getHandle();

plyr.connection.send(new ClientboundPlayerInfoRemovePacket(List.of(((CraftPlayer)player).getUniqueId())));
profile.getTextures().setSkin(new URL("http://textures.minecraft.net/texture/b3fbd454b599df593f57101bfca34e67d292a8861213d2202bb575da7fd091ac"));
plyr.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, plyr));```
opaque scarab
#

This is a really weird way, but what if I get the X and Y of the chunk in the packet to be sent. Then I get the chunk from the world, provided the coordinates, and copy it, then edit the contents. Afterwards, I create a new packet with the updated chunk. Does this seem like a good way?

eternal oxide
sweet sonnet
#

is it good practice to specify a default when getting a value from the config? e.g
config.getString("discord-integration.embed.title", "Report")

quaint mantle
# quaint mantle trying to set the player's skin with playerprofiles. when i execute this, the fi...

edited it to this

GameProfile profile = plyr.getGameProfile();
plyr.connection.send(new ClientboundPlayerInfoRemovePacket(List.of(player.getUniqueId())));
profile.getProperties().removeAll("textures");
profile.getProperties().put("textures", getSkin());
plyr.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(plyr)));```
the skin changes on the tab, but i have to relog on other accounts for the actual skin to update. and the skin never updates on the account im changing the skin of. what would i have to do to fix this so it auto updates for everyone?
eternal oxide
#

you have to send the update to all players

quaint mantle
#

oh, how do i do that

#

ohh

eternal oxide
#
        for (Player otherPlayer : Bukkit.getOnlinePlayers()) {
            ServerGamePacketListenerImpl connection = ((ServerPlayer) NMSUtils.getServerPlayer(otherPlayer)).connection;
            
            connection.send(playerInfoRemove);
            connection.send(playerInfoAdd);

            if (player != otherPlayer) {
                connection.send(new ClientboundRemoveEntitiesPacket(serverPlayer.getId()));
                connection.send(new ClientboundAddPlayerPacket(serverPlayer));
            }
            connection.send(setEntityData);                // dual layered skin.
        }```
quaint mantle
#

i have to send both of the packets to all players?

river oracle
#

anything can be a command sender right?

#

pretty sure that's how entities work internally

quaint mantle
eternal oxide
#

yes they can

#

you have to send a respawn packet to the player for their own skin

#

you have to do a few things to perform a skin change

#

things like inventory and op break

#

?paste

undone axleBOT
eternal oxide
quaint mantle
# eternal oxide <https://paste.md-5.net/jidexatemo.java>

tysm, almost done, but i'm getting an error on my respawnpacket

                plyr.getCommandSenderWorld().dimensionTypeId(),
                plyr.getCommandSenderWorld().dimension(),
                plyr.getCommandSenderWorld().getWorld().getSeed(),
                plyr.gameMode.getGameModeForPlayer(),
                plyr.gameMode.getPreviousGameModeForPlayer(),
                plyr.isReducedDebugInfo(),
                isFlat,
                (byte) 1,
                plyr.getLastDeathLocation()));```
it matches the constructor so i don't know why it's saying cannot resolve constructor
quaint mantle
#

how do i work hibernate with hikaricp ?

quaint mantle
#

I store a map of the Players UUID and then a map of Location Block

quaint mantle
#

is Bukkit.getworld case sensitive?

eternal oxide
#

all worlds are indexed to lowercase

orchid trout
#

why

quaint mantle
#

i put "World" inside bukkit.getworld not "world" is that my problem

eternal oxide
#

probably not

drowsy helm
eternal oxide
#

it shoudl lower case for searching

drowsy helm
#

Or you forgot to compile

orchid trout
#

i didnt

#

i saved

#

maven package

#

3 times

eternal oxide
#

clean then build again

drowsy helm
#

Decompile it and see what the code looks like

orchid trout
#

omg im stupid

#

i compiled the wrong project

drowsy helm
#

Lol

quaint mantle
#

am i need hikaricp ?

bitter rune
#

how long is 180000l?

zealous osprey
#

I assume that's in ticks. So: 180_000 ticks / 20 = 9_000 seconds
Since there are 20 ticks in a second

bitter rune
#

Okay so it was right 15 minutes just seems like forever because I'm tired. I celebrated making the presidents list by finishing the project I was working on on Minecraft... Everything works just... It takes a minute

remote swallow
quaint mantle
quaint mantle
#

and it hosts my database username and password

drowsy helm
#

Hikari should support hibernate out the box

#

Theres a special class you need to use iirc

quaint mantle
#

actually i ask chatgpt

#

and showed

#

btw i can't import

#

sessionfactory

#

at new versions

#

why =

upper hazel
#

what api can be used for mysql to make it convenient? Is there a popular optimized api?

eternal night
#

jooq is pretty nice

upper hazel
#

i can use this in bukkit api?

#

i mean not will crush server?

placid moss
#

database access shouldnt be on server thread anyways

#

so it shouldnt affect the server speed that much

upper hazel
#

pool connection

eternal night
#

well yea

#

hikari is a very common sql pooling lib

upper hazel
#

jood end hikari hah

#

it just infuriates me to write requests on a bare JBDC

opal carbon
#

damn

#

what did jbdc do to you

upper hazel
#

need to spend a lot of time

opal carbon
#

never had issues with jdbc personally but to each their own ig

upper hazel
#

the problem is not in the JBDC itself, but in the fact that it takes a long time to write requests and is cumbersome

#

cumbersome

#

I have 1 database class takes an hour while writing code

opal carbon
#

oh well could just be that im not exactly a sql magician anyways so havent done any crazy fancy requests

upper hazel
#

all this optimization and so on

#

so jood or hakari is better

eternal night
#

two different things

#

one is a connection pool

opal carbon
#

(hikari)

upper hazel
#

pool?

eternal night
#

hikari is responsible for pooling SQL connections

#

so you don't open and close them all the time

#

but properly reuse them

#

JOOQ is a helper utility for writing the SQL

near mason
#

how to place a villager house to a location?

upper hazel
near mason
#

so there is not a built-in way

#

ok

upper hazel
#

i try but not was find

#

demm this english hard for me

grizzled oasis
#

Something im trying fixing

Event: https://paste.md-5.net/amaceyeyir.cs
runner: https://paste.md-5.net/woruqipoqu.cs

This code is used for checking a pickaxe and giving it the correct EXP so like a leveling system but showing on the bar for checking i used the PlayerLevelChangeEvent, the problem comes when I'm switching when i switch from something i have my EXP (40LVL) but in the pickaxe, i have 2 levels so my plugin gives the reward and everything to the other user

(Fixed)

near mason
#

extracted structures from minecraft 1.20.1 jar and i'Ll load them

near mason
#

i dont understood platte in Structure.place

eternal oxide
#

use 0 as default

#

I don;t know any which have more than one palette

near mason
#

ok thank you

upper hazel
#

what is the name of the section of Spring working with the database and what dependencies are needed?

drowsy helm
#

Hibernate?

near mason
#

im trying to add houses but some of houses are broke like this

upper hazel
#

ahaha

grizzled oasis
#

just a question, i imported the vault api and then "cannot find symbol" just appeared, its not only in the Vault Api but on class inside the project like other classes im trying to import (im using intellij last Ultimate)

near mason
#

and there are jigsaw blocks

grizzled oasis
remote swallow
#

im gonna hope maven or gradle

upper hazel
grizzled oasis
remote swallow
remote swallow
grizzled oasis
remote swallow
#

wait a minute, its probably still downloading or jitpack is down

#

?paste ur pom

undone axleBOT
grizzled oasis
#

here

#

cannot find symbol is showing on classes inside the project so i don't think the pom is really giving problems

#

because importing it works fine

remote swallow
#

invalidate caches and restart

grizzled oasis
#

tried

#

not working

#

let me try again

#

nope

#

same

remote swallow
#

jitpack isnt down if invalidating caches didnt work no idea what the issue is

grizzled oasis
#

ok intellij is strange

#

if i import it calling the main class it works but calling it with import static no (im using lombok)

#

wtf

#

ok it works, so wtf happened is strange but thanks it works

pine forge
#

How can i remove all players from a luckperms group?

clear elm
#

Hey can anyone make a plugin lien I wanted not custom you can put in on your spigotmc page

mighty crane
#

Hey there! I'm making a command that summons an entity but cant find anything on how to do that.
can somebody please help explain how I can set the type of entity?

lilac dagger
#

Creeper creeper = world.spawn(location, Creeper.class);

remote swallow
#

if you need to modify the creeper use the consumer method

lilac dagger
#

yup
Creeper creeper = world.spawn(location, Creeper.class, creeper -> {
creeper.doStuffHere();
});

#

it'll set before it is spawned

#

so you don't see the changes happening

cunning osprey
#

why does this code not work? when i right click no event happens i get no errors in console and i registerd it in the main class


import org.bukkit.ChatColor;
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;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.sveaty.items.coustumitems.ItemManager;

public class onRightClick  implements Listener {
    @EventHandler
    public void OnRightClick(PlayerInteractEvent e) {
        if (e.getAction() == Action.RIGHT_CLICK_AIR) {
            if (e.getItem() != null) {
                if (e.getItem().getItemMeta().equals(ItemManager.PotionWand)) {
                    Player p = e.getPlayer();
                    p.getWorld().createExplosion(p.getLocation(), 6f);
                    p.sendMessage(ChatColor.GOLD + "Explosion Activated!");
                    p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 3, 50));```
remote swallow
#

wrong way to check items

#

ItemStack.isSimilar(ItemStack)

cunning osprey
remote swallow
#

e.getItem().isSimilar

cunning osprey
tender shard
#

?learnjava duh

undone axleBOT
remote swallow
cunning osprey
wooden hedge
#

is there a way to make snowball to pass through entities?

#
        Player player = (Player) sender;

        // Summon a custom skeleton at player's coordinates with Netherite armor
        Skeleton skeleton = player.getWorld().spawn(new Location(player.getWorld(), 205.5, 126.93750, -75.5), Skeleton.class);

        // Disable skeleton's AI
        skeleton.setAI(false);

        // Set skeleton as invulnerable
        skeleton.setInvulnerable(true);

        // Create and set the Netherite armor pieces
        ItemStack helmet = new ItemStack(Material.NETHERITE_HELMET);
        ItemStack chestplate = new ItemStack(Material.NETHERITE_CHESTPLATE);
        ItemStack leggings = new ItemStack(Material.NETHERITE_LEGGINGS);
        ItemStack boots = new ItemStack(Material.NETHERITE_BOOTS);

        // Set the armor items for the skeleton
        skeleton.getEquipment().setHelmet(helmet);
        skeleton.getEquipment().setChestplate(chestplate);
        skeleton.getEquipment().setLeggings(leggings);
        skeleton.getEquipment().setBoots(boots);

        new BukkitRunnable() {
            int ticks = 0;
            int degreesToRotate = 360 / 8;
            int lastFuseTicks = 0;

            @Override
            public void run() {
                if (ticks >= 3 * 16) {
                    this.cancel();
                    skeleton.remove();
                    return;
                }

                skeleton.setRotation(skeleton.getLocation().getYaw() + degreesToRotate, skeleton.getLocation().getPitch());

                Snowball snowball = skeleton.launchProjectile(Snowball.class);
                skeleton.setCollidable(true);
                snowball.setVelocity(new Vector(snowball.getVelocity().getX(), snowball.getVelocity().getY() - 0.125, snowball.getVelocity().getZ()));
                PersistentDataContainer container = snowball.getPersistentDataContainer();
                container.set(new NamespacedKey(TikTok.getInstance(), "skeleton_snowball"), PersistentDataType.BOOLEAN, true);
                TNTPrimed tnt = snowball.getWorld().spawn(snowball.getLocation(), TNTPrimed.class);
                if (ticks > 0)
                    tnt.setFuseTicks(lastFuseTicks - 3);
                lastFuseTicks = tnt.getFuseTicks();
                snowball.addPassenger(tnt);
                ticks += 3;
            }
        }.runTaskTimer(TikTok.getInstance(), 0L, 3L);```
pine cipher
#

Hello I have 1 question. I have pack that is adding things via mcpatcher/cit folder. Is there a way to make it work on bedrock?

twin venture
#

Hello will this method work on settings armor peace too?
player.getInventory().setItem

#

in here?

wooden hedge
#

i'm using it to cancel the snowball particles if it hits the wall

#

can i check there if the snowball hit an entity and cancel it appropriately?

quaint mantle
#

there may not inventory, you may need to use player.getEquipment

twin venture
#

iam on old version

hybrid turret
#

Isn't

if (!(sender instanceof Player player)) {
  return;
}
UUID uuid = player.getUniqueId();

supposed to be working? Someone said it would work but my IDE is screaming at me that I can't access player since it's not in the if-block.

quaint mantle
#

i ask to chatgpt

#

and said this
player.getInventory().getArmorContents()

hybrid turret
zealous osprey
quaint mantle
hybrid turret
#

huh

#

i don't think i understand

quaint mantle
#

why u did this ?

hybrid turret
#

example

#

it's about accessing player outside of the if block

#

had a discussion yesterday and noobdog said that would be my correct code (pretty much)

#

oh i see

#

noobdogs code was just wrong

quaint mantle
#

what are u trying ?

hybrid turret
#

long story.. wait let me get my original code lmao

quaint mantle
#

aight

hybrid turret
#

basically my code was one big arrow

#

and that was a problem

#

wait i can just send a different command bc i gotta refactor all of them anyway

quaint mantle
#

can you briefly explain, what is your problem?

hybrid turret
hybrid turret
#

a bit hard to explain bc i myself still have to wrap my head around that bc it's new structure for me

hybrid turret
quaint mantle
#

in my opinion u need do this code with early returns

#

your code will be more readable

hybrid turret
#

yes, that's what i'm trying to achieve

#

i know

quaint mantle
#

ah

#

aight

#

i will give example for u

#

1m

hybrid turret
#

thanks

quaint mantle
#

example for permission if

if (!sender instanceof Player) return;
if (!p.hasPermission("serversystem.activate.norain")) {
    p.sendMessage(Errors.getPermissionError());
    return;
}
if (args.length == 0) {
    sout("usage message")
    return;
}
remote swallow
#

the instanceof needs double brackets

hybrid turret
#

yeah i get that. the problem is now: there's different stuff happening depending on if a player uses the command and if a console does that

quaint mantle
remote swallow
#

if (sender instanceof Player player) {
    //player code
    return;
}

console code
sage dragon
#

Is there a way to check if there's a full moon?

quaint mantle
#

i can't use sessionfactory

remote swallow
#

i dont use it

quaint mantle
#

well

hybrid turret
remote swallow
#

the args error is in both so do that first, before the instanceof

#

and make this a method

#

but the concept is there

hybrid turret
#

alright

#

bruh

#

and ppl were still screaming at me for that code ffs

hazy parrot
#

What is global boolean utils lol

quaint mantle
hazy parrot
#

Well only in spring

quaint mantle
#

spring boot using hibernate 6 ?

#

bcs i can't use sessionfactory

#

i mean i can't import and do anthing

wooden hedge
#

ty

#

btw

#

how can i do this on primed tnt?

remote swallow
#

tnt prime event

hybrid turret
#

Wait

#
private void handleDeathCange(CommandSender sender) {
    if (isDeathEnabled) {
      GlobalBooleanUtils.setDeathEnabled(false);
      sender.sendMessage(ServerSystem.getPluginPrefix() + "You successfully §aactivated §3noDeath§7.");
      for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
        if (onlinePlayer != sender) {
          onlinePlayer.sendMessage(ServerSystem.getPluginPrefix() + ((sender instanceof Player) ? ("§b" + sender.getName()) : "An §4administrator") + " §7has §aactivated §3noDeath§7.");
        }
      }
    } else {
      GlobalBooleanUtils.setDeathEnabled(true);
      sender.sendMessage(ServerSystem.getPluginPrefix() + "You successfully §cdeactivated §3noDeath§7.");
      for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
        if (onlinePlayer != sender) {
          onlinePlayer.sendMessage(ServerSystem.getPluginPrefix() + "§b" + sender.getName() + " §7has §cdeactivated §3noDeath§7.");
        }
      }
    }
  }

for the bottom method

#

wait this can be shortened even more

wooden hedge
#

i checked that event

#

but it doesn't say anything there

remote swallow
#

oh, no clue for that

hybrid turret
#
private void handleDeathCange(CommandSender sender) {
    GlobalBooleanUtils.setDeathEnabled(!isDeathEnabled);
    sender.sendMessage(ServerSystem.getPluginPrefix() + "You successfully " + (!isDeathEnabled ? "§aactivated" : "§cdisabled") + " §3noDeath§7.");
    for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
      if (onlinePlayer != sender) {
        onlinePlayer.sendMessage(ServerSystem.getPluginPrefix() + ((sender instanceof Player) ? ("§b" + sender.getName()) : "An §4administrator") + " §7has " + (!isDeathEnabled ? "§aactivated" : "§cdisabled") + " §3noDeath§7.");
      }
    }
  }

this

#

that's some nice advice. much better than yesterday. thank you all so much :D

#

i don't want the sender to get the message

icy beacon
#

can you even compare player objects with ==

hybrid turret
#

bc the sender already gets the message above

hybrid turret
icy beacon
sage dragon
#

Do I have to calculate moon phases myself, or is there something that does it for me?

icy beacon
#

and with equals, not ==

#

maybe you can but it looks like you cannot