#help-development

1 messages · Page 1794 of 1

narrow cobalt
#

if i was making servers for testing purposes, what is the best server hosting website for free servers?

tacit drift
#

Oracle Cloud

narrow cobalt
#

ok

#

do i need to put my address for making a cloud account?

peak granite
#

so this is better than having an actual host?

narrow cobalt
#

you can seeming allocate 6gigs of ram for the cloud server. is that good?

narrow cobalt
peak granite
#

for a smal server, ye

narrow cobalt
tacit drift
maiden mountain
#

this shouldnt make any sense at all

#

I have a constructor without arguments

narrow cobalt
tacit drift
#

¯_(ツ)_/¯

#

probably

narrow cobalt
#

quote from the post "we're going to create a server with up to 4 CPU cores and 24 GB of RAM! That’s more than enough resources to host a game with 20+ friends with excellent performance (and still have enough leftover to create another server for something else). "

#

thats good

echo basalt
#

Packets

hybrid spoke
#

packets

hybrid spoke
maiden mountain
#

Anyone here familiar with Citizens traits?

tacit drift
#

go on denizen discord

echo basalt
#

Traits are fairly simple

maiden mountain
#

Yeah but i'm getting an error even tho it shouldnt be thrown

echo basalt
#

Show code

maiden mountain
#

But i got a empty constructor

tardy delta
#

do i need to loop through all players to set a prefix for a specific player?

#

i'm using scoreboards

maiden mountain
#

Nvm i fixed it

#

I didnt saw the access modifier was set to protected by default

acoustic pendant
#
  @Override
    public String onPlaceholderRequest(Player player, @NotNull String params) {
        if(player == null) {
            return "";
        }
        if (params.equals("cold")) {
            return PlayerHeight.getCold();
//other class
public double cold;
   public PlayerHeight(double coldp){
        cold = coldp;
}
  public static String getCold() {
        PlayerHeight cold1 = new PlayerHeight(0);
        String coldFormatted = "";
        DecimalFormat coldFormated = new DecimalFormat("#");
        coldFormatted = coldFormated.format(cold1);
        return coldFormatted;
    }```
Hey! how can i solve this error?
https://media.discordapp.net/attachments/551613805176815655/914541021713555456/unknown.png
worldly ingot
#

PlayerHeight != number

#

Whatever your PlayerHeight object is, you need to get it as a number somehow

acoustic pendant
#

yes

tardy delta
#

coldFormatted and coldFormated please

#

dont

acoustic pendant
#

what?

tardy delta
#

choose better names

acoustic pendant
#

oh

worldly ingot
#

Well, no, it's a PlayerHeight object lol

acoustic pendant
#

oh wait

#

i mean

#

cold is a double

worldly ingot
#

Yes but you're doing this

  public static String getCold() {
        PlayerHeight cold1 = new PlayerHeight(0);
        String coldFormatted = "";
        DecimalFormat coldFormated = new DecimalFormat("#");
        coldFormatted = coldFormated.format(cold1);
        return coldFormatted;
    }```
#

coldFormated.format(PlayerHeight)

acoustic pendant
#

well yes

worldly ingot
#

So you should be doing coldFormated.format(cold1.getValue())

#

or however you get that 0 that you passed into that cold1 object

#

Or just pass 0 because it looks constant, but again, I don't know what that object is

#

Either way, you can't DecimalFormat an Object. It has to be a Number

#

PlayerHeight is not a Number lol

acoustic pendant
#

i'm trying to do a instance of public double cold;

worldly ingot
#

So if it's a public value, coldFormated.format(cold1.cold)

acoustic pendant
#

oooh

worldly ingot
#

Get that double from your object somehow because that is what you want to format

#

coldFormated.format(new PlayerHeight(0)); = error
coldFormated.format("Test"); = error
coldFormated.format(0.0); = properly formatted value

acoustic pendant
#

hmm

#

now works

#

but

peak granite
#

if i use config.options().copyDefaults(true); in onEnable does it just rewrite the config to the same as in config.yml file in the src, so it makes it useless to edit the config ?

acoustic pendant
#

@worldly ingotbut now, (before i had cold with static) the value isn't increasing with the method i have

hoary pawn
#

how woul it have to be then?

peak granite
#

idu

outer wind
#

Hi, I am in need of a simple solution that removes all player inventories that are in a specific world.

I need this to stop using an inventory management plugin from like 2012 for a creative world. I want to move creative to a seperate server on bungee but if I down-right remove the plugin, all players that were in the creative world will have those creative items in survival when they log in. Any suggestions?

quasi patrol
#

Anyone know what the gradle thing for MVdWPlaceholder API is?

digital rain
#

how do i check whether EntityDamageEvent is an instanceof EntityDamageByEntityEvent

#

can i use the "instaceof"

misty current
#

yes

quaint mantle
#

you kind of answered your own question

misty current
#

and then you can cast

quaint mantle
quasi patrol
quaint mantle
quasi patrol
#

Also like the entire plugin or for Gradle?

quaint mantle
quasi patrol
peak granite
#

i'm making a /setline command that sets the line number to whatever u choose, how do i get the block the player is facing

quaint mantle
quasi patrol
#

Ikr.

quaint mantle
#

well

  1. try to communicate with server admin
  2. if first didnt work, clone mvdw placeholders sources, build it, and publish to local maven repo
#

and the use it

eager girder
#

Is the 1.18 spigot version now downloadable?

#

Cant find the dl link smh

eager girder
#

even tho he made a post agout it

quaint mantle
#

or jenkins

eager girder
#

u got a link?

#

I tried maven

#

but maven uses the wrong java version

quaint mantle
#

uhm

#

just set it to 17 or smth

eager girder
#

I did

#

@quaint mantle

fast onyx
#

How I can disable movement? Ig I should cancel some event?

quaint mantle
#

or set player speed to 0

fast onyx
#

alright ty

quaint mantle
#

imo the 2 option is cooler

fast onyx
#

Yep

#

player#setWalkSpeed?

quaint mantle
#

yes, btw isnt that deprecated?

fast onyx
#

It is?

#

How's the correct way?

quaint mantle
#

it isnt

fast onyx
#

oh

#

Thanks 👍

quaint mantle
#

just wondered if it was replaced with attribute, like similar methods

wide creek
#

how can I convert exp levels in exp bottles?

quaint mantle
#

manya, help me pls

chrome beacon
wide creek
chrome beacon
#

Google it

#

I just googled "xp bottles minecraft" and it gave me the info that you need

quaint mantle
grim ice
#

make it have a pdc

#

then check if the exp bottle has that pdc

#

then setExperience

#

to maybe 10

#

so u can convert them easily

#

:D

#

this is best way iirc

quaint mantle
#

smart

misty current
#

i'm trying to add a potion effect inside a lambda statement when a certain packet is sent, but whenever the player sends that packet is kicked and this pops up in the console: java.lang.IllegalStateException: Asynchronous effect add!

#

no stacktrace

young knoll
#

It’s async

misty current
#

it's all executed sync

#

unless netty is async

young knoll
#

It is

quaint mantle
#

it is

misty current
#

or some

#

ah

young knoll
#

You need to runTask to sync back to the main thread

misty current
#

aight i guess i can just put it inside a runtask

#

kk thanks

#

actually should i put all my code in a runtask

#

there are multiple api interactions

tardy delta
#

Running sync in async 🤠 🥶

tender shard
digital rain
#

Ik this more of a java question but is there a way to write the thing below in a single line

    if (function(str) == true) {
    }
}```
ivory sleet
digital rain
#

:(

paper viper
#

and also dont do function(str) == true

#

XD

#

you can just do function(str)

ivory sleet
#

I mean you can but it’d look very ugly

digital rain
#

yes ik

#

its was just there for visualization

eternal night
#

I mean, you can just use streams no ?

paper viper
#

depends on what is in the conditional then

eternal night
#

Well, concerning that it is just a function call in the example you should be able to

digital rain
#

thats exactly what i was thinking of, just wasnt sure

fast onyx
grim ice
#
  1. you dont name variables like that, learn Java Conventions
#

why do you never use ur enter button

tawdry schooner
#

ayo chill everyones learning 🙂

grim ice
#

yes

#

:D

fast onyx
grim ice
#

also variables arent named like classes

#

nameThemLikeThis

fast onyx
#

anyway why the event is not registering or why is not working? i see all right

grim ice
#

are you registering

#

the listener?

#

are there any errors?

tawdry schooner
#

@fast onyx are you able to run this in a debug?

grim ice
#

show us ur main class

grim ice
fast onyx
fast onyx
grim ice
#

show us.

#

do you have a config.yml in ur resources folder

#

?

fast onyx
#

yes obv

tawdry schooner
#

Its good troubleshooting practice, helps illustrate walking through the runtime and get to the point where you don't "need to debug for such a simple thing"

grim ice
#

Show us ur main

fast onyx
grim ice
#

also dont access config on run time

#

bro

#

what

#

dont create ur config

#

like that

#

and why is ur main a listener

fast onyx
#

my main is not a listener

#

i need to implement the listener to register the events

quaint mantle
grim ice
#

what

cedar dawn
grim ice
#

bruh

#

who told u that

fast onyx
#

the IDE?

cedar dawn
#

you don't have any events in the main class

quaint mantle
#

and is the event in main class ?

fast onyx
#

no is not

#

is on another class

quaint mantle
#

replace the listener with new ClassName()

digital rain
cedar dawn
grim ice
#

@fast onyx

#

i fixed ur main class

#

wait i didnt

#

1s

#

aha

tawdry schooner
#

the hubris in the room could hold up a building

grim ice
#

and rename ur main class to LobbyTools

fast onyx
#

ok thanks

#

ill try

grim ice
#

dont make methods for simple things like this

#

its good practice when the code is kinda huge and it makes the code messed up

fast onyx
#

still not registering the events

grim ice
#

did u try that?

fast onyx
#

the file u send me?

grim ice
#

show me ur config yml

grim ice
fast onyx
#

i tried, yes

grim ice
#
  • are there any errors in ur block listener after u changed ur main class code
fast onyx
#

no..

grim ice
#

show me ur config yml

fast onyx
#
Config:
  block-place: false
  block-break: false

Messages:
  cannot-place-blocks: "&aSorry! You can't place blocks here"
  cannot-break-blocks: "&cSorry! You can't break blocks here"
grim ice
#

bro

#

its not if(config.getBoolean(PlaceIsEnabled, false)) {

#

its if(config.getBoolean(PlaceIsEnabled){
}

fast onyx
#

i want to check if the place is enabled

grim ice
#

YES

fast onyx
#

so if its on false then cancel the event (?)

cedar dawn
#

i think the second argument is the default

fast onyx
#

what?

grim ice
#

@fast onyx omg

#

u mixed ur logic up

#

ur basically saying

#

" if block-place is true and the player doesnt have permission then stop the event "

#

do if(!config.getBoolean(PlaceIsEnabled) {

fast onyx
#

no?

grim ice
#

dont say no to me

fast onyx
#

if block place is false and player doesnt have permission then cancel event

cedar dawn
#

chill

grim ice
#

lol

fast onyx
#

yes i am

#

if(config.getBoolean(PlaceIsEnabled, false)) {

grim ice
#

.

#

I dont want to help you

#

look for someone else

fast onyx
#

don't help then lol

cedar dawn
#

dude chill

grim ice
#

bro hes wrong and he still thinks hes right

#

wtf

#

the second argument is default

cedar dawn
#

@fast onyx try this

public class Block implements Listener {
    private final lobbytools plugin;
    public Block(lobbytools plugin) {
        this.plugin = plugin;
    }
        @EventHandler
        public void onBlockPlace(final BlockPlaceEvent event) {
            FileConfiguration config = plugin.getConfig();
            final Player p = event.getPlayer();
            String CannotPlaceBlocks = "Messages.cannot-place-blocks";
            String PlaceIsEnabled = "Config.block-place";
            if(!config.getBoolean(PlaceIsEnabled, false)) {
            if(!p.hasPermission("lobbytools.admin")) {
                event.setCancelled(true);
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(CannotPlaceBlocks)));
            }
          }
        }
    @EventHandler
    public void onBlockBreak(final BlockBreakEvent event) {
            FileConfiguration config = plugin.getConfig();
            final Player p = event.getPlayer();
            String CannotBreakBlocks = "Messages.cannot-break-blocks";
            String BreakIsEnabled = "Config.block-break";
            if(!config.getBoolean(BreakIsEnabled, false)) {
                if(!p.hasPermission("lobbytools.admin")) {
                    event.setCancelled(true);
                    p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(CannotBreakBlocks)));
                }
            }
    }

    }
grim ice
#

it only gets executed if the value hasnt been set

cedar dawn
#

@grim ice is right

cedar dawn
#

add ! before config.getBoolean()

grim ice
#

@cedar dawn u did it wrong too

#

lol

cedar dawn
#

what did i do wrong

grim ice
#

the second argument is DEFAULT

tawdry schooner
#

"I don't want to help you"
.....
"But i'll stay here and berate you"

fast onyx
#

istill not working with your code

grim ice
#

lol

fast onyx
#

lol

grim ice
#

and of course its not working

#

read my messages

cedar dawn
#

that if the value is not set

#

it will be false as default

grim ice
#

default only gets used when the value isnt set

#

wait

#

1s

cedar dawn
#

and if the value is set..

grim ice
#

my bad

cedar dawn
#

...

grim ice
#

ur right

fast onyx
#

i told you lol

grim ice
#

caye ur wrong

#

shut up.

fast onyx
#

no

grim ice
#

ah yes

tawdry schooner
#

Isn't this getting away from the core issue which was that the event wasn't registering? Or am I missing something with this block you guys are talking about?

grim ice
grim ice
#

he knows nothing about java and hes insisting that hes right

fast onyx
grim ice
#

..

#

wdym no sense

#

ur whole code makes no sense

tawdry schooner
#

I mean I genuinely thought the main you sent earlier would've resolved the issue

grim ice
tawdry schooner
#

Imean he said he tried it 🤷‍♂️

fast onyx
#

if(config.getBoolean(titleIsEnabled, false)) {

i've another if statement on another plugin, that works perfectly if the config is set to false

#

lol

grim ice
#

I choose the nice way to tell u a solution

#

heres the best way

fast onyx
#

i tried your fucking code i told you not working so stop saying the same

#

lol

grim ice
#

?learnjava

undone axleBOT
grim ice
#

thats the way to solve ur thing

fast onyx
#

im asking for help with spigot not java

#

.

grim ice
#

spigot is java

#

.

fast onyx
#

if you dont want to help then not help

#

.

grim ice
#

im helping you the best way

#

learn java for 1 hour then come back

fast onyx
#

you're literally giving me codes that isn't working

#

lol

grim ice
#

u never tried it

#

show me ur code again.

fast onyx
#

I TRIED

grim ice
#

show me the code u tried.

fast onyx
#

the code u sent me

grim ice
#

send it again

#

from ur IDE

fast onyx
#

(PlaceIsEnable)

grim ice
#

send it

#

again.

fast onyx
#

i told me that

grim ice
#

the whole thing

tawdry schooner
#

Honestly @fast onyx, I myself am not a master Java guy, but when I run into issues like these I abstract portions of the runtime out and add one block of code in at a time to try and diagnose. Thats IF you aren't just going through a debugger.

grim ice
#

@tawdry schooner hes just trollib prob

fast onyx
cedar dawn
#

try adding ! before config.getBoolean()

grim ice
#

IM NOT EVEN CHRISTIAN

#

AND IM CALLING JESUS

#

DO WHAT I TOLD YOU

tawdry schooner
hollow bluff
fast onyx
grim ice
#

okay hes definitely trolling

fast onyx
#

send the fucking message when you said the code

#

SEND IT

#

reply to it

#

JUST REPLY

grim ice
#

1s

fast onyx
#

is wrong

#

completly wrong

grim ice
fast onyx
#

just look at im

#

JUST LOOK

hollow bluff
#

Caye, no one wants to help you if you dont stop acting like this. Everyone here is trying to help you out lf there own time so show some respect @fast onyx

grim ice
#

look at ur code

#

and look at mine

fast onyx
#

just look it again

grim ice
#

caye

tawdry schooner
#

ok anyone feel like helping with my issue now? 🙂

grim ice
#

check the "!"

fast onyx
#

check your code

grim ice
#

ill just ignore this guy hes trolling

fast onyx
#

check it

ivory sleet
fast onyx
#

you told me wrong code

#

just look your code

#

JUST LOOK

grim ice
#

@ivory sleet maybe stop him, hes trolling

tawdry schooner
fast onyx
#

MY GOD

ivory sleet
#

Guys stop debating this non sense

grim ice
#

hes clearly trolling

fast onyx
#

your code: if(!config.getBoolean(PlaceIsEnabled) {

correct code:
if(!config.getBoolean(PlaceIsEnabled)) {

#

you're wrong

#

so stop talking

#

my god

grim ice
#

..

#

check ur code again

fast onyx
#

that doesn't matter, your code is wrong, just stop.

grim ice
#

ur code in ur ide

#

oh god

fast onyx
#

I ALREADY HAVE IT FIXED

ivory sleet
#

Both stop

fast onyx
#

your code was wrong

#

WAS WRONG

tawdry schooner
#

Want to understand the feasibility of using database connectors for things like permission nodes. I recognize other plugins do this, but if I wanted to implement a similar system for my own plugin manager, are there things that should be considered before starting development on such a system?

ivory sleet
#

?kick @fast onyx stop

grim ice
undone axleBOT
#

Done. That felt good.

grim ice
#

are you blind

#

thank you conclure

#

i love you

ivory sleet
#

now please

tawdry schooner
#

Permission state management via DB connectors

fast onyx
#

is not

#

my bad

#

you forgot )

#

🤦

grim ice
#

ur ide should tell u that?

#

ur telling me my code is wrong becuz i forgot a )

#

im using discord to write

#

whatever, stop this

fast onyx
#

if you can even make a correct code then don't help, the conversation ends here, i'll still asking here and you won't reply me again for avoid problems 👍

digital rain
#

what event for playerhitting

cedar dawn
#

EntityDamageByEntity i think

grim ice
#

^

#

and check if the entity damaged

digital rain
#

i just wondered whether there was a player event for that

grim ice
#

is an instance of player

digital rain
#

seems like not :(

fast onyx
#

double message? 🤔

fast onyx
#
if(!config.getBoolean(PlaceIsEnabled)) {
            if(!p.hasPermission("lobbytools.admin")) {
                event.setCancelled(true);
                p.sendMessage(ChatColor.translateAlternateColorCodes('&', config.getString(CannotPlaceBlocks)));
            }
          }
fast onyx
#

just ignore me

#

.

cedar dawn
#

the event is probably being registered twice

#

can you show your main class?

grim ice
fast onyx
onyx fjord
#

i even checked diffchecker

grim ice
#

ignore him btw

fast onyx
grim ice
#

hes telling me im wrong becuz i forgot a )

onyx fjord
#

ohh

#

i mean

fast onyx
onyx fjord
#

intellij will fix it for ya automatically btw

tawdry schooner
#

Caye is intellectually rolling us all

grim ice
#

hes so egoistic even though his code is shitter

fast onyx
#

ok

grim ice
#

cuz u didnt forget

#

u just dont know it

#

ANYWAYS

fast onyx
#

i told you to stop

onyx fjord
#

joe biden

fast onyx
#

so stop

cedar dawn
#

! gives a whole different meaning to the statement ...

ivory sleet
#

?kick @grim ice stop

undone axleBOT
#

Done. That felt good.

onyx fjord
#

poor hex 😭

#

😵‍💫

tawdry schooner
#

🔨

fast onyx
grim ice
#

God

fast onyx
#

1s

onyx fjord
tawdry schooner
onyx fjord
fast onyx
#

prob bug on copy paste

#

idk

onyx fjord
grim ice
#

did he decompile someone's plugin

fast onyx
onyx fjord
#

no, its his own tos

fast onyx
onyx fjord
#

yes im aware i was writing message on general

grim ice
#

oh ive seen many like this

ember estuary
#

How would you parse an int from an argument without using try catch?

I heard you shouldnt use Error-Throwing for validating simple user-input

fast onyx
# grim ice oh ive seen many like this

1.) There isn't the right channel to talk
2.) I don't care about your non-constructive opinions about my plugins, they are made for my friend server so they're very simple but i decided to publish them for boring
3.) There isn't the right channel to talk.

quaint mantle
fast onyx
#

no

#

there isn't the right channel to talk just cut it out, go dm and criticize me all you want that i won't care anything

nimble cobalt
#

xd

tawdry schooner
grim ice
#

dont mind it im just saying ot

onyx fjord
grim ice
#

u can check for each letter of that argument

#

and check if its an int

onyx fjord
grim ice
#

and add it to a new string

fast onyx
#

just stop talking here for non development topics

onyx fjord
#

i just replied to someones message chill dude

grim ice
#

then convert the string to an integer

ember estuary
#

i mean command args

#

to be precise

grim ice
#

so ur trying to check if an argument is parsable or smth

ember estuary
#

so the user enters /command 123

#

and im trying to get the 123 as an int

tawdry schooner
ember estuary
#

ofc i can use parseint and try catch

#

but i heard its not good using error throwing for user input

nimble cobalt
ivory sleet
ember estuary
#

u can type cast from string to int? what?

tawdry schooner
#

but you should try catch that type cast I would think. I can't imagine why it wouldnt be good to do that..

ember estuary
ivory sleet
#

No

ember estuary
#

o.O

#

well than thats the perfect solution

tawdry schooner
ember estuary
#

xD

ivory sleet
#

But yes try catch is a little bit expensive but throwing errors are most expensive, even so are they still negligible in regards to performance, if you’re not using it as some sort of regular control flow.

tawdry schooner
#

5x the runtime, 1/5 the RAM 😎

quaint mantle
ember estuary
#

i cant find Ints::tryParse

tawdry schooner
ember estuary
#

is it actually Ints.tryParse(string) ?

#

never heard of Ints before

ivory sleet
ember estuary
#

oh

ivory sleet
#

Which happens to be shaded into spigot

ember estuary
#

oh nice

#

so i can just use it without any additional import

ivory sleet
#

Pretty much

ember estuary
#

no idea what shading means

grim ice
#

i think

ember estuary
#

but i assume its a dependency sort of?

ivory sleet
#

It means the library classes are contained inside the spigot jar

ember estuary
#

so included dependency

ivory sleet
#

So basically they’re provided for you at runtime thus you can just add them to your compile time classpath.

ember estuary
#

alright

#

regex vs try-catch, which is less costly

grim ice
#

regex i think

ember estuary
#

alright, will use that to validate the number then

quaint mantle
#

dont forget that regex isnt fast

ember estuary
#

but try catch is even slower

#

isnt it

grim ice
#

trycatch is even slower only if the exception is caught

quaint mantle
#

did you just ran unit tests

grim ice
#

@ember estuary when the try catch doesnt handle an exception

#

so like

#

content of try wont throw NFE

#

it will be faster

#

than the regex

#

I would prefer using a try catch

#

regex ugly

tawdry schooner
#

Probably a dumb question, but unless this is a giant plugin doesnt this nuance between try catch and regex basically mean nothing? How much is it really saving you..?

ivory sleet
grim ice
#

yeah

#

that little performance difference

#

wont do much

#

trycatch would be the main option

ivory sleet
tawdry schooner
#

I mean if we were talking like a hypixel server that is doing a custom plugin yea it'd be a big deal i'd concede but all us in here probably aren't dealing with crazy scale

sudden raft
#

I use my own implementation of Integer#parseInt that returns OptionalInt and it's empty if the string is invalid

ivory sleet
#

I believe Integer::parseInt can be a bit slow since it supports all bases, so yeah hypixel probably uses their own variant.

grim ice
#

iirc try catch stops jvm from doing its optimizations and shit

#

im not sure tho

ivory sleet
#

Yuh sometimes

grim ice
#

o

#

and hypixel has their own spigot

#

kekw

ivory sleet
#

🥲

quaint mantle
#
public static boolean isParsable(String str) {
        int startIndex = 0;
        
        char[] chars = str.toCharArray();
        if(chars[0] == '-') startIndex = 1;

        for(int i = startIndex; i < chars.length; i++) {
            char c = chars[i];
            if(!(c >= '0' && c <= '9')) return false;
        }
        return true;
    }
``` if you care about speed that much
grim ice
#

bro lmao

#

this is the dumb idea i got

#

and its actually good?

quaint mantle
#

whats wrong? no regex overhead

grim ice
#

yeah

ember estuary
#

true yeah

grim ice
#

i suggested this but i said its a joke

ember estuary
#

had this in mind too

grim ice
#

and its actually good? dayum

quaint mantle
#

i mean, why should it be bad?

grim ice
#

because most of my ideas are bad

fast onyx
#

PlayerPickupItemEvent

#

is this deprecated?

young knoll
#

Yes

#

Use EntityPickupItemEvent

fast onyx
#

#getEntity() instead of #getPlayer() right?

young knoll
#

mhm

quaint mantle
fast onyx
#

it is ig

young knoll
quaint mantle
#

Oh

#

there should be only 1 dot

ember estuary
#

just count the dots

#

xD

#

using a boolean or something, that goes true after the first dot. second dot -> return false

quaint mantle
#

also numbers shouldnt start with zero, like 023 or 0001

young knoll
#

I mean that is valid iirc

#

It will just drop the leading 0s

quaint mantle
#

Oh fr

steep jewel
#
    public static void dropItem(ItemStack item, Location loc) {
        Bukkit.getScheduler().scheduleSyncDelayedTask(ViperUHC.getInstance(), () -> loc.getWorld().dropItemNaturally(loc, item), 1);
    }```
#

Why doesn't dropItem or dropItemNaturally work

#

Yes this is being ran, I've put debug messages.

#

No the itemstack is not Air

#

Yes the location is valid

#

there are no exceptions

#
    @EventHandler
    public void onMove(PlayerMoveEvent e) {
        e.getPlayer().getWorld().dropItem(e.getPlayer().getLocation(), new ItemStack(Material.GOLDEN_APPLE, 2));
    }``` This also doesn't work
#

Yes it's registered

quaint mantle
#

"Who asked"

clever dirge
#

Im trying to change the command of a plugin to something different, not change the function just like what you type to get the function can someone help ❤️

steep jewel
quaint mantle
#

On what version you are

steep jewel
#

1.8

quaint mantle
#

Ew

#

Check if it works on newer versions tho

grim ice
#

tf

#

that should work

#

how

proud basin
#

Try iterating over the players inventory

steep jewel
#

It's not relevant to me if it works on the newer versions, I need to be able to do it on this versino lmao

steep jewel
grim ice
#

do npcs have inventories

steep jewel
grim ice
#

if they do then spawn one

#

and give it the item

#

then kill it

quaint mantle
#

reject legacy smh

steep jewel
#

Legacy is still the superior version of minecraft

steep jewel
round finch
#

is it possible to flip armorstand upside down?

#

or sideways

young knoll
#

Name it dinnerbone

round finch
#

i were thinking setpostion

#

something similar to that

proud basin
#

What am I doing wrong using GridPane https://imgur.com/Jidq9Ci
burger is 0,3 and fries is 1,3 although thinking should I use vbox as root for this

steep jewel
young knoll
#

Because we don't support 1.8

quaint mantle
#

Isnt 1.8 here at all, so instead of completely ignoring you i try to, maybe, change your mind?

steep jewel
#

If that was an option, I would be on a newer version. But I'm on an older version for a reason.

quaint mantle
#

ok

hexed hatch
#

Probably for a bad reason lol

steep jewel
#

sure

round finch
#

is this possible to do?

hexed hatch
#

Nope

#

Armor stands can only be rotated horizontally

#

However

#

I believe you can get a lying down effect with two armor stands positioned correctly

#

The base will always be on the ground though

round finch
#

thanks i will try using a player instead

#

lay down and hide parts

hexed hatch
#

with two of these, if positioned right and set to invisible, you might be able to get the effect you're looking for

#

but it'll take some bullshit

opal juniper
#

i dont imagine it will ever look that convincing

hexed hatch
#

I've seen it done actually

#

it was pretty good, there's more values to play with

round finch
#

can you have show elytra on a player while they're invisable?

#

or hidden parts

young knoll
#

Armor will render even when invisible

hexed hatch
#

well define invisible

#

are you using the invisibility effect?

#

if so, yeah

#

if you're using packet fuckery, then no

round finch
#

i were thinking making a invisible player with visible wings

hexed hatch
#

for what effect?

round finch
#

if invisable postion what i need i will use that to make that effect

#

^^

hexed hatch
#

invisible entities with armor still show their armor

#

and this is what it looks like

#

just give the entity a elytra on the chest slot and the effect, it should create the effect you're looking for

round finch
#

Nice!

#

now i only need to learn packet stuff

#

CB_wave_boy thanks for everything

torn shuttle
#

I know itemstack has serialization and deserialization methods but those go to maps, is there a quicker way to json/yml or any other text format?

stone sinew
torn shuttle
#

the map itself isn't directly serializable right? I was having issues with that

#

maybe I'm being dumb but it seems like something is missing between the step of having a map and the step of having a viable configuration string

stone sinew
torn shuttle
#

so which method is getting used to turn the map into a json format?

#

ultimately I need to get this into a string format

stone sinew
torn shuttle
#

so I can dump it into sqlite

royal vale
#

What is ((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion(); in the current NMS? Since it's all letters I can't tell.

stone sinew
royal vale
stone sinew
#

np

royal vale
stone sinew
royal vale
stone sinew
#

one sec.

#

remove the () lol

#

sorry

#

((CraftPlayer) player).getHandle().b.a.k;

royal vale
#

Thats a Channel

mortal hare
#
Anectotally, I have been sued (successfully, twice) by a company who bought the first company, to whom I sublicenced open source contributions I made. The seller did not tell the buyer, and they litigated against me, after the fact, privately. They were arguing that they'd bought a closed source product with no rights reserved by third parties whatsoever. I courteoulsy hinted them to my open source repositories and told them their assumption was wrong, they went to court and had me take my open source repository down and pay hefty fines. Not something you want, be careful.
#

dude wrote open source software and added as dependency for his company

#

and he got sued for using company's property

#

after company got bought by another company

#

LOL

#

Basically he payed fines for his own software which was open source before it was added

stone sinew
royal vale
#

Which u have to get the version from

chrome beacon
#

I recommend you use the mapped NMS

royal vale
#

I just don't know which letter returns the protocol

royal vale
#

I'm using Maven

next plume
chrome beacon
#

Then you're done

quaint mantle
royal vale
#

Or can u use 1.17.1-R0.1 to

chrome beacon
#

1.17.1 works too

stone sinew
#

I'm not finding NetworkManager.getVersion()... What version were you using this in?

granite beacon
#

How do I add a fake player to a scoreboard?
When looking for it on google/spigot I couldn't find anything for 1.17.1 that wouldn't return errors.

This is my code for the fake player creation.

        ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();

        final PacketContainer packet2 = protocolManager.createPacket(PacketType.Play.Server.PLAYER_INFO);
        packet2.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER); // action

        WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.randomUUID(), "Steve");
        PlayerInfoData playerInfoData = new PlayerInfoData(gameProfile, 1, EnumWrappers.NativeGameMode.fromBukkit(GameMode.CREATIVE), WrappedChatComponent.fromText("Steve"));
        packet2.getPlayerInfoDataLists().write(0, Collections.singletonList(playerInfoData));

This is the function I use to add a player to a scoreboard

    private PacketContainer getScoreboardPacket(String team, String entryToAdd, int mode) {
        PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.SCOREBOARD_TEAM);
        packet.getStrings().write(0, team);
        packet.getIntegers().write(0, mode);
        ((Collection<String>) packet.getSpecificModifier(Collection.class).read(0)).add(entryToAdd);
        return packet;
    }

When tested on a regular player it works fine. But when I use it on the fake player called "Steve" it does nothing

        try {
            protocolManager.sendServerPacket((Player) sender, packet2);
            ProtocolLibrary.getProtocolManager().sendServerPacket((Player) sender, getScoreboardPacket("a", "Steve", 3));
            ProtocolLibrary.getProtocolManager().sendServerPacket((Player) sender, getScoreboardPacket("b", ((Player) sender).getName(), 3));
        } catch (Exception e) {
            e.printStackTrace();
        }

Anyone knows why this is occurring?

sullen marlin
#

PROTOCOLLIB FOR SCOREBOARDS???????

granite beacon
#

Nono

#

I'm not using it to make scoreboards

sullen marlin
#

'getScoreboardPacket'

granite beacon
#

I'm just using to add a fake player to a scoreboard

sullen marlin
#

which you can do with the api.....

granite beacon
#

How?

sullen marlin
#

literally as normal

royal vale
sullen marlin
#

scoreboard entries are just strings

#

spigot-api not spigot

chrome beacon
chrome beacon
granite beacon
sullen marlin
#

yes

#

or whatever the normal method is

royal vale
chrome beacon
#

You need to rum BuildTools

royal vale
#

I just did

torn shuttle
royal vale
#

Do I need to put the jar somewhere?

stone sinew
#

@royal vale what version were you able to run NetworkManager.getVersion()?

torn shuttle
#

I converted it to a map, cast the map to hashmap, converted the hasmap to a string

#

the did the same thing backwards, works great

torn shuttle
#

...or it doesn't work

#

hm

royal vale
#

Just old nms code with I got from somewhere

chrome beacon
quaint mantle
stone sinew
# royal vale No version

((CraftPlayer) player).getHandle().playerConnection.networkManager.getVersion()
I didn't find NetworkManager.getVersion() in any version 1.8.8 and up. So either I'm missing something or that field/method isn't in networkmanager anymore.

royal vale
#

I just don't have it myself yet

stone sinew
royal vale
#

Doing it rn

royal vale
calm star
#

i get this error when trying to build my code:
Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.2.4:shade (default) on project com.santapexie.santa_koth: Error creating shaded jar: D:\Documents\Coding\Plugins\TestingServerKoth\plugins (Access is denied)

granite beacon
# sullen marlin or whatever the normal method is

Yeah it's still not adding it to the fake player with:

final PacketContainer packet2 = protocolManager.createPacket(PacketType.Play.Server.PLAYER_INFO);
packet2.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.ADD_PLAYER); // action
WrappedGameProfile gameProfile = new WrappedGameProfile(UUID.randomUUID(), "Steve");
PlayerInfoData playerInfoData = new PlayerInfoData(gameProfile, 1, EnumWrappers.NativeGameMode.fromBukkit(GameMode.CREATIVE), WrappedChatComponent.fromText("Steve"));
packet2.getPlayerInfoDataLists().write(0, Collections.singletonList(playerInfoData));

Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();

Team team = scoreboard.getTeam("a");
team.setPrefix("§c§lA ");
Team team2 = scoreboard.getTeam("b");
team2.setPrefix("§b§lB ");

team2.addEntry(sender.getName());

try {
  protocolManager.sendServerPacket((Player) sender, packet2);
  team.addEntry("Steve");
} catch (Exception e) {
  e.printStackTrace();
}
buoyant viper
#

and is the server running as youre trying to build?

calm star
#

no

calm star
buoyant viper
#

those are just the only things i could think of being an Access issue

royal vale
calm star
royal vale
#

@chrome beacon this is weird. Spigot is remapped, but there's no playerConnection in the handler

young knoll
#

It's Mojang mapped

calm star
#

nvm

young knoll
#

I think it's just connection

royal vale
#

There's no network manager

stone sinew
#

I asked before and it was a whole thing about use spigot, use spigot-api, use spigot remapped etc... Well I've been trying for the passed few days and none of these methods are allowing me to use bukkit methods... can't even use JavaPlugin

#

Anyone been able to get 1.18 to build right?

young knoll
#

What are you trying to do?

chrome beacon
chrome beacon
young knoll
#

Yeah

#

spigot-api and spigot remapped have been working fine for me

chrome beacon
#

^

stone sinew
#

Missing tons of libs and other api methods to.

chrome beacon
#

Show us the POM

sullen marlin
#

its because he isnt using maven

#

or gradle

#

or anything

#

💀

young knoll
#

Ah yep that would do it

chrome beacon
#

;/

young knoll
#

This works with gradle compileOnly group: 'org.spigotmc', name: 'spigot', version: '1.18-pre5-R0.1-SNAPSHOT'

sullen marlin
#

but you've already been told what the solution is, depend on all 30 jars/libraries

stone sinew
#
  <dependencies>
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot-api</artifactId>
           <version>1.18-pre8-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
    
    <dependency>
           <groupId>org.spigotmc</groupId>
           <artifactId>spigot</artifactId>
           <version>1.18-pre8-R0.1-SNAPSHOT</version>
           <scope>provided</scope>
    </dependency>
  </dependencies>
``` With this one I lose all the "nms" classes even some craftbukkit classes like `CraftWorld` and such.
young knoll
#

Use remapped

stone sinew
young knoll
#

spigot doesn't give you access to NMS anymore

#

Because Mojang put jars in your jar

sullen marlin
#

it does actually

young knoll
#

Oh?

sullen marlin
#

he should have CraftWorld, idk what his issue is there

#

but I'm not even sure I believe he's using maven :p

young knoll
#

Oh yeah it does

#

Did that change from the first releases of 1.18-pre5

sullen marlin
#

yes

young knoll
#

Nice

royal vale
torn shuttle
sullen marlin
#

Players only have one protocol version, the current one

torn shuttle
#

tbf I can make my project look like that and not strictly speaking be using maven lol

#

can I point out the irony in that itemStack.serialize() is not serializable ?

sullen marlin
#

Hm?

#

ConfigurationSerializabpe

torn shuttle
#

yeah, but not java serializable

sullen marlin
#

Cause java seriakizable sucks

torn shuttle
#

word

#

but still

#

ObjectSerializer.toString((HashMap<String, Object>) itemStack.serialize());
failing makes my cri every tim

#

well

#

guess i have to use the other thing

#

BukkitObjectOutputStream right

young knoll
#

seriakizable

torn shuttle
#

it's called serializable because it will make a serial killer out of you when you actually try to implement it into your project

fast onyx
#

any guide to get started on making jars working with bungee & spigot with the same jar?

calm star
#

how can u make a command so it does /game start or /game stop and it auto shows it when u press tab like most commands usually?

torn shuttle
#

ngl multiple attachemnts per discord message is starting to feel like a bad idea

calm star
#

ye

stone sinew
#

I already said what the issue was read above xD

torn shuttle
#

alright

stone sinew
# calm star unyone?
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
    List<String> commandSuggestions = new ArrayList<>();
    return commandSuggestions;
}
torn shuttle
#

my quests are now fully serializable

#

boy that way painful

stone sinew
torn shuttle
#

took 6h:30min because I spent 5 hours hitting my head against the walls trying to get apis to do it for me

stone sinew
#

and implement TabCompleter

calm star
#

ye

#

how do i make 2 part commands in the first place?

calm star
#

so i can do /game <thing>

stone sinew
# calm star so i can do `/game <thing>`
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if(cmd.getName().equalsIgnoreCase("<command>")) {        
        if(args.length == 0)
            sender.sendMessage("Command ran with no sub commands.");
            
        if(args.length > 1) {
            if(args[0].equalsIgnoreCase("<subcommand>")) {
                // code here
            }
        }
        return true;
    }
    return false;
}
calm star
#

do i need to do anything extra in the plugin.yml?

stone sinew
calm star
#

ye ik

#

like for the 2 part one

stone sinew
#

no

calm star
#

ok

buoyant viper
#

uh oh... streams...

#

@lavish hemlock i think this guy needs a lesson....

fierce jolt
#

I made a little lib to help with commands

#

that does exactly those things, but easier

stone sinew
buoyant viper
#

iirc javas stream api is the furthest thing from fast

young knoll
#

The overhead isn't that bad

stone sinew
young knoll
#

No it isn't

stone sinew
calm star
#

doing this didnt send me the msg:

        if(command.getName().equalsIgnoreCase("koth")) {
            if(args.length == 0)
                sender.sendMessage("Command ran with no sub commands.");

            if(args.length > 1) {
                if(args[0].equalsIgnoreCase("start")) {
                    sender.sendMessage("Command ran with no start commands.");
                }
            }
            return true;
        }
buoyant viper
stone sinew
buoyant viper
#

will try later, not at pc rn

young knoll
#

They used to be slower, now I find a lot of mixed info online

#

I guess Java has improved things

stone sinew
#

So aside from the code used... does anyone know why the imports aren't working for certain things?

sand gull
stone sinew
calm star
#

when i do ```java
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(command.getName().equalsIgnoreCase("koth")) {
if(args.length == 0) {
sender.sendMessage("Command ran with no sub commands.");
}

        if(args[0].equalsIgnoreCase("start")) {
            sender.sendMessage("Command ran with no start commands.");
        }

        return true;
    }
    return true;
}

``` and run /koth it says an internal error has occured

sand gull
# stone sinew Again... I've already done my testing. Its faster then a for loop in the case ab...

I know how Java works. What I said is correct, but as I stated, it heavily depends on what you're looping over. Java 8 streams are generally slower for simple loops because of the amount of time that's required for stream initialization and value transmitting. Various benchmarks seem to suggest that streams are slower than loops for most tests. Though not catastrophically slower, and in some cases, parallel streams can give a useful speed up

stone sinew
calm star
#

but when i do this:

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        if(command.getName().equalsIgnoreCase("koth")) {
            if(args.length == 0) {
                sender.sendMessage("Command ran with no sub commands.");
            }

            if(args.length > 1) {
                if(args[0].equalsIgnoreCase("start")) {
                    sender.sendMessage("Command ran with no start commands.");
                }
            }
            return true;
        }
        return true;
    }
``` `/koth` works but `/koth start` doesnt
young knoll
#

You are checking for > 1 args

#

so 2

#

Use >= 1

calm star
#

sry yh didnt see that

stone sinew
young knoll
#

It's fine now, lul

sand gull
spring river
#

Hey, is Bukkit.getPluginManager().callEvent() waiting the execution of all listeners ?
For exemple, is the condition evaluated after the execution of listeners (so I can knew if the event was cacelled) :

Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) { ... }```
young knoll
#

Yes

spring river
#

Ok thx ❤️

buoyant viper
#

i could just be carrying that idea into new java thinking they haven't touched them for reasons beyond my /own/ comprehension rn

calm star
#

how can u add a bar much like the enderdragon one?

#

saying custom text

buoyant viper
#

i think theres a bossbar api for it

sullen marlin
#

ye

lavish hemlock
sullen marlin
#

search for boss in javadocs

lavish hemlock
#

foreach is literally a single method call, instantiation, and loop.

sullen marlin
#

fk I need more ram, 1.18 is a pig

lavish hemlock
#

Streams are faster in only two situations:

paper viper
#

i personally only use streams for either

  1. method references (cause they look concise)
  2. parallel streams
lavish hemlock
#
  • Parallel (although parallel streams can hang your computer if not used correctly)
  • Lazy evaluation
waxen plinth
#

Streams are slower but they're not abysmal

#

Someone I know ran a proper benchmark of them

paper viper
#

I'd take a small ms delay for readability any day

lavish hemlock
#

It makes a difference if you use a lot in your program.

waxen plinth
#

~20% slower than loops

lavish hemlock
#

That's not negligible imo.

waxen plinth
#

It's not

paper viper
#

Yeah its not

lavish hemlock
#

And readability isn't improved by that much for it to be worth it.

paper viper
#

Method references

waxen plinth
#

But it's not terrible either

paper viper
#

are pretty readable

#

ngl

waxen plinth
#

Streams are fine if your code isn't super performance critical

paper viper
#

like Bukkit.getOnlinePlayers().forEach(Player::kick);

#

or something

waxen plinth
#

They can really clean up your code too yeah

paper viper
#

Readability

lavish hemlock
#

Difference is that's not a stream.

paper viper
#

Oops

#

but u get the idea

waxen plinth
#

I absolutely love streams, they're not perfect but they can save a lot of effort

paper viper
#

if i do operations

#

still the same concept

#

i can still use method refs

waxen plinth
#

I use streams for tab completions for my commands

paper viper
#

same

lavish hemlock
#

I personally prefer declarative operations.

waxen plinth
#

tabStream(c -> Bukkit.getOnlinePlayers().stream().map(Player::getName))

#

👌

lavish hemlock
#

I enjoy the idea of having good performance

paper viper
#

Redempt do you know uncle bob

waxen plinth
#

No

paper viper
#

Ah

waxen plinth
paper viper
#

hes just a guy thats super good at talking about good code craftsmanship

waxen plinth
#

I am sure it will really impact the server dramatically

paper viper
#

if you use brigad, its all async anyways

#

at least for me it is

waxen plinth
#

I don't use brigadier

#

I use my own

#

But commands and tab completions have never been an issue sync

paper viper
#

Yeah of course

waxen plinth
#

And if they are then you probably have bigger things to worry about

paper viper
#

idk, just a random thought lol. But his videos really helped me create good code

quaint mantle
#

need some help with Particles, might be an easy thing -- tried googling didnt really lead me anywhere... how do i get coloured Particle.NOTE particles?

runic mesa
#

Any resources to learn how to make an enchantment book that would work in an anvil

misty current
#

get the stored enchantments from the itemmeta

#

it's not the same as enchanting the book

runic mesa
#

Huh

misty current
#

put a check if meta is instanceof too

quaint mantle
#

or just make a giant try{ and catch{ 😎

outer sorrel
#

how can i support hex colour code things thats like

&#fb0e0eJ&#f6300du&#f2520bs&#ed740at&#e89708D&#e3b907o&#dfdb05o&#dafd04m
#

?

#

i can only do it if theres a & infront of them all

#

it spells "JustDoom" (discord name)

#

so a single one is

&#fb0e0e
onyx fjord
#

Good apis

outer sorrel
#

ill have a look, thanks

onyx fjord
#

Libraries*

#

Mb

sullen marlin
#

seems impossible via particle?

#

Note has no data

runic mesa
sullen marlin
#

maybe Effect?

#

oh double data

quaint mantle
#

is it 0.RGB?

sullen marlin
#

looks like just note / 24 sets the colour

quaint mantle
#

i forgot how it works

#

ohhh

#

so i should use Random#nextInt(24) for random rainbow

sullen marlin
#

you can probably only use those 12 colours

#
  • 24 colours
#

or between them whatever scale

quaint mantle
#

perfect

sullen marlin
#

you';d have to check client ode

proud basin
#

How can I fix this? https://imgur.com/XHnMZP2 using GridPane ```
Button btnBurger = new Button("Burger");
root.add(btnBurger, 0, 3);

    Button btnFries = new Button("Fries");
    root.add(btnFries, 0, 4);
    
    Button btnSoda = new Button("Soda");
    root.add(btnSoda, 1, 4);
buoyant viper
#

add soda after burger?

#

or position manually

proud basin
#

I'm wanting the soda button beside fries

#

and I am positioning them manually

buoyant viper
#

just opened my plugin after not touching for abt a month.. lolwtf?

org.gradle.internal.resolve.ArtifactNotFoundException: Could not find spigot-api-1.17.1-R0.1-SNAPSHOT.jar

https://paste.md-5.net/motujocefo.cs this is my build.gradle

misty current
#

can you play a sound at a location instead of playing it to a player?

buoyant viper
misty current
#

oh it's in the world class not location

#

thanks

#

interface*

buoyant viper
paper viper
#

i just upgraded my gradle wrapper

#

to 7.3

#

and it seemed to fix it

buoyant viper
#

i restarted intellij with invalidated caches too and it just went nah too

#

ill try updating gradle

paper viper
#

Yeah

buoyant viper
#

wow ok yeah that fixed

#

what the fuck

paper viper
buoyant viper
#

sorry for ping md

paper viper
#

😂

buoyant viper
#

6.8 -> 7.0+

paper viper
#

Oh wow you were on a pretty old version

#

i upgraded from 7.1.1