#help-development

1 messages · Page 3 of 1

noble lantern
#

CompletableFuture.runAsync(() -> {

}, threadPoolExecutor);

echo basalt
#

to get mobs to recognize fake blocks

noble lantern
#

ez async

echo basalt
#

and not phase through them

#

and I made sure to jam it all the slightly modified nms methods into 1 class

noble lantern
#
CompletableFuture.runAsync(() -> {
  new MinecraftServer().start();
}, threadPoolExecutor);
echo basalt
#

because I don't care

noble lantern
#

honest mojang your stupid as FUCK

#

just do this

sterile token
#

Burch and what about queueing?

noble lantern
echo basalt
noble lantern
#

yes

#

runs the sever async

humble tulip
noble lantern
sterile token
#

In needing a tuto

#

I really want to learn about non blocking and con currency

noble lantern
#

ngl its relticely supplrt

#

concurrency

noble lantern
#

little more complex tho

echo basalt
#

not my proudest moment

#

but it works

#

and only took me like 3 hours

sterile token
#

Because i want to start learning socket

noble lantern
#

mmmm

noble lantern
#

taking my word for it

sterile token
#

Okay

echo basalt
sterile token
#

So its better Nio right burch?

#

😂

noble lantern
#

Nio?

noble lantern
sterile token
#

Nio non blocking IO

echo basalt
#

nbio

noble lantern
#

blocking IO is fun as long as you arent on main thread

echo basalt
#

part of me wants to make my own like

#

pubsub system

#

using sockets

noble lantern
#

if you block inside a a future its fine

#

pubsub?

sterile token
#

That my issue I dont know how to manage correct ly Thread for sending and rexeivingb

echo basalt
#

So I don't need to educate people on how to install redis every time they want a multi-server synchronization plugin

echo basalt
#

because latency compensation

noble lantern
sterile token
#

I was planning to do something similar

echo basalt
#

I'd just make it operate as a mesh type of thing

#

adding a new node to the mesh would just do some handshake and the mesh would provide its own data

sterile token
#

Ilusión my goal in the future was to built one

echo basalt
#

Ilusión

#

man's using spanish autocorrect

sterile token
#

I really programming and connecting things like sockets, we sockets http

noble lantern
#

because hes spanish lol

#

xD

sterile token
#

Yeah im spanish

#

Sorry

#

Dont blame

echo basalt
#

I just like bashing my head at the wall after promising my support discord server I'd add multi-proxy support to my skyblock plugin

sterile token
#

Ilusión sockets?

echo basalt
#

I tried implementing it on my skyblock fork before working on master and made like 50 packets

#

but it still wasn't enough

sterile token
#

I want to make a simple pub sub

#

But i dont understand multi Thread ing

#

Basically working without free ing the whole server

#

😂

echo basalt
#

silly you

#

just do it on the main thread

sterile token
#

But what about for waiting?

#

It will block

echo basalt
#

the players can wait

sterile token
#

No I need a lib work without that issues

#

Being able to await

echo basalt
#

I have a basic packet manager for communication

#

It's basically a shitty tcp implementation running on redis that runs on tcp

noble lantern
#

like get a life smh

quaint mantle
#

Verano

#

Check dm

echo basalt
#

and not opening the game to test a bug for 3 hours straight before going to bed

#

couldn't be me

noble lantern
#

especially if ur wanting it working with sockets

#

im just tired lmao

quaint mantle
noble lantern
#

i can maybe make one

quaint mantle
#

I've heard about it multiple times

#

I would even pay for it

#

Like, if any of you makes udemy courses

noble lantern
#

ive done a few guides already maybe it can be my next one

#

nah i just write them o nthe forums

sterile token
#

In js is so fucking easy like this random example I remember:

const ws = require("websocket");

const packet = { name: alex} ;
let res = await ws.send("route", pscket);
#

Why isnt thst simple java

#

😬

echo basalt
quaint mantle
#

Just half ass a 10 minute video in Udemy explaining how to use it with spigot plugin dev and I will straight up pay $20 for it

quaint mantle
echo basalt
#
CompletableFuture<Boolean> future = CompletableFuture.supplyAsync(() -> {
  ... SOME HEAVY OPERATION ...
  return true;
});

future.thenAccept(result -> {
  ... SOME OPERATION WITH RESULT
});

future.thenRun(() -> {
  ... SOME RUNNABLE WITHOUT THE RESULT ...
});
echo basalt
#

And when that eventually arises, you can do pre-defined operations with the value

quaint mantle
#

That's so amazing

echo basalt
#

you can prematurely complete the operation by calling

future.complete(value)

#

But there's another thing

#

futures like to hide exceptions

#

You can catch exceptions by calling

future.exceptionally(exception -> {
  ... DO SOMETHING ...
  return newValue; 
});
#

runAsync is just a supplyAsync but for voids, there's no return value

sterile token
#

Also why doesnt auto catch exception

#

Once are detecte

#

Like javasxript

#

😡

echo basalt
#

futures catch it and stop executing

#

and call the exceptionally stuff

#

it's basically complete under an exceptional state

sharp flare
#

Just like how u catch promises for unhandled rejection or errors in js

solemn igloo
#

i still dont understand

quaint mantle
#

Unsupported class file major version 61 how may i fix this?

#

have no idea what i've done

vale ember
#

what java version are you using?

quaint mantle
vale ember
#

pom?

#

is it 17 in pom as well?

quaint mantle
#

yep

vale ember
#

shouldn't it be just 17 instead of 1.17?

quaint mantle
#

na

#

i fixed it anyways

#

thanks tho

noble lantern
#

Another thing about futures btw

#

if your not using a custom Executor

#

And you need to manually block, the future will actually complete pre-maturely with an exception

#

to fix it use work stealing or a fixed thread pool Executor

Create new insttances in the Executors tab

quaint mantle
#

is there an app / website that you can create items in? Like to preview name / lores ect

willow widget
#

how can I set a player's spawn point?

vocal cloud
#

When they respawn set it to whatever you want

willow widget
#

wdym?

#

on the event?

#

player respawn event or something?

solid cargo
#

How can i block a certain cmd in a certain server in bungee?

#

Cant seem to find a commandevent in javadocs

#

Or is it ChatEvent

#

Ok ima try chatevent

quaint mantle
solid cargo
#

Bungeecord api??

quaint mantle
#

Oop

#

Nope

#

Lmao

#

One momento

drowsy helm
#

other than ChatEvent i dont think theres another way

#

doubt ChatEvent even sends commands aswell

solid cargo
#

I mean there is isCommand boolean

trail bluff
#

how to teleport entities in unloaded chunks

mellow totem
#

you cant i believe

#

wouldnt you have to load the chunk

solid cargo
#

ok jk

trail bluff
#

I tried to load it, the entity spawned and did not teleport

solid cargo
#

nms perhaps

vocal cloud
#

Why would you want to do this?

solid cargo
#

if ChatEvent in bungee api knows the player, why cant i get him as a proxied player?????????

vocal cloud
#

?jd-b

#

?jd

solid cargo
#

nvm i casted Connection to ProxiedPlayer

#

it works perfectly!

carmine nacelle
#
                        Beehive hiveBlock = (Beehive) blockAtHiveLoc.getState();
                        org.bukkit.block.data.type.Beehive hiveData = (org.bukkit.block.data.type.Beehive) hiveBlock.getBlockData();
                            hiveData.setHoneyLevel(0);
                            blockAtHiveLoc.setBlockData(hiveData);
                            hiveBlock.update(true);
#

this isnt working.. any ideas?

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

carmine nacelle
#

I mean it’s not setting the data idk how else to explain it.

#

Hive gets full of honey so I try to set it back to 0 and it doesn’t work

frosty tinsel
#

You are probably using bad classes, why does one have FQCN and the other does not?

carmine nacelle
#

Cause I am using the block state stuff and data both.

#

They have different methods

patent horizon
#

.

ashen quest
#

yo spigot gang

i made my jar using buildtools, and imported it in IntelliJ

but when I try to do maven -> package it gives error

do i need to add the jar to the pom and if yes, how?

river oracle
#

wow thats kinda cringe ngl use maven

ashen quest
#

maven is sick

river oracle
#

you don't need to manually add the jar pal

ashen quest
#

then?

river oracle
#

just add the maven repo !

ashen quest
#

yea but i need NMS

earnest forum
#

when you use buildtools it adds it to ur m.2 repo anyways

river oracle
#

oh did you run buildtools remapped

earnest forum
#

like ur repository on ur computer

ashen quest
#

oh

river oracle
#

read mfnalex's blog

ashen quest
#

so how do i use that repo?

river oracle
#

it goes over everything

ashen quest
#

I dont need mojang mappings

#

I need NMS

earnest forum
#

and it will take it from that repo

ashen quest
#

whats the coords

earnest forum
#
<dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
#

u add this and it will take it from ur m.2

ashen quest
#

oou

river oracle
#

my lord bro your insane

ashen quest
#

sorry man

river oracle
#

you don't want mojang mapping xD

earnest forum
#

mojang mapping are nms

river oracle
#

might as well shoot yourself in the foot

ashen quest
#

xd its from work so i cant really change stuff that much

river oracle
earnest forum
#

the mapping doesnt matter too much

#

its just what the name of fields and classes are

#

it doesnt affect the plugin functionality just how you code

ashen quest
river oracle
#

accurate field and method names help

earnest forum
#

mojang mapping are more accurate but incomplete

#

wait no

#

other way around

river oracle
#

Mojang Mappings ain't incomplete

earnest forum
#

spigot mapping are more accurate but incomplete

river oracle
#

eh as long as they prefer d, f, c etc compared to actual names doesn't matter to much

earnest forum
#

theres always this

river oracle
patent horizon
ashen quest
#

oh

#

i dont think you do that either

ashen quest
earnest forum
#

just change 1.18 to 1.8

ashen quest
#

well i did do that

#
<dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
patent horizon
ashen quest
#

yea but i think you need to give the shulker box a color

#

i m not sure cuz i never worked with it

ashen quest
earnest forum
#

no

#

have you ran buildtools fully

#

what parameters did u use

#

try remove <classifier>remapped-mojang</classifier>

ashen quest
#

ill send my pomz

#

?paste

undone axleBOT
ashen quest
earnest forum
#

what's not working?

#

is there an error

ashen quest
#

it says it cant find that

earnest forum
#

have you ran buildtools for 1.8?

ashen quest
#
Unresolved dependency: 'org.spigotmc:spigot:jar:1.8-R0.1-SNAPSHOT'
ashen quest
earnest forum
#

hmm idk then

#

im not an expert on maven and this kind of stuff

ashen quest
#

OOOOOO

#

I built it for 1.8.8

#

and i aded .8 and it works

earnest forum
#

that should be fine though

#

ah

#

there ya go

ashen quest
#

you wanna see hell?

#

they name packages likeThisCasing

#

and THEY DONT USE MAVEN OR SHIT THEY USE INTELLIJ ARTIFACT

#

I spent 2 hours refactoring this code

earnest forum
#

who does

ashen quest
#

wdym

#
  • 25% of the packages and methods are in spanish 💀
earnest forum
#

we best hope they never show up in this server

#

they'd get teared to pieces

ashen quest
#
  • more iritating stuff
#

they have two packages

#

itemMenu and itemMenus

the classes are identical 100%

#

and it confuses me everytime which one to use

river oracle
#

I'm currently fixing code which was all static abuse

#

It's so bad I wish I could share it

ashen quest
#

oh yea

#

dont even get me started with statis abuse here

#

its both static abuse and DI

#

like 70% its static and then toher part is DI

river oracle
#

I'm slowly converting from static to DI but the static is so intertwined it'll take weeks to get it out of the eco system

solemn igloo
#

How do i add velocity in visual bukkit? (like i want it when i sneak i get launched 10 blocks in the air)

tender shard
#

visual bukkit is just a big pile of garbage and you can do everything in java like 10 times faster and 12 times better

zenith gate
#

i See that the player has the setDisplayName now why doesn;t that change the actual gamertag when seeing it from person to person? it just changes the name for like chat and stuff..

willow widget
#

any ideas on how to clear player's chat?

simple silo
#

Can I somehow serialize and deserialize NBT data? (NMS v1_18_R2 mojang remapped)

simple silo
willow widget
#

I meannnn

ashen quest
willow widget
#

that works i guess xd

ashen quest
#

it does

willow widget
#

alr ill do that then xd

ashen quest
#

lemme show u smth cool af my friend made

chrome beacon
tender shard
chrome beacon
tender shard
tender shard
#

nice

chrome beacon
#

That's a lot of chat spam

simple silo
chrome beacon
#

TagParser

tender shard
chrome beacon
#

Like I said

tender shard
#

oh deserialize

#

well you can just do new CompoundTag().save(SomeString)

#

it's called "save" but it actually loads it

simple silo
#

ohhh

#

alright, thanks

tender shard
#

it's called "save" because it "saves" the string "into" the compoundtag lol

#

very weird name but yeah

chrome beacon
#

I've always used the TagParser

tender shard
#

probably works too, idk I never did any NBT stuff

simple silo
tender shard
ashen quest
simple silo
#

if it won't work I'll just use TagParser.parse();

#

I assume that BlockPlaceEvent#getItemInHand gives the item used to place the block yeah?

chrome beacon
#

Yeah

simple silo
#

aight

tender shard
#

oh wait, my bad. There is no TagCompound.save(String). That's a method on NMS' ItemStack/Meta to load NBT data "into" the itemstack

#

I only had this in mind. So yeah, do what @chrome beacon suggested and use the parsing thing

chrome beacon
#

Which is why it's called save

#

Because it saves item stack to nbt

tender shard
#

yes, as said, my bad, I confused things 😄

#

oh and yeah I also mis-explained the save method again

#

just ignore me already, okay?!?! lol

sage dragon
#

Will ItemStack#isSimilar ignore DisplayName and Lore?

zenith gate
tender shard
#

dont question it, they always do wreid things lol

zenith gate
sage dragon
# tender shard non

Okay, so I should probably remove DisplayName and Lore before comparing.

That should be everything I need to ignore, right?

chrome beacon
#

What are you comparing the items for?

sage dragon
zenith gate
chrome beacon
#

You should detect custom items with pdc

#

?pdc

sage dragon
sage dragon
zenith gate
#

I use RecipeChoice exact choice I never have any problems with it.

tender shard
sage dragon
#

Except for amount

tender shard
#

I also wanted to check the source but IntelliJ died while decompiling

sage dragon
#

😅

#

Oh, forgot about Repair Cost, want to ignore that one too

tender shard
#

lets trigger some people

vale ember
#

Lombok ❤️

chrome beacon
#

Lombok is fine as long as you delombok when you package the jar

tender shard
ivory sleet
hybrid spoke
#

guys how do i use guice in my single module project? i wanna do real dependency injection

tender shard
#

guice :X it's such a weird thing

#

what exactly is the question though

ivory sleet
#

well you'd do it like all other guice projects except you probably wanna instance inject your plugin instance with guice

opal juniper
# tender shard

this is a double whammy - not only is it lombok, it’s inline lombok

charred blaze
#

Exception in thread "main" java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
String ts = "2022-07-22 21:30:17.293";
Timstamp.valueof(ts);

i know this has no touch about spigot but im trying to create plugin. it will be great if someone helps me anyways.

sage dragon
lean monolith
#

Is there a way to fix corrupted plugins?

frosty tinsel
opal juniper
lean monolith
#

all my plugins became 6.8mb

opal juniper
sage dragon
chrome beacon
eternal oxide
lean monolith
eternal oxide
#

Looks like you used the wrong format in your date. mm is minutes and you used it in your month. Change mm to MM in your month section

lean monolith
#

if I could fix those ones only thats the only ones I care about

charred blaze
#

im just trying to convert string to timestamp

eternal oxide
#

yes you are. Thats what that error eays

lean monolith
charred blaze
#

what if i convert string to instant first and then to timestamp?

quiet hearth
#

you do, but you dont want to

#

and is it posibble to have a custom player class to avoid player data class

chrome beacon
lean monolith
chrome beacon
#

You might be able to recover some of it

#

Will take a lot of time and isn't worth it

charred blaze
#

change java version

#

download it ? idk

eternal oxide
#

You need to set target/source version in your pom

#

You are building for too high Java version for your server

charred blaze
lean monolith
#

Does anyone know why a bunch of plugins would corrupt to all be the same memory?

eternal oxide
lean monolith
#

I go into the plugins folder

#

they are all 6.985mb

round eagle
#

my whole server freezes until the code catches an exception or allows the player to go

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

        final boolean[] status = {false};

        Bukkit.getScheduler().runTaskLater(this, new Runnable() {
            @Override
            public void run() {

                String ip = "ip";
                int port = 00000;


                try {
                    Socket sock = new Socket();
                    sock.connect(new InetSocketAddress(ip, port), 400);

                    DataOutputStream out = new DataOutputStream(sock.getOutputStream());
                    DataInputStream in = new DataInputStream(sock.getInputStream());
                    out.write(0xFE);

                    StringBuffer str = new StringBuffer();

                    int b;
                    while ((b = in.read()) != -1) {
                        if (b != 0 && b > 16 && b != 255 && b != 23 && b != 24) {
                            str.append((char) b);
                        }
                    }

                    String[] data = str.toString().split("§");
                    int onlinePlayers = Integer.parseInt(data[1]);
                    System.out.println(onlinePlayers);

                    status[0] = true;

                } catch (Exception e) {

                    System.out.println("Under maintenance");
                    TextComponent tc = new TextComponent("[NOTIF] Server is under maintenance. You will be kicked out in 60s.");
                    tc.setColor(ChatColor.RED);

                    player.spigot().sendMessage(tc);

                    status[0] = false;




                }

            }
        }, 0L);

       
eternal oxide
#

I guess you did somethign wrong when you downloaded them

tardy delta
#

Tf

round eagle
#

second part of the code

Bukkit.getScheduler().runTaskLater(this, () -> {
            if (!status[0]) {
                player.kickPlayer("Under Maintenance");
            }
        }, 60L * 20L);



        Bukkit.getScheduler().runTaskLater(this, () -> {
            if (status[0]) {
                ByteArrayOutputStream b = new ByteArrayOutputStream();
                DataOutputStream out = new DataOutputStream(b);

                try {
                    out.writeUTF("Connect");
                    out.writeUTF("survival");
                } catch (IOException ex) {
                    System.out.println("Failed whilst connecting to SMP. Error log: " + ex.getCause());
                    player.kickPlayer("Failed whilst connecting. Try again later.");
                }
                player.sendPluginMessage(this, "BungeeCord", b.toByteArray());
            }
        }, 40L);

    }```
tardy delta
#

Do it async

#

Ig

cunning canopy
#

Can I use different ports with spigot?

tardy delta
#

Only one server can run on one port

cunning canopy
#

I know

#

But like

#

Can I change the port

#

I want to have multiple servers on one lan

keen spindle
#

guys is it not possible to use protocol lib in mc v19?

eternal oxide
#

version 61 is Java 17. Spigot requires 16 on later version

keen spindle
eternal oxide
#

or is 16? I forget

keen spindle
#

when they click on them using right click

keen spindle
eternal oxide
#

16 is required

keen spindle
#

for me?

eternal oxide
keen spindle
#
[15:05:24 INFO]: Error Unable to intercept a read client packet. (java.lang.IllegalArgumentException: Unable to find a field null with the type com.mojang.authlib.GameProfile in net.minecraft.network.protocol.login.PacketLoginInStart) occured in com.comphenix.protocol.injector.netty.ChannelInjector@92bf135.
[15:05:24 ERROR]:   [ProtocolLib] INTERNAL ERROR: Unable to intercept a read client packet.
  If this problem hasn't already been reported, please open a ticket
  at https://github.com/dmulloy2/ProtocolLib/issues with the following data:
  Stack Trace:
  java.lang.IllegalArgumentException: Unable to find a field null with the type com.mojang.authlib.GameProfile in net.minecraft.network.protocol.login.PacketLoginInStart
``` i get this error multiple errors
eternal oxide
#

Unless your NPC's are fake

keen spindle
keen spindle
opal wedge
#

Hey, I have the following 2 methods. My goal is to prevent all destruction by overlaying block and player, but allow normal destruction (player left click) in some cases.

However, I have the problem that when I left click, both methods are called. And the 2nd method cancelled the event. Does anyone have an idea how I can prevent this?

    @EventHandler
    public void onHangingBreakByEntity(HangingBreakByEntityEvent event) {
        System.out.println("HangingBreakByEntityEvent");
        Entity remover = event.getRemover();
        if (!(remover instanceof Player)) {
            return;
        }

        for (final Team team : Team.teams) {
            if (!team.getGame().hasStarted() || !team.getPlayers().contains(remover)) {
                continue;
            }

            Location minPoint = null;
            Location maxPoint = null;

            if (team.getType() == TeamType.NAVY) {
                minPoint = team.getGame().getArena().getLocation("navy.area.min_point");
                maxPoint = team.getGame().getArena().getLocation("navy.area.max_point");
            }else if (team.getType() == TeamType.PIRATES) {
                minPoint = team.getGame().getArena().getLocation("pirates.area.min_point");
                maxPoint = team.getGame().getArena().getLocation("pirates.area.max_point");
            }

            if (!Utils.isInArea(event.getEntity().getLocation(), team.getGame().getArena().getWorld(), minPoint, maxPoint))
                event.setCancelled(true);
        }
    }
    @EventHandler(ignoreCancelled = true, priority = EventPriority.LOW)
    public void onHangingBreak(HangingBreakEvent event){
        System.out.println("HangingBreakEvent");
        event.setCancelled(true);
    }
keen spindle
#

i downloaded the npc maker plugin from online

#

and i want my plugin

#

to just override

#

the other plugin

#

like use the npcs from the other plugin

#

and teleport the user

keen spindle
#

they are player entities

tardy delta
eternal oxide
#

If they are player entities then you shoudl recieve normal interact events

tardy delta
#

Use bungee stuff or smth

keen spindle
#

doesnt work tho

eternal oxide
#

does it fire at all for your NPC's?

keen spindle
#

it doesnt log the entity as PLAYER, as for other mobs it says CAT etc

keen spindle
#

so im not sure how they are made

eternal oxide
#

If no event fires when you click on them, they don;t realy exist. your other plugin is doing everything with packets and faking them on the client

vernal minnow
#

Hello, I have a question about Bungeecord Message Channels. Can you only register the channels in a bungee cord plugin at the beginning, i.e. when you start the plugin, or can you also register them later in the code because I have problems registering channels afterwards. Thanks

eternal oxide
#

you can register them anytime

keen spindle
#

so it should

#

log the entity

#

if they were real

eternal oxide
#

yes

rotund ravine
#

It will log it*

keen spindle
#

but wouldnt making real entities, show them when u do tab

eternal oxide
#

No you can send a remove Packet after adding their info to delete them from Tab

keen spindle
#

i see

slate delta
#

Anyone know how I can prevent this from happening?

visual tide
slate delta
keen spindle
#

is it possible to edit the message and stuff, when we press tab key

#

without NMS

keen spindle
#

yea

#

ty

round eagle
sharp flare
#

is sqlite good for storing various amount of serialized itemstacks

#

Or do i even have to serialize it

ivory sleet
#

I mean ideally you'd store it accordingly with rows and columns

#

but sure you could blobify it also

sharp flare
#

Aight thanks

#

Thinking of making a block that can do multi page inventory

#

For storing some stuffs

#

Or maybe an item instead of a block since I can attach a pdc to it as an primary key

ocean lion
#

Where can I get help with Java and not spigot

eternal oxide
#

Depends. If it could be Spigot related at all you may get help here

ocean lion
#

No purely java

ivory sleet
eternal oxide
#

We do discus Java things at times

ivory sleet
#

but like.. you may or may not receive a pertinent answer

ocean lion
#

How can I choose within the JFrame where JButton and JLabels will be located

eternal oxide
#

Apply a layout

tender shard
#

what's the "this" parameter called again?

#

I always forget

eternal oxide
#

I've only ever known it as an Instance reference

tender shard
#

I mean this (where "this" is the parameter name and you can call the method without actually passing a reference)

eternal oxide
#

I wouldn;t have thought you could have a variable named "this". I would expect it to be a protected name

tender shard
#

you can't, this "this" is a special case lol

#

that's also why you can do "something()" without passing anything

median widget
#

my skript wont work and my only skript plugins are skbee skript and skript-gui

tender shard
#

fix it

eternal oxide
#

We don't generally do Skript here. I believe they have a discord

tender shard
#

ah I found it @eternal oxide. It's called "receiver parameter"

eternal oxide
#

Never heard that term

tender shard
#

choco showed it to me once and I found it fascinating

quiet ice
#

Ah I see. I don't really see the usecase of that (or better said the usecase presented there isn't really that useful), even though it makes sense

wheat dock
#

im currently trying to use item sterialization using the spigot page https://www.spigotmc.org/wiki/itemstack-serialization/
im trying to edit a diamond swords default damage value to 4
my approach was to somehow follow the config shown in the spigot page but im getting an error in which org.bukkit.attribute.attributemodifier was not found
any suggestions?

eternal oxide
#

Well my first comment is, that UUID is not a valid UUID, so it will be unable to find an AttributeModifier constructor to create that

wheat dock
#

what would be a valid uuid to use

tender shard
quiet ice
#

Well that is something I already know

#

I use that quite often to tell eclipse than something can actually be null (which is not the case, but whatever) when it is annotated as notNull

tender shard
#

ok I got another weird thing

#

this DOES print "Java can be weird"

chrome beacon
#

It's no where near as bad as JavaScript though... 🙃

tender shard
#

it's also funny how the last one only works in java 8 and older

class Test {
    private int __; // Works
    private int äöüß; // Works
    
    private int _; // Works only in Java 8 and older
}
vale ember
#

i wonder why did they even make it a reserved keyword? 🤔

tender shard
#

no idea lol

#

I'm glad that using two is okay

#

I always do stuff like this

someMap.computeIfAbsent("asd", __ -> something());
quiet ice
#

lambdas I have to assume

tender shard
#
// Counting down to 0
while(countdown --> 0) {
    System.out.println(countdown);
}

this is also funnny. looks like a new --> operator

#

especially with ligatures enabled

inland axle
#

when decompiled the if statement is gone lol

tender shard
#

oh well yeah

#

but the if doesnt contain the sout

#

anyway, randomly inserting links also works

class Test {
    public static void main(String[] args) {
        https://blog.jeff-media.com
        System.out.println("Visit my website");
    }
}
inland axle
#

wdym

tender shard
# inland axle wdym
// \u000a\u007d\u007b
```
This is a newline, closing bracket, openinng bracket
inland axle
#
class Main{
public static void main(String[] args){
https://blog.jeff-media.com
if (true == false){
System.out.println("hello world!");
}

}

}```
```java
Compiled from "Main.java"
class Main {
  Main();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V
       4: return

  public static void main(java.lang.String[]);
    Code:
       0: return
}
tender shard
inland axle
#

ye

tender shard
#
// \u000a\u007d\u007b
inland axle
#

I tried that too

#

it did what you said it would

tender shard
#

ah ok

#

yeah one can do really funny things

inland axle
patent fox
#

how can i add custom enchantments into the enchantment table?

young knoll
#

You have to use the enchant event

#

Or inject them into registries with a bunch of NMS

patent fox
#

I want to add it as an offer, but when it apperes (without name btw) its not clickable

tender shard
#

well it's not needed to add it to the actual offer since it's not visible anyway

#

just add it in the enchant event

chrome beacon
#

I recommend using an existing custom enchant plugin

young knoll
#

Yeah you can’t add them as an offer

#

The client doesn’t have a matching enchantment

#

LootTables.FISHING.getLootTable

tender shard
#

just populate a random new inventory and then get the first non empty item

young knoll
#

You need to pass a tool to the context

tender shard
#

why not just use the default modifier?

#

LootContext.DEFAULT_LOOT_MODIFIER ?

young knoll
#

Huh the builder doesn’t have a method for that

#

Me thinks you need to open a big report

#

Unless I’m missing something

tender shard
#

show the full stacktrace

young knoll
#

Actually, try setting the entity

#

Since you appear to have a player variable

tardy delta
tender shard
#

as said, just try to use the default loot context

young knoll
#

There isn’t one

tender shard
round eagle
young knoll
tender shard
#

oh

#

mb

young knoll
#

Try setting the killer

#

Even though you aren’t killing anything

#

Hence the try setting one

#

Yes

#

Maybe it’ll use their held item for the tool

#

Still would be nice if you could set the item directly

#

Maybe open a request for that

#

?jira

undone axleBOT
tardy delta
#

Packets

#

Idk search the forum

patent fox
#

how can i make three fishing hooks line up infront of the player?
like in this example: https://imgur.com/a/Oi7JROx
i know how to spawn them but i want to line them relatively to the player

tardy delta
#

Not hard enough then

#

I Found one prev week

#

Moving npcs

#

A resource iirc

tender shard
#

uuuuugh I accidentally changed my intellij theme and now it looks like some toy or candy or similar lol

chilly patio
#

quite a stupid question, is it worth to do my own world manager for my plugin or should I just assume all servers have multiverse core and use their api?

tardy delta
#

That's alot of utils

eternal oxide
#

It really depends on what you are doing.

charred pollen
#

Hi i'm new on the plugin making, i'm trying to make this plugin which makes you're max health 40 instead of 20, on level 30, but seems like i made it everytime the player level up
anyone care to help? 😅

chilly patio
eternal oxide
#

again, depends on what you are doing

#

A world is a world. There is nothign different between a world you gen and a MV world

charred pollen
tender shard
chilly patio
tender shard
eternal oxide
#

Management?

chilly patio
tardy delta
#

Fun

chilly patio
eternal oxide
#

The underlying world is no different

chilly patio
#

yes but if someone creates a world with my plugin and tries to use mv stuff on it, it won't work.

eternal oxide
#

So you are aiming to create a UI for Multiverse instead of using commands

chilly patio
#

yes

#

well, not MV specifically

#

just world management in general

eternal oxide
#

I don;t really see a use case

chilly patio
#

some see it, others don't ¯_(ツ)_/¯

eternal oxide
#

World creation/management is really down to the Server owner. They are not going to pick your UI over Multiverse

chilly patio
#

not the idea.

#

the idea isn't to replace MV

eternal oxide
#

and the number of times they are going to use a World UI is so scarce they will just use commands

#

once worlds are initially setup you never use MV again

chilly patio
#

depends but sure

eternal oxide
#

a UI seems a waste of time.

chilly patio
#

👍

#

not what I asked to know but good for you

eternal oxide
#

Well yes its exactly what you asked

#

You clarified your idea, I gave advice

#

Sure use their API, assume everyone uses MV

sharp flare
#

I would use their api instead

#

If I were you

chilly patio
#

ok thanks

sharp flare
#

Its there in the first place

sharp flare
#

You save a lot of headaches using an existing api for your needs but it depends on what you really want to achieve

dim palm
#

how can i make a damaged custom item work as a normal custom item

#

when i damage the item it stops working

hoary perch
#

is there a way to run this command with a plugin?

/tp ^ ^ ^10

I want to teleport a player 10 blocks away from a armor stands face

eternal oxide
#

Mark its PDC to identify it

eternal oxide
hoary perch
#

yes, but how do i do it in a direction

dim palm
#

player.teleport(x, y, z);

#

its wrong, my bad

eternal oxide
#
player.teleport(stand.getLocation().add(stand.getLocation().getDirection().multiply(10));```
hoary perch
dim palm
#

xd

eternal oxide
#

use PDC to identify items as custom

dim palm
#

what is PDC?

eternal oxide
#

?pdc

eternal oxide
#

its NBT API

dim palm
#

im doing it 1.8

eternal oxide
#

Good luck then

dim palm
#

😦

eternal oxide
#

The only advice I can give for 1.8 is, don;t compare ItemStacks with == or .equals(). Use is Similar()

dim palm
#

this?

eternal oxide
#

try it and see?

hybrid glacier
#

this is my timing report can some one help me to keep the server 20tps

young knoll
#

Ask purpur

charred pollen
#

why doesn't this work :c

dim palm
undone axleBOT
quaint mantle
#

getLevel().equals(30)

#

not getLevel(equals(30))

young knoll
#

No

#

It’s an int

#

Use ==

eternal oxide
#

= 30

quaint mantle
#

^

young knoll
#

That would do it each level past 30

quaint mantle
#

I'm smort

eternal oxide
#

is getLevel() an int?

young knoll
#

I assume so

dim palm
#

setMaxHealt() it's deprecated

quaint mantle
#

I guess so

young knoll
elder blaze
#

Hi! how could I open minecraft with java -jar 1.12.2.jar? Throws me this error: Error: Could not find or load main class net.minecraft.client.Main

hoary perch
#

how can you let a player look at a entity?

harsh totem
hoary perch
#

i have a armor stand, the player turns around it and the player should look at the armorstand

harsh totem
#

So you want to force the player to look at it?

hoary perch
#

yes, exactly

charred pollen
hoary perch
#

i guess you need to use {...} .getLevel().equals(30) {...} @charred pollen

charred pollen
hoary perch
hoary perch
delicate lynx
#

why do you store the player, and then not use it lol

harsh totem
tender shard
#

java.lang.IllegalArgumentException: Missing required parameters: [<parameter minecraft:tool>]

didnt someone else have this error when trying to generate loot results? Because I have the same probblem lmao

dim palm
dim palm
chrome beacon
#

You can use the held item

charred pollen
elder blaze
tender shard
#

I found the solution, you just have to use the player as "killer" in the LootContext.Builder

charred pollen
tender shard
#

even if there is no "killed entity", the player has to be set as "killer"

grizzled owl
#

why does it throw javassist classes error?

dim palm
worldly ingot
#

I would argue it's better to add a modifier than it is to set the base value, but yeah

tender shard
chrome beacon
#

I've only seen people do bad stuff with it

grizzled owl
#

i dont even use it

chrome beacon
#

Is that your plugin

#

?

grizzled owl
#

yes

chrome beacon
#

What is MainL10.a()

grizzled owl
tender shard
#

huh did you obfsucate your plugin

grizzled owl
#

no

tender shard
#

lol okay ?paste your full main class pls

hoary perch
chrome beacon
#

I think you have malware on that server

grizzled owl
chrome beacon
#

I've seen malware with JavaAssist inject itself in to other plugins

#

Which might be the case here

delicate lynx
#

you have malware lol

tender shard
#

you definitely have javassist in your .jar

#

send your pom.xml or build.gradle pls

#

but pleaaase ?paste it

#

dont send the file

chrome beacon
#

...

#

?paste

undone axleBOT
hoary perch
#

xD

grizzled owl
#

nvm

tender shard
#

I dont wanna download a file everytime lol

#

just paste it

grizzled owl
chrome beacon
#

You have malware I'm petty sure lmao

hoary perch
delicate lynx
#

congrats, you have malware

tender shard
#

why are you shading all this stuff?

chrome beacon
#

Can't do that on mobile

tender shard
#

e.g. you are shading lombok

#

well you could just send your .jar and then someone looks at it lol

dim palm
#

xd

grizzled owl
visual tide
#

hm

#

no MainL10 in that jar

#

thats not the jar that that stacktrace came from

tender shard
#

yeah, file and stacktrace don't match up

visual tide
#

but the fact that its obfuscated and doing some javaassist stuff bears an uncanny resemblance to client mod malware

#

so

#

probably malware 😬

patent horizon
#

im a bit confused on how to read/write variables from wiki.vg

#

if i wanted to edit the team name of a packet and the two fields under "add entities to a team", how would i do that

brave sparrow
#

Are you sending the packet yourself as binary data?

patent horizon
#

i think so

brave sparrow
#

Then there are no “fields” as such, that’s the order of the binary data

#

The structure of the packet determines what type of data is expecting to be read where

#

And that determines how many bytes get read

patent horizon
#

so i would just tally up the amount of integers leading up to the one i want as the fieldIndex?

brave sparrow
#

You have to write all the bytes of the packet in the order provided by wikivg yeah

patent horizon
#

i have to write all of them or just in the order the wiki says?

#

i dont plan on creating a new team when an existing one is already there

honest echo
#

there is no there is no net.minecraft.server.v1_19_R0 ? im sure im using build tools version

chrome beacon
#

There isn't

#

Package names now match vanilla

honest echo
#

so how do i send a PacketPlayOutTitle to a 1.18+ server ?

chrome beacon
#

Why not use the api?

dim palm
grim ice
patent horizon
#

there is almost no difference between spigots api

tender shard
undone axleBOT
last swift
#

I have a method that fetches data from a large text file, but because the action takes a while, the server freezes and the TPS drops. How can I make this method multithreaded?

public static MultiBlockStructure getMap(String mapName) {
        File file = new File(mapName + ".txt");
        if (!file.exists() || !file.canRead()) {
            return null;
        }
        MultiBlockStructure list = null;
        try {
            Scanner reader = new Scanner(file);
            while (reader.hasNextLine()) {
                String data = reader.nextLine();
                list = MultiBlockStructure.create(data, mapName);
            }
            reader.close();
            return list;
        } catch (FileNotFoundException e) {
            System.out.println("An error occurred.");
            e.printStackTrace();
            return null;
        }
    }
tender shard
#

run it async, then use a CompleteableFuture or similar to retrieve the result

#

what is AWE?

#

Never had any problems with it

#

Oh wait

#

I only used FAWE

#

and normal WE

dim palm
#

what's best way to remove only 1 item from a player itemstack, like the player has 16 snowballs and i want remove only 1

#

nvm i found the way

tender shard
tender shard
# dim palm what's best way to remove only 1 item from a player itemstack, like the player h...
GitHub

Avoid writing the same code over and over again - use JeffLib for your Spigot plugins! - JeffLib/InventoryUtils.java at 5c0781219ece0bf6fd293deeca1f6e41860a695a · JEFF-Media-GbR/JeffLib

dim palm
last swift
tender shard
dim palm
#

if it works, it works

tender shard
#

why what?

#

?

patent horizon
#

how would i make a fake (packet) entity invisible?

tender shard
#

because HashMap is the return value?!

chrome beacon
#

Int2ObjectMap :)

tender shard
#

good luck returning a Map from a method that claims to return a HashMap

chrome beacon
#

FastUtil go brr

last swift
# tender shard using the scheduler

Ah I see. So something like:

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
    MultiBlockStructure list = null;
    try {
        Scanner reader = new Scanner(file);
        while (reader.hasNextLine()) {
            String data = reader.nextLine();
            list = MultiBlockStructure.create(data, mapName);
        }
        reader.close();
    } catch (FileNotFoundException e) {
        System.out.println("An error occurred.");
        e.printStackTrace();
    }
});
tender shard
#

a HashMap is totally fine for this

#

remember when in 1.17, some library got removed? that was annoying. since then I don't use any included libs anymore

#

I even rewrote Validate class so I dont have to use the builtin apache commons

chrome beacon
#

That would fix it

tender shard
#

when 1.17 came out, many people were still on "dated" 1.16.5 versions or even 1.16.3 or similar

chrome beacon
tender shard
#

I just rewrote everything I needed from apache commons and called it "cherokee" instead of "apache"

tender shard
#

not at the same package location

small current
#

guys will EntityDamageEvent get called with EntityDamageByEntityEvent ?

tender shard
#

org.apache.commons != org.bukkit.craftbukkit.libs.org.apache.commons 🙂 @chrome beacon

chrome beacon
#

Ouch didn't know they relocated it

tender shard
#

yeah and then I had anonther idea

#

I thought I just do a library plugin to make it compatible with newer versions

#

bbuuut

#

the plugin nclass loader doesnt allow to load stuff from "org.bukkit"

#

so that didnt work

#

I thought I just make a plugin that simply provides apache commons at the old, relocated package but yeah, the classloader was like "nope!"

#

and since then I just decided to not rely on any included libs anymore

dim palm
#

best way for nms

#

😄

tender shard
#

that will break in 1.17+

#

since 1.17, the NMS package doesnt include the version anymore

dim palm
#

😨

tender shard
#

I fear the only "proper" way is modules 😦

ashen quest
#

how do I make an entity rotate around a player, kinda like hypixel watchdog

ashen quest
ashen quest
#

yea the thing is

tender shard
#

can you explain it a bit more detailled? no idea what a hypixel watchdog is

ashen quest
#

i am so good at math, god nerfed my math power

ashen quest
patent horizon
#

look into cylindrical vectors

ashen quest
#

theres an NPC that rotates around you in a fast motion

tender shard
dim palm
patent horizon
#

basically you just rotate a vector in a circle and tp something by the vectors offset

ashen quest
#

ty guys

dim palm
#

first google result

#

xd

ashen quest
#

how do i make a citizens npc take damage?

cloud crane
#

Is this also for help with Maven/Java?

ashen quest
#

Java? Not really but go ahead

cloud crane
#

Alright, I need to make an HTTP Request in my plugin, but I also need to parse the json so I added org.json to the dependencies in pom.xml

wooden rover
#

Greetings everyone,

I have come to seek assistance on the topic of NBT tags. I cannot for the life of me find how to apply them to items, as the ItemStack and ItemMeta classes do not seem to possess NBT related methods. I am looking to implement things such as spawning tipped arrows with a specific potion effect. If anyone could help it would be appreciated.

cloud crane
#

But it just goes: Dependency 'org.json:json:20090211' not found

ashen quest
cloud crane
#

Okay

cloud crane
#

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>

ashen quest
#

Yes sir

cloud crane
#

Dependency 'com.googlecode.json-simple:json-simple:1.1.1' not found

#

Pain.

ashen quest
#

Can you show your whole pom

#

?paste

undone axleBOT
cloud crane
#

Ok

eternal oxide
#

Spigot already includes Gson

cloud crane
#

OH

#

Cool

ashen quest
cloud crane
#

Thank you @eternal oxide !

ashen quest
wooden rover
#

I got ignored :(

ashen quest
eternal oxide
#

arrows are already covered in the API,. You don't need NBT

dim palm
#

the easy way

tender shard
#

I always wonder why the heck people still use NBT tags

#

PersistentDataContainer has been around for like 4 years now

#

there is literally no reason at all to use NBT

peak depot
manic furnace
#

How can I achieve it, that one player for example can join on 1.8.9 and the other one on 1.19?

tender shard
#

If yes, hook into netty and translate all incoming and outgoing packets

#

if no, use ViaVersion

manic furnace
#

Yes i mean like it is made on hypixel

peak depot
#

viaversion

#

is your best way to go

tender shard
#

look at ViaVersion's source code

manic furnace
#

i mean code it vy my self

tender shard
#

as said - hook into netty and translate all packets incoming or outgoing from/to players who use a fucked up version

#

or just use viaversion because it already does exactly this perfectly

dim palm
#

?paste

undone axleBOT
grim ice
#

i never did it

#

but thats annoying

#

just make a copy of minecraft at that point

#

imo servers should just have

#

many servers

#

for each supported version

#

e.g

#

one for 1.8 to 1.12

tender shard
#

well but then all servers would be way emptier

grim ice
#

hm

tender shard
#

people should just always use latest or get rekd

#

problem solved

grim ice
#

welp if u have a big server

#

then its ok

grim ice
#

i cant use any version

#

above 1.17

#

i have some weird issue

#

where on any version >= 1.18

#

every around

#

1 or 2 seconds

#

i get 1 fps

#

so my fps is like dis

#

144 fps -> 1 fps -> 144 fps -> 2 fps -> 144 fps -> 1 fps

#

💀

#

and the thing is, this happen even in the main screen

#

like when u start mc

#

i dont need to be in a server or a world

tender shard
#

weird, maybe message mojang support lol

eternal night
#

Do you have the fabric mod suite from caffeinemc ?

#

idk who plays minecraft without it but that might help your FPS issues xD

vocal cloud
#

Sounds like the ram is being all used. Check f3

cloud crane
#

com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive
???

#

I don't understand what's going on now

#
String returnString;

HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(response.toString(), JsonObject.class);
returnString = jsonObject.get("extract").getAsString();
rough drift
#

How to check if inventory is player survival or creative inventory (only the one where you have the armor and stuff)

cloud crane
#

nevermind i had a smoothbrain moment

ashen quest
#

does anyone know how to make maven generate the jar in some other folder

silk nest
#

So I was looking at some files and came across command.yml I was wanting to know more about it so I copy the website address and led me to the bukkit wiki. Instead of showing me the actual wiki part of command.yml it shows me random text from a language I do not understand. I was just wanting to know about the command.yml.

rough drift
#

Show us what weird language you're talking about

silk nest
#

Something like this and it keeps on going having more to it

Lórum ipse talán a körös, völő a legkevésbé aggod
eternal night
#

doesn't sodium like, absolutely trash optifine in terms of performance gains ?

tender shard
#

I couldnt play without xaero's minimap and world map

tender shard
#

sodium is shit imho

#

it has like 10% of optifine's features

ashen quest
#

it boosts my fps tho

tender shard
#

and it needs fabric etc

#

optifine is just 1 click install

eternal night
#

Imagine installing a non-open source software

#

smh

tender shard
#

reads this on macOS

eternal night
#

Yea optifine does a lot in one package

tender shard
#

also did I miss something? because last time I checked, minecraft itself also wasnt open source 😛

tender shard
#

spyyyglasss

ashen quest
#

bruh

eternal night
#

not like there isn't a fabric plugin for that zoom xD

tender shard
#

I get 1 quadrillion fps on vanilla

eternal night
#

I get -1 FPS due to integer overflow ?

ashen quest
#

brah

tender shard
#

I get Double.POSITIVE_INFINITY fps on vanilla

eternal night
dusk flicker
tender shard
eternal night
ornate patio
#

line 37 is scanner = new Scanner(nameListFile); btw

ashen quest
#

the site doesnt load for me

tender shard
#

did you create the datafolder?

ornate patio
#

the folder saves but theres no surnames.txt inside it

tender shard
#

why dont you just do new File(getDataFolder(), "surnames.txt")

#

instead of hardcoding the path

ornate patio
#

i did not know getDataFolder was a thing lmao

tender shard
#

now you know 😄

#

getDataFolder() returns the folder at plugins/YourPluginName/

#

its part of JavaPlugin class

ornate patio
#

ye ye

#

still getting the same error though

tender shard
#

hm but the saving part doesnt throw an error?

ornate patio
#

i think it is actually

#

didnt realize its two errors

tender shard
#

what does the saving error say?

ornate patio
#

im blind lmao

#

i did a print test, inputStream is null

tender shard
#

is that the full error?

ornate patio
#

no thats just the first

#

but thats also causing the second error

ashen quest
#
[22:33:03 ERROR]: Could not load 'plugins\AnnihilationCore-1.0-SNAPSHOT.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `Main.AnnihilationMain'

So this is the error I get, even tho I do have the file in com.annihilation.core.main

yes the yaml has that path as well

tender shard
#

btw instead of using Class#getResourceAsStream, you can just do saveResource

#

YourPlugin.saveResource("surnames.txt")

#

then it automatically saves it

ornate patio
#

oh really

tender shard
#

really 🙂

chrome beacon
ornate patio
#

it has a replace param too

tender shard
#

yeah but

ornate patio
#

so i didn't even need to check if it exists and all that

tender shard
#

you have to check anyway if it exists

#

otherwise it prints a error "Could not save file.txt"