#help-development

1 messages · Page 2237 of 1

golden turret
#

bruh

#

are stairs marked as isInteractable in the Material?

humble tulip
#

I dont think the plugin is in the plugins folder

eternal oxide
#

From that startup he has zero plugins

coral valve
#

Okay I'm having issues with the plugin.yml library setting again.

I don't really need to use it here but it should work and it's not.

When I add a dependency to the libraries section like so:

libraries:
  - "org.mapdb:mapdb:3.0.8"

Paper and spigot seem to load all versions MapDB's dependencies:

https://paste.md-5.net/copiqedobe.md

For example, instead of loading just "eclipse-collections-api:7.0.0" it loads version 7.0.1, 7.0.2, 7.0.3, etc. Surely the class loader should only load one version for each dependency?

My build.gradle:

https://paste.md-5.net/sotekekega.bash

tender shard
#

I was talking to someone else

small current
#

how can i use hex color codes in a message

#

like #88118a

eternal oxide
#

md5 ChatColor.of

small current
#

ChatColor.of("#88118a")

#

?

eternal oxide
#

yes

#

So long as its the md5 import

small current
#

thanks

tender shard
#

You can also simply use the legacy format

#
ChatColor.translateAlternateColorCodes('&',"&x&f&f&0&0&0&0This is color #FF0000");
distant wave
#

i need to help with lore guys

#

lore with that says that rarity

#

the format should be: obf_char EPIC obf_char the entire text is bold and dark purple

#

could anyone help me assemble the string?

tender shard
#

what is "obf_char" supposed to be

distant wave
#

obfuscated character

#

like

#

&kA

#

iirc

tender shard
#

but why do you want to add the obfuscation code AFTER your text again?

eternal oxide
#

perhaps to reset? &f&r

distant wave
#

wait ill show u how its supposed to look

tender shard
#

you want it to look like this
@ RARE @ where @ is the random garbage obfuscated stuff right?

distant wave
#

its not same color + dungeon shouldnt be ´there

tender shard
#

yeah alright

#

one sec

#
List<String> lore = Arrays.asList(ChatColor.translateAlternateColorCodes('&',"&5&l&k@ &r&5&lRARE &r&5&l&k@"));
distant wave
#

cool thanks 👍

#

1 q

#

whats that @

tender shard
#

the @ can be any character

distant wave
#

oh cool

tender shard
#

since it's &k = obfuscated, it doesn't really matter what you use there

distant wave
#

cool

zealous edge
#

I want to make sure they can't drop the barriers, but the rest we can drop, but it doesn't work.

#

wait

#

how do you write in code here?

tender shard
#

or you paste it

#

?paste

undone axleBOT
zealous edge
tender shard
#

erm why did you hardcode the entity id

zealous edge
tender shard
#

how did you come up with the number 166?

zealous edge
tender shard
#

the entity id will be a different number everytime a player drops an item

#

you want to check the item's itemstack's Material type instead

zealous edge
#

yes

tender shard
#
    @EventHandler
    public void onDrop(PlayerDropItemEvent event) {
        Player player = event.getPlayer();
        if (player.isOp()) return;
        if (event.getItemDrop().getItemStack().getType() == Material.BARRIER) {
            event.setCancelled(true);
        }
    }
#

so first: You check whether a player is op by using Permissible#isOp(), not by checking if they have a permission called "op"

#

and then, you compare the type against the Material enum. Numeric IDs have been removed in 1.13 and they also have nothing to do with entity IDs, which is what you were using

tender shard
#

np

brittle lily
#

Hey Guys I'm setting player's inventory contents on config. But its saving null items(empty slots) too how can fix it

humble tulip
#

Don't?

#

Why is it a problem

#

Just check if the item is null when iterating the list

humble tulip
eternal oxide
#

sounds like he's just pushing the contents to teh config without parsing

eternal oxide
#

lots of nulls

distant wave
#

defense=100, but its showing something else

#

why

humble tulip
#

What is \u2748

humble tulip
distant wave
humble tulip
#

Cuz you'd see 100 in there somewhere

brittle lily
#

I'm doin' like this

ItemStack[] items = p.getInventory.getContents;
plugin.getConfig().set("Items", items);

this is not my full code I just writed this

humble tulip
#

Yeah

#

Well do a for loop

distant wave
#

im setting it once

eternal oxide
#

are you ever changing the defense?

distant wave
#

nope

humble tulip
#

And save the slot number with the respective item if it's not null

distant wave
brittle lily
#
for(ItemStack items : p.getInventory().getContents(){
}

somethng like that?

humble tulip
#

To console

distant wave
#

ok

brittle lily
humble tulip
#

If items[i] is null, you continue else you set items.i to the item

#

You do the opp to get it back

brittle lily
#

I get it bro Thanks!

humble tulip
#

Np

distant wave
eternal oxide
distant wave
#

yy

#

im doing that

eternal oxide
#

print it without the unicode character

distant wave
eternal oxide
#

yep

distant wave
#

weird

eternal oxide
#

Not really

tender shard
eternal oxide
#

you are getting a decimal value then adding teh value of the unicode to it

#

then you are printing it as a string

tender shard
#

just remove the ( brackets )

#

I still wonder what Player#getDefense() is, becaue it's not inside bukkit' player interface

humble tulip
#

A player object he made maybe

tender shard
humble tulip
#

I mean a custom plauer class

#

That's all it could be

eternal oxide
#

because its inside () (player.getDefense() + "\ulah") it takes the first type to decide what to do

#

the first is an int so it assums math

distant wave
tender shard
distant wave
#

yy

#

thanks

#

its working

brittle lily
#

Hey Guys How Can I set items on GUI on config. I mean if player add some item on GUI I will set this on config.

iron glade
#

Anyone knows if you can just create another jet brains account to get another trial?

balmy fox
eternal oxide
#

Eclipse is probably better than VSC for Java

#

Both free though

earnest forum
#

notepad >

eternal oxide
#

God, could you imagine this channel if we told beginners to use Notepad 😦

onyx garden
#

How to brake line in item name if there drop on ground with long names?
I would set more line for item "DropOnGround" because it looks better by long names.
RegularFormat: |
&b{Amount}x
&2{Item} {Timer}

#

Can any body help?

earnest forum
#

you have to use armour stands

onyx garden
#

without ArmorStands

#

please

earnest forum
#

then no

#

entities only have 1 line in their name

balmy fox
eternal oxide
#

The bestest evar!

zealous edge
#

I want to make sure that when I make a command it sends a message to all the server, you have how to do it?

ruby fjord
#

Hello, I would like to set an Item in the player OFF Hand and at the same time, I would like to cancel any events that let the player take,drop,move or change the item in OffHand.
Any Idea on which events should I look?

eternal oxide
#

So many

ruby fjord
#

Yeah, there are too many events

eternal oxide
#

?jd-s Go there and type event in the top right

undone axleBOT
eternal oxide
#

Inventory Click, drag, player drop...

ruby fjord
#

I have already done that, I am asking to see if there is someone that already did this and has some suggestions

#

Like possible bugs etc

tender shard
zealous edge
#

I want to make sure that when I make a command it sends a message to all the server, you have how to do it? pls help me

tender shard
#

Bukkit.broadcastMessage

#

or loop over all players and do sendMessage on each of them

zealous edge
#

okay

onyx garden
tender shard
#

for Bukkit.broadcastMessage? o0

zealous edge
tender shard
#

you want to send a title to all players?

zealous edge
#

yes

tender shard
#

loop over all online players, and send a title to each of them

zealous edge
tender shard
#

Bukkit.getPlayers() returns a Collection<Player>. Loop over it and then do player.sendTitle(...) for each of them

#

what exactly is your question? how to loop over a collection?

zealous edge
zealous edge
tender shard
#

yeah that'll work. but you could also just use a regular for loop. it actually doesn't matter

balmy fox
#

What happend to org.bukkit

crude estuary
#

Rebuild

tender shard
subtle folio
#

org.nokit

eternal oxide
#

?bootstrap

undone axleBOT
#

Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.

Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163

ornate mantle
#

guys how do i find out if my plugins are too bulky and make optimisations

#

optimisations specifically

quiet ice
#

depends on what you want to optimize

ornate mantle
#

how do developers know about things that are too heavy and memory consuming and overcome that

ornate mantle
quiet ice
#

Well generally good intuition (e.g. (auto-)boxing being expensive, etc.)

#

However another good technique is profiling your application which can be done through spark or similar

ornate mantle
#

whats autoboxing

quiet ice
#

And memory is usually not an issue unless you are consuming absurd amounts of it

lost matrix
quiet ice
# ornate mantle whats autoboxing

Integer a = 1; // Automatic boxing
int b = a; // Automatic unboxing
Integer c = (Integer) b; // Explicit boxing
int d = (int) c; // Explicit unboxing
int e = c.intValue(); // Also explicit unboxing

lost matrix
#

Everything else might be premature optimization which you should not worry about

quiet ice
#

Also, if you want do profiling to improve performance, don't bother using timings as depending on your codebase you'll easily fall back to doing relatively stupid optimisations

dark harness
#

There is no option to get the staff who banned a player inside Ban/Playerkickevent?

lost matrix
tender shard
#

wrong reply

#

why

river spear
#

I am using InventoryClickEvent and I want to get the item count when I insert an item in a GUI but event#getCurrentItem is null and when I use getCursor I get the item but the wrong quantity because you just right click can click and insert 1

subtle folio
tender shard
#

yeah it's your task now to create a kick command

#

go ahead!

subtle folio
#

working on it rn

#

you got it boss

tender shard
#

goood

balmy fox
#

Unless ofcourse I moved it 😅

lost matrix
#

If you want to scale the velocity then you can just get the players velocity and multiply it by some amaoun

#

Otherwise you would calculate the vector from-to and set it as the new velocity

#

yeah try that. But "1" wont change anything

#

should be. Try it out and tell us if it works. Try on a zombie or something.

brittle lily
#

How Can I set players name on Tab and chat

#

I found

buoyant viper
#

minecraft is weird

harsh matrix
#

Adding libraries to plugins using Gradle

lost matrix
#

add a small amount to y
The enemy isnt knocked back if its feet are touching the ground

#

addY(0.1)

#

And this is a LOT of knockback

eternal night
#

does the entity already have the knockback velocity on the damage event 🤔

lost matrix
#

Not sure. But if it sometimes works then it migh have.

small current
#

what event is called when the block under a block like pressure plate turns into air and the pressure plate drops ?

lost matrix
small current
#

the pressure plate dropping and me removing it in the listener

lost matrix
snow sluice
#

like tnt run?

lost matrix
#

Another approach would be to listen for the PlayerInteractEvent, check if its physical and done by the feet, and then simply remove the pressure plate (maybe one tick later)

gritty urchin
#

Hey, I'm trying to destroy a whole tree when one block of the tree is broken.

#

The problem I have is large oak trees' wood blocks are not connected always

raw prairie
#

where can I find more info around the permissions.yml ? E.g. is this something a plugin has access to, or do plugins have to read the file explicitly?

gritty urchin
#

and when I get all connected blocks of a specific type e.g. leaves, if it is a forest multiple trees are destroyed

#

How do I destroy an individual tree?

ivory sleet
#

probably runnable

solemn olive
#

how can i check if the player is paused or not?

lost matrix
#

Depends on what you are doing

tardy delta
#

👀

lost matrix
solemn olive
#

when player press esc

eternal night
#

that is purely client side

tardy delta
#

thats client side

#

🥷

lost matrix
gritty urchin
solemn olive
#

I want to make it so that if the player press esc, then a text appears above his head

lost matrix
earnest forum
#

pausing doesn't work in multiplayer so can't really do that

lost matrix
#

He could as well run around with his menu or inventory open

tardy delta
#

just check for any click/ interact or move event i'd say

#

which then means the player isnt afk

potent pecan
#

is there an event that is called when a player collides on another one?

misty current
#

if I have 2 class objects, can I check if the first one is a child class of the second one?

lost matrix
misty current
#

is classB the child class?

heavy marsh
#

Hi, I have been looking through the forums to try solve this issue but couldn't find any exact explanation so I am going to ask here.

I am using PrepareItemCraftEvent to create a custom recipe to convert a custom key item back to a tripwire hook. It works fine if there is only 1 key in the crafting grid (removes the key when the result is taken) but if there is multiple keys in the grid slot it either doesn't clear the grid when taking the result or the amount of keys in the grid slot will double. What am I to do to make sure the grid is cleared when the player takes the result?

Here is the code: https://srcb.in/W4jk99hh8o
What happens:
https://gyazo.com/d243eb184d9701795dafd025c36e2315.gif
https://gyazo.com/62dca86598c454bcff8770054b6f732a.gif

lost matrix
misty current
#

thanks

lost matrix
tardy delta
#

its the other way around i think

earnest forum
#

runnables are kept in sync with the game loop

lost matrix
#

Yes its the other way around.

earnest forum
#

so if the tick was to slow down in game the runnable will also slow down

lost matrix
earnest forum
#

Bukkit runnables that is

misty current
#

so superClass.isAssignableFrom(childClass)

earnest forum
#

Runnables that are ran using the bukkit scheduler are synced

tardy delta
#

with the tick loop

lost matrix
#

Really depends what time resolution you need and if you want a relation to the game time (ticks) or the real time.

tardy delta
#

or how its called

earnest forum
#

a while loop is synced with the computer

lost matrix
#

In minecraft everything is related to the game time

earnest forum
#

if a runnable was running every 20 ticks and the game slowed down to 10tps it would take 2 real life seconds to run

lost matrix
# heavy marsh help please

This is expected behavior. When crafting in minecraft then crafting one recipe reduces each ingredient by one.
Take wood for example: The output is 4 Planks but you always only reduce the input by one.

heavy marsh
brittle lily
#

Hey Guys. I have A Custom Entity I set Event When Player Hit him Its Sending Broadcast Message But When Players hit with bow its doesnt sending any message

eternal night
#

I mean

#

you are agressivly casting the damager to player

brittle lily
#

ohh

eternal night
#

that will error if anything but a player hurts the entity

brittle lily
#

rightt

eternal night
#

in the case of an arrow, the arrow itself is the damager

brittle lily
#

Yeah Bro You are right thanks!

heady spruce
#

Does anybody know how to commit / deploy your compiled plugin when compiling in maven?

eternal night
#

deployment should rarely be the job of the build tool

lost matrix
eternal night
#

ohhhh

#

they mean deploy to a maven repo ?

brittle lily
#

Guys this is the first time i've tried something like this. is it wrong or is it the way it should be?

lost matrix
#

i have no idea what they want....

eternal night
#

ah xD

heady spruce
# eternal night they mean deploy to a maven repo ?

yea basiclly that. im currently coding an api for my server system so i dont have always repeating code in every plugin. and i want to use it with maven. so i just put it in the pom like spigot or bungeecord. so i want to deploy it to github and then just do it. but i dont know how to it automatic, because i dont want to always put it in there manually

eternal night
heady spruce
eternal night
#

Yea basically setup your deploy plugin

#

and then just run that in github actions

heady spruce
sage patio
#

How i can know how much I is in a itemstack display name ? (not i just I)

eternal night
#

I mean, ehhh loop over the characters and check ?

heady spruce
sage patio
#

i mean

#

in 1 itemstack

#

like Diamond (Lvl I) and Diamond (Lvl II)

#

how can i know how much I is in that displaynime like 2 or 3

lost matrix
eternal night
#

^^

brittle lily
#

Guys I have an idea. I am doin' boss plugin right now (fight on arena) I wanna spawn boss every 30 min. Can I do like that?

int min = X;

if(this.min == 0){
//spawn boss
}
this.min--;
// and if boss dead this.min = X; 
#

I'm gonna use runnable its just example

ocean lion
#

XD'

brittle lily
#

I mean, Its time. for example 6800 seconds

int time = 6800;
if (this.time == 0){
//spawn boss
}
this.time--;
//and on another event class if boss dead, I will set time to 6800 again. And It's gonna reset every 6800 seconds.(I shortened the code there is Bukkit Runnable and runtasktimer too
twilit roost
#

https://youtu.be/2-KrYRji6lE
any clue how to make this rotate evenly ?

this is what I use :

public void rotateLeft(){
    double tps = 1;
    double add = wheelRotationSpeed*tps*1;
    if(curTexture!=3)
        curTexture--;
    if((wheelRotation+add)>=360)
        wheelRotation = (wheelRotation+add)-360;
    stem.setCurrentRot(wheelRotation-add);
    if(wheelRotation<=(maxWheelRotation*-1)){
        wheelRotation=-1*maxWheelRotation;
        curTexture=3;
        return;
    }
    wheelRotation-=add;
}
public void rotateRight(){
    double tps = 1;
    double add = wheelRotationSpeed*tps*1;
    if(curTexture<7&&curTexture>4) {
        curTexture++;
    }
    else{
        curTexture=5;
        return;
    }
    if((wheelRotation+add)>=360)
        wheelRotation = (wheelRotation+add)-360;
    stem.setCurrentRot((float) ((float) wheelRotation+add));
    if(wheelRotation>=maxWheelRotation){
        wheelRotation=maxWheelRotation;
        setCurTexture(5);
        return;
    }
    wheelRotation+=add;
}

private void updateWheelUI(){
    Player p = occupiedBy;
    BaseComponent  bc = new TextComponent();
    bc.setFont("wheel");
    int curRot = curTexture;
    System.out.println(curRot);
    if(curRot==0)
        bc.addExtra(CharEntry.WHEEL_ROT0);
    else if(curRot == 1)
        bc.addExtra(CharEntry.WHEEL_ROT1);
    else if(curRot == 2)
        bc.addExtra(CharEntry.WHEEL_ROT2);
    else if(curRot == 3)
        bc.addExtra(CharEntry.WHEEL_ROT3);
    else if(curRot == 4)
        bc.addExtra(CharEntry.WHEEL_ROT4);
    else if(curRot == 5)
        bc.addExtra(CharEntry.WHEEL_ROT5);
    else if(curRot == 6)
        bc.addExtra(CharEntry.WHEEL_ROT6);
    p.spigot().sendMessage(ChatMessageType.ACTION_BAR, bc);
}
lethal roost
twilit roost
lethal roost
#

ah ok

brittle lily
#

Just I wanna Spawn my boss every 6800 seconds. Thats Why I'm strtuggling with this time. and, thanks you are right

ivory sleet
#

depends on their visibility

quiet ice
#

Does anyone know if there is a way to publish maven artifacts through ftp or sftp (latter via the key and not with the standard passphrase) when using gradle?

brittle lily
#

Oh, Thanks

#

Oh I know How to use it. Just I wanted to ask it will work or Is there any easier way

eternal night
#

PacketChatListener, bam

lethal roost
# twilit roost `new ItemStack(Material,(int) amount)`

wait how would i do that with this line? gives me an error when i try that
this is what i have
if (playerInventory.first(Material.DIAMOND) == playerInventory.getHeldItemSlot() && mainhandItem.getType() == Material.AIR) {

wary harness
#

ran in problem from some reason mobs are not spawning from spawners

#

any easy way to find out

#

what is preventing it ?

ivory sleet
#

well, I'd say for package private classes it might be fine for them to share (common) names

distant wave
#

In item, can i somehow store data in it? Like there would be counter that would add 1 when id kill smth

wary harness
#

tried to killall mobs on server in hope they will start

#

spawning but no help

brittle lily
#

Thanks!

wary harness
#

and does some one has any good plugin suggestion for antycheat

wary harness
#

is it better then spartan

eternal night
#

wat

#

yea pls pdc

#

lore is pretty trash as a data storage option on items

distant wave
#

I dont want to make it visible

glossy venture
#

its a countdown

violet mortar
#

I always used NBTs on custom items as identifiers so I could patch/hotfix existing items

eternal night
#

pdc 👀

quiet ice
#

BukkitUnsafe

distant wave
short raptor
#

I have these two events.. the issue is that there's a crossover when it's a player killing player death, because the top one fires as well as the bottom one. I can't figure out a way to make it so that it's always the bottom one, EXCEPT for the case where it's a player killing player, where the top one would be used instead.

I could add the code from the bottom one into the top one as an else to the getDamager() instanceof Player but this only works for when the player is damaged by another entity, not for ALL types of deaths.

violet mortar
eternal night
#

?pdc

violet mortar
#

But NBT shouldnt require another lib if Im correct

eternal night
#

Well, NBT would need reflection

#

or NMS

quiet ice
#

Or UnsafeValues#modifyItemStack

eternal night
#

how would you read it

lethal roost
eternal night
#

with modifyItemStack

quiet ice
#

?stash lemme see if I can find an equally cursed solution heh

undone axleBOT
eternal night
#

there isn't yet

#

also that would be absolute PAIN

#

you'd have to construct SNBT

quiet ice
#

Myeah, that would require reflection

#

?jd

quiet ice
#

Ah nice, bungee chat docs are down

distant wave
#

Thanks guys

violet mortar
glossy venture
#

oh ye

#

didnt know it was that wold

#

old

quiet ice
violet mortar
heady spruce
ivory sleet
violet mortar
mighty vine
#

Hello guys.

    @EventHandler
    void onJoin(PlayerJoinEvent event){
        Player player = event.getPlayer();
        event.setJoinMessage("Welcome " + player.getName() + " to the server!");

        player.sendMessage(ChatColor.GRAY + "Have a great day on our Server \nIf you need help do /help");
    }

This is my code but the JoinMessage gets send after the sendMessage. How can I change that easily?

tardy delta
#

?scheduling

undone axleBOT
tardy delta
#

delay the sendmessage by a few ticks

mighty vine
#

thank you

tender shard
#

you can use it like this:

Map<String,Map<Material,Integer>> map = pdc.get(namespacedKey,
                 DataType.asMap(DataType.STRING, DataType.asMap(DataType.asEnum(Material.class),DataType.INTEGER)));
#

it's further explained in the javadocs

brittle lily
#

My codes Working Awesome!

tardy delta
#

i should go back to making plugins instead of those stupid discord bots 😂

brittle lily
#

here I created method with Countdown name and I'm calling th

#

callin this method when server enable

tender shard
#

are you counting down the remaining time every tick / second?

#

you should rather store a timestamp or so

brittle lily
#

Its setting time -1 every 20L so 1 second

tender shard
#

yeah that'll work when you have 20 TPS

#

otherwise not so well

#

i'd rather store the "desination time" and then calculate the remaining time everytime you need it

brittle lily
#

oh and.. wait

brittle lily
#

Its restarting when Boss die

sage patio
#

How I can change Anything (Lvl I) to Anything (Lvl II) (String)
Anything can be actually anything, i just want to change the level

tender shard
#

and vice versa

sage patio
#

i've a simple system for upgrading armor in my server

#

its like changing Cartel Chsetplate (Lvl I) to Lvl II and III

tender shard
#

erm so what actually is your question? 😄

tardy delta
#

any good guide about how to make a console listener (System.in), it should be running while the program is running and its not for a spigot plugin btw :)

#

i did some stuff with a scanner but its kinda primitive i'd say

tender shard
buoyant viper
#

idk

sage patio
tardy delta
#

simpbot thing?

tender shard
#

no, another one

tardy delta
#

red-discordbot?

tender shard
tardy delta
#

ah its a fork

tender shard
eternal night
#

iirc we already suggested using the PDC for data storage

#

instead of parsing

brittle lily
#

Thats cool 🙂

eternal night
#

?pdc

lethal roost
#

why is this giving me an error? if (playerInventory.getItem(0) == Material.DIAMOND) { }

eternal night
#

an itemstack is not a material

#

your IDE should already be screaming at you

tender shard
tender shard
#

you want to check the item's Material (inv.getItem(0).getType() == Material.DIAMOND)

lethal roost
#

i got it, thx

arctic moth
#

apparently doing /time set day crashed my server i have no code dealing with day/night

tardy delta
tender shard
tardy delta
#

ooh

tender shard
#

so basically the main method simply parses the input and shoves it into the bot instance, which then parses all the commands. so it doesnt matter whether you enter commands on discord or from the command line

arctic moth
#

new pfp?

tender shard
#

yeah i moved the flag to my banner lol

arctic moth
#

lol

tardy delta
#

i see

#

and im wondering what the difference is between ClassLoader#getResource and getResourceAsStream, i know their return type is different but i just need to get the file object so which one is the most suitable?

tender shard
#

getResource just returns a URL. getResourceAsStream calls getResource and returns null if getResource returns null, otherwise it calls openStream on the URL

#

so if you don't need an inputstream, just use getResource

lost matrix
tardy delta
#

its a json file im trying to read :)

tender shard
#

yeah you don't get a file if you don't have a file

tender shard
lost matrix
#

Just pipe the istream into a string

quiet ice
#

json file within jar or somewhere else?

tardy delta
#

within the resources folder so i guess thats within the jar yes

lost matrix
#

Actually i think gson has some utils for istream

quiet ice
#

it's just new String(is.readAllBytes(), StandardCharsets.UTF_8); anyways

tender shard
#

if I need a resource as List<String> i always just do it like this (don't mind the class names, I was bored yesterday)

public class HotEGirls {

    public static class InYourArea {

        public static class WantTo {

            public static List<String> readAFileFromResources(final Plugin plugin, final String fileName) throws IOException {
                try (final InputStream input = HotEGirls.class.getResourceAsStream(fileName);
                     final BufferedReader reader = new BufferedReader(new InputStreamReader(Objects.requireNonNull(input)))) {
                    return reader.lines().collect(Collectors.toList());
                }
            }
tardy delta
#

your class names are pretty hot

tender shard
#

thanks bro

lusty raft
#

why do they want to readAFileFromResource?

tender shard
#

because it contains some json

tardy delta
#

mye lets look for a way to convert that inputstream to a json thing thing

#

🤔

tender shard
tardy delta
#

idk which json library im going to use

lusty raft
#

Is this for MC plugins or java in general? saveResource in spigot can read json

#

from what I remember

tardy delta
#

the only thing i ever used was the json-simple thing

#

nah java in gerneral

lusty raft
#

Ah ok

tender shard
#

in spigot you could even just pass the inputstream of the json into YamlConfiguration lol

tardy delta
#

true lol

minor garnet
#

how i get the packetentitymetadata from a player?

lost matrix
# tardy delta idk which json library im going to use

For Gson:

 private final Gson gson = new GsonBuilder().disableHtmlEscaping().create();
 
 public JsonObject readJsonFromResource(String resourceName) {
   @Cleanup InputStream is = getResource(resourceName);
   @Cleanup InputStreamReader isr = new InputStreamReader(is);
   return gson.fromJson(isr, JsonObject.class);
 }
tender shard
#

hate comments against lombok incoming

glossy venture
#

hwhat is cleanup

tender shard
#

its basically like try/resources

quiet ice
#

And for org.json:json:

        JSONObject json;
        try (InputStream is = getClass().getClassLoader().getResourceAsStream(resourceName)) {
            json = new JSONObject(new String(is.readAllBytes(), StandardCharsets.UTF_8));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
tardy delta
#

ah i was doing like

#

ah and there isnt a constructor that takes a string as parameter, only a map

modest garnet
#

How do you set a permanent potion effect?

tardy delta
#

this worked

#

thanks :)

lethal roost
#

if i wanted to check if the player is holding an item AFTER they pick up an item and that said item enters the inventory, how would i do that?
if i just listen to EntityPickupItemEvent and check the mainhand item, the code will check the mainhand before the picked up item would actually enter the inventory, which isn't what i want

lost matrix
lethal roost
#

yeah

lost matrix
#

Then you simply need to check the mainhand one tick later

lethal roost
#

how do i do that?

lost matrix
#

?scheduling

undone axleBOT
ashen quest
#

i think u need to use bukkit scheduler

#

yep

lethal roost
#

aight thx for the help!

ashen quest
#

smile is fast af

tardy delta
#

always

ashen quest
#

thats what she said

tardy delta
#

thats the spirit

#

🫂

tardy delta
#

we summoned a wild alex

ashen quest
tardy delta
#

quick break the spawner

tender shard
ashen quest
#

yo

tardy delta
ashen quest
ashen quest
#

your bot likes to lie

#

my crush moved to a new city yesterday 🥲

lost matrix
#

F

tardy delta
#

only kafkaz has no bitches

#

oh then add you too

lethal roost
#

1L is 1 tick in a bukkit scheduler?

eternal night
#

indeed

lost matrix
glacial trellis
lethal roost
#

aight gotcha, thanks guys

glacial trellis
#

I get this error

eternal night
#

your disk is full

tender shard
lost matrix
ashen quest
glacial trellis
#

Dms

ashen quest
#

use imgbb

tardy delta
#

!verify

undone axleBOT
#

Usage: !verify <forums username>

tender shard
lost matrix
# glacial trellis cant send images here but

Btw you should keep your disk usage below 90% at all times because the free space might be scattered which can lead to very expensive restructuring / defragmentation when writing new data.

glacial trellis
tender shard
#

but you don't

glacial trellis
#

I have 10 gb, Im using 5.57 gb

#

on my game server

misty current
#

can I make a method called from another thread wait before executing if it has already been called and has not returned yet by another thread

tender shard
#

then your hoster is shitty and overbooked their disks

glacial trellis
#

so its a host issue

tender shard
lost matrix
#

I hope you dont pay more than 3 bucks for a trash server that only has 10GB of disk storage

lost matrix
river oracle
tender shard
lost matrix
tender shard
#

D:

river oracle
#

I only ever look at the pfp I was so confused for a bit

tardy delta
#

looked better with da rainbow 😭

lost matrix
#

Why would you want to do that?

tardy delta
#

oh my eyes

#

i was reading "save json to a database"

tender shard
lost matrix
#

I was hoping for a more technical explaination

lethal roost
#

so the effect still isn't getting applied to the player, any idea why?

        scheduler.runTaskLater(plugin, () -> {
            if (mainhandItem.getType() == configMaterial) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 12096000, 0, true));
            }
        }, 1L);```
i pick up a diamond (that's what the configMaterial is, i made sure twice) and it appears in my mainhand but i don't get the effect
lost matrix
#

To achieve what exactly?

lost matrix
lethal roost
#

ah i see

lost matrix
#

And what does that have to do with structures?

tender shard
#

i'm confused now

lost matrix
# tender shard i'm confused now

Ok. Then its quite simple

  public World createNewWorld(String worldName) {
    WorldCreator creator = new WorldCreator(worldName);
    // Do your setup of the creator here
    return Bukkit.createWorld(creator);
  }
dense falcon
#
        Date date = new Date();
        System.out.println(date.toString());

        String time_ban_config = plugin.getConfig().getString("players." + player.getUniqueId() + ".time_ban");
        if (time_ban_config.toString().equalsIgnoreCase(date.toString())) {
            System.out.println("Ban termine");
        }
``` I would like to check if `date` is equal or higher than the `time_ban` in my config file, how can I do it?
lost matrix
#

What you can do is have a zip file that contains the template world. Simply unzip the file async and load the world afterwards.

lethal roost
lost matrix
# dense falcon ```java Date date = new Date(); System.out.println(date.toString...

You should use Instants for that. If you compare two strings then there is absolutely no context for the program to know that you are comparing timestamps.
The easiest way to store a timestamp is to simply use the unix time. (which is a long. Def google it.)
Then your comparison would look like this:

  public boolean isBanTimeOver(Player player) {
    Instant now = Instant.now();
    long banEndTimestamp = plugin.getConfig().getLong("players." + player.getUniqueId() + ".time_ban");
    Instant banEnd = Instant.ofEpochMilli(banEndTimestamp);
    return now.isAfter(banEnd);
  }
dense falcon
lost matrix
dense falcon
lost matrix
#

You should treat methods as a blackboxes. And the method should always tell you exactly what it does without you having to look into it.
So if you have a method:

  public boolean isBanTimeOver(Player player) { 
    // Some random stuff you dont know
  }

What do you think the method should do?
This should answer your question.

#

Im asking the method: "Is the ban time over for (Player)" and the method answers with "yes" or "no"

dense falcon
#

Yes.

dense falcon
eternal night
#

that does not look like epoch millis

lost matrix
modest garnet
#

Anyone recommend a API to use for GUI creation

lost matrix
dense falcon
eternal night
#

interfaces is kinda cute

dense falcon
lost matrix
modest garnet
#

i mean like in game GUI

lost matrix
dense falcon
lost matrix
tardy delta
#

c# is pretty easy to use for guis

lost matrix
lost matrix
tardy delta
#

getPlayerExact shh

#

yes

lost matrix
subtle folio
#

fancy seeing you here

tardy delta
#

and now you''re here

eternal oxide
lost matrix
tardy delta
#

:D

#

people are that evil that they eventually call fields in a records as the name of the getters

#

record Config(String getToken, long getId)

subtle folio
#

lombok moment

lost matrix
#

But thats just a dumb fix

tardy delta
#

i hate it calling methods like that

#

if it would be structs mye

#

hmm they are

#

@subtle folio i got enough of slashcommands for today

subtle folio
#

LMFAO

tardy delta
#

i tried to get used to it but they suck

subtle folio
#

in plain jda slash commands are bad

#

use chew-utils

#

makes it so nice and lovely

tardy delta
#

not like that improves it much

#

i looked at their code

subtle folio
#

it really does

#

so much easier

#

personally atleast

tardy delta
#

._.

subtle folio
#

.-.

tardy delta
#

my brain is kinda hurting

subtle folio
#

exactly

tardy delta
#

wdym lambdas good

subtle folio
#

lambda supremecy

tardy delta
#

when hating it

subtle folio
eternal oxide
#

effective final is annoying at times, but thats all I can think of.

subtle folio
#

check out slash commands in there

tardy delta
#

true

subtle folio
tardy delta
#

wheres da wiki 👉👈

#

hmm

subtle folio
#

sorry for flood

tardy delta
#

have they never heard of a switch

subtle folio
lost matrix
#

Yes

tardy delta
#

no a internet switch

eternal oxide
#

gravity

lost matrix
#

^

eternal oxide
#

gravity is applied every tick

lost matrix
#

This only makes sense if you would have two bodies with a mass

dense falcon
#
        if (plugin.getConfig().getBoolean("players." + player.getUniqueId() + ".banned")) {
            String reason_ban = plugin.getConfig().getString("players." + player.getUniqueId() + ".reason_ban");
            long time_ban_config = plugin.getConfig().getLong("players." + player.getUniqueId() + ".time_ban");
            Timestamp ts = new Timestamp(time_ban_config);
            Date time_ban = new Date(ts.getTime());
            if (plugin.getConfig().getInt("players." + player.getUniqueId() + ".time_ban") == (long) 0) {
                player.kickPlayer(ChatColor.RESET  + "[" + ChatColor.LIGHT_PURPLE + "Pranction Ban" + ChatColor.RESET + "]" +
                        " \n Raison : " + reason_ban.toString() +
                        " \n Duree/Prend fin : " + ChatColor.BOLD + "Permanante");
            } else {
                player.kickPlayer(ChatColor.RESET  + "[" + ChatColor.LIGHT_PURPLE + "Pranction Ban" + ChatColor.RESET + "] " +
                        " \n Raison : " + reason_ban.toString() +
                        " \n Duree/Prend fin : " + ChatColor.BOLD + time_ban.toString());
            }
        }
``` How can I avoid messages with proxy, disconnected or other stuff like that?
lost matrix
#

What is your goal? Do you want to display an expected trajectory path before a player shoots?

#

Wait. Games dont work like that.

#

We just have an acceleration constant

lost matrix
#

Gravity in real life is also done "every tick"
But there is no atomos of time (that we know of). Thats why calculating
the velocity of an object is essentially a differential equation

lost matrix
#

This is y of x. This will work.

#

But the approach is a bit expensive. You can def do better.

#

The arrow just travels in 2 dimensions so he can simply use a 2D projection. No need for 3 axis.

#

Thats the hard part

#

And the biggest problem is finding out g
I would just try to approximate it numerically

brave sparrow
#

Use the minecraft gravitational constant no?

lost matrix
#

Actually. Let me write a quick plugin that will find out how it works in minecraft.
I know for entities that minecraft actually has a drag coefficient.

#

brb in like 20min

brave sparrow
#

¯_(ツ)_/¯

dense falcon
misty current
#

how can I format numbers like this 1.467.465,98

misty current
lost matrix
river oracle
#

Fairly inexperienced with reflection, So I'm curious if its possible to expose something like this and use it as its a parameter in a method I want to use.

  private static interface Supplier<T extends Container> {
    T create(int arg0, Inventory arg1);
  }```
eternal oxide
devout bronze
limber owl
#

1st can you provide stacktrace, 2nd never seen this type of registering commands, and I don't think so if it works, so, how long have you been working with spigot?

#

@devout bronze

lost matrix
#

Little disclaimer: This wont be easy because arrows have drag

limber owl
tardy delta
#

looks like code that codedred would do in his videos

devout bronze
#

in the getter of database in main file u could see on pastebin

quiet ice
devout bronze
#

it shows "The return type is incompatible with JavaPlugin.getDatabase()"

tardy delta
#

its true lol

eternal oxide
#

JavaPlugin has no getDatabase() method

#

and your import/return type is fine. its a standard getter

devout bronze
#

soo umm whats the fix

limber owl
#

so it shows error on runtime?

devout bronze
#

no i havent tried to run it yet

eternal oxide
#

its an error in your IDE?

limber owl
#

so it shows red underline in ide?

devout bronze
#

yes

eternal oxide
#

I see no reason for it. If using InteliJ invalidate caches and restart

limber owl
#

try putting one line above getDatabase() saying @Override

devout bronze
#

am using eclipse

eternal oxide
#

maven?

limber owl
#

do this

    @Override
    public Database getDatabase() {
        return database;
    }
devout bronze
#

nope not working

limber owl
#

where the error exactly, on function or the line inside?

devout bronze
#

on the function

limber owl
#

accept my friend request and send me screenshot of it

devout bronze
#

yes i did

dense falcon
#
[20:13:05] [Server thread/ERROR]: Could not load 'plugins\Pranction-1.0.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.5
        at org.bukkit.craftbukkit.v1_18_R1.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:314) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:141) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.loadPlugins(CraftServer.java:410) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.reload(CraftServer.java:918) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at org.bukkit.Bukkit.reload(Bukkit.java:789) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchCommand(CraftServer.java:829) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at org.bukkit.craftbukkit.v1_18_R1.CraftServer.dispatchServerCommand(CraftServer.java:814) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at net.minecraft.server.dedicated.DedicatedServer.bf(DedicatedServer.java:453) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:429) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1206) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1034) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499]
        at java.lang.Thread.run(Thread.java:833) [?:?]

Why I get this error once I created the cmd: ```java
Player plr = (Player) sender;

            Player target = Bukkit.getPlayer(args[0]);

            if (target != null) {
                String name = target.getDisplayName();
                UUID uuid = target.getUniqueId();
                int ping = target.getPing();

                boolean ban = plugin.getConfig().getBoolean("players." + uuid + ".banned");
                boolean mute = plugin.getConfig().getBoolean("players." + uuid + ".muted");

                plr.sendMessage("[" + ChatColor.BOLD + ChatColor.LIGHT_PURPLE + "Pranction" + ChatColor.RESET + ChatColor.WHITE + "] Informations sur le joueur " + name + " ! \n" +
                        "- Nom : " + ChatColor.DARK_AQUA + name + "\n" +
                        "- UUID : " + ChatColor.DARK_AQUA + uuid + "\n" +
                        "- Ping : " + ChatColor.DARK_AQUA +ping + "\n"+
                        "- Banni : " + ChatColor.DARK_AQUA + ban + "\n" +
                        "- Mute : " + ChatColor.DARK_AQUA + mute + "\n");
                return true;
            } else {
                plr.sendMessage("[" + ChatColor.BOLD + ChatColor.LIGHT_PURPLE + "Pranction" + ChatColor.RESET + ChatColor.WHITE + "] Merci de specifier le joueur !");
                return false;
            }
eternal oxide
#

Unsupported API version 1.5 read teh error

dense falcon
#

.

#

I am asking WHY.

eternal oxide
#

you put an api version in your plugin.yml for 1.5

dense falcon
#

Yes.

lost matrix
dense falcon
#

Yes but I need it !

eternal oxide
#

api version only goes back to 1.12

dense falcon
lost matrix
dense falcon
eternal oxide
#

why do you think you need 1.5?

lost matrix
dense falcon
#

compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'

lost matrix
#

Then your api version is 1.18

dense falcon
limber owl
heavy marsh
#

Hi, if I add a pack folder to my plugin's resources folder will that pack automatically be loaded or is there something I have to do to make it load?

eternal oxide
#

ah, 1.8

limber owl
#

or what are you trying to do?

heavy marsh
#

I just want to add a custom model for a shield

eternal oxide
#

no a pack will not be sent

limber owl
#

and how are you trying to achieve this?

eternal oxide
#

you have to give the client a web address to download a pack from

limber owl
#

oh I understand now

#

as ElgarL is saying you have to prompt the user to download it

heavy marsh
#

is that something supported that I could do from just a plugin? Or would I need to upload the pack somewhere

lost matrix
heavy marsh
eternal oxide
quaint mantle
#

Has the player skull item been changed from Material.SKULL_ITEM in 1.18?

eternal oxide
#

<Material.PLAYER_HEAD>

quaint mantle
lost matrix
quaint mantle
arctic moth
#

is there any function to cause sculk growth with a custom amount of xp no catalyst?

#

or is it nms time

tardy delta
#

is it a good practice having the logger as a static final variable in your class instead of passing it around with dependency injection?

lost matrix
tardy delta
#

i've seen many people doing like
private static final Logger LOG = Logger.getLogger(someclass)

#

the java.util.Logger then

crisp steeple
#

seems kind of redundant to use di for that

tardy delta
#

thats what i was thinking

lost matrix
#

For spigot i would always get the logger from my JavaPlugin instance

tardy delta
#

im not making something with spigot rn :)

#

i guess its generally acceptable to do that

worldly ingot
#

The tile exists though, so adding methods to it would work

#

Maybe I'll do that now. I'm a bit bored lol

#

Noting however you did say "no catalyst". No. The only means of skulk growing is with a catalyst

mortal hare
#

mojang wtf is this

#
    private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener listener) {
        packet.handle((T) listener); // CraftBukkit - decompile error
    }
#

ServerPlayer.class

tardy delta
#

generics ftw lmao

river oracle
#

I'm taking a look at an nms function I want to utilize its a Supplier but is it even possible to use it with reflection

  private static interface Supplier<T extends Container> {
    T create(int param1Int, PlayerInventory param1PlayerInventory);
  }
#

or am I going to have to scrap this and figure something else out

#

Its only very interesting because its a Supplier and I'm pretty sure if I were to create my own supplier function it would complain at runtime about it not being the same supplier

lost matrix
#

I would def not call it Supplier

river oracle
#

🤷‍♂️ mojang and their shitty code

#

never used consumers or suppliers so I wouldn't know exactly

tardy delta
#

😳

river oracle
#

oh shit your right that isn't a supplier why tf did they map it to that

lost matrix
rotund pond
#

?notworking

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.

rotund pond
#

(It was for me, sry)

river oracle
#

I guess I'll try and see here

#

no point in not

lost matrix
river oracle
#

is what I was trying to get across

lost matrix
#

But its a functional interface so you could in theory just pass a lambda. (i, inv) -> T

#

Well. Not really because the interface is private

river oracle
#

Well I've grabbed it with reflection, but I think thats the most I can do

#
SafeField supplierLink = new SafeField(MenuType.class, "y");
        Class<?> supplier = supplierLink.getField().getType();```
this it the furthest I've gotten tackling this issue and it seems like it may not even be possible with java?
lost matrix
mortal hare
#

are there any good Mojang to Spigot mappings viewer websites out here

river oracle
mortal hare
#

Whenever i look for them I get nothing but broken sites

river oracle
#

this is what someone told me last night

mortal hare
#

love you

#

this site is just what i need

#

im tired of decompiling spigot mapped classes with fernflower

river oracle
# lost matrix I dont have the full picture so no idea

So here is what I'm taking a look at I'm seeing this method here which Is what I want to invoke

private static <T extends Container> Containers<T> register(String var0, Supplier<T> var1)```

but as a param it uses Supplier<T> referencing mojangs weird supplier
```java
private static interface Supplier<T extends Container> {
    T create(int param1Int, PlayerInventory param1PlayerInventory);
  }```
I can do everything with reflection up to invoking the method because I can't get my hands on the weird supplier implementation
#

this is where I think I won't beable to progress. Which is actually fine considering I'm just messing around

tardy delta
#

wait what is that combo

river oracle
tardy delta
#

the later it gets the crazier stuff becomes

river oracle
#

HashMapMap<A B, C, D>

small current
#

How get works

#

get A return B C D ?

river oracle
#
HashMapMap<String, String, String, String> map = new HashMapMap<String, String, String, String>();

map#getHashMap();
map#getMap();

This isn't actual implementation but this seems funny

tardy delta
#

Map<Map<?, ?>, Map<?, ?>>

river oracle
#

rather use a HashMapMap tbh

tardy delta
#

<?, ?> <?, ?> we come in peace

river oracle
#

back to solving an issue java can't likely solve wish me luck while I drive myself insane

lost matrix
#
public interface QuintupleFunction<A, B, C, D, T> {
  T apply(A a, B b, C c, D d);
}
small current
tardy delta
#

or acf: CommandManager<?, ?, ?, ?, ?, ?>

small current
#

💀

river oracle
#

Hmmm Instructions unclear I just formed new healthy habbits so I live longer

small current
river oracle
#

_

small current
#

Third

river oracle
#

Y = 0, 2 = 1, K = 2, _ = 3

#

I'm properly indexing

small current
#

Not 0

river oracle
#

I'm properly indexing

small current
#

Ok the second

river oracle
#

2

small current
#

💀

wooden fable
#

😂

small current
#

Third

river oracle
small current
#

Ok, third

river oracle
#

Ytw

#

thats about one third of my username

modest garnet
#

Line 30 = private int DEF_EXP = plugin.getConfig().getInt("DEFAULTEXP");

Main class = this.getServer().getPluginManager().registerEvents(new SkillsListener(this), this);

plugin = public SkillsListener(skills plugin) {this.plugin = plugin;}

river oracle
#

your not passing it in correctly

#

or your not initializing it

modest garnet
#

but i am

river oracle
#

if you were you wouldn't be getting an error

modest garnet
#

ok

#

so please tell me how im not

#

what have i done wrong

river oracle
#

whats your constructor in SkillsListener

#

oh I see nvm your poorly formatted code

modest garnet
#

lol

small current
#

@river oracle
Third letter = K
First letter = Y

Add the first letter to the third
Ky
And then add S

tardy delta
#

i always love to write this

#

the robots took over the world

river oracle
echo basalt
#

I don't know what an LMS is

river oracle
wooden fable
river oracle
#

?paste

undone axleBOT
crude loom
#

shouldn't an int return 0 if its not found in the config?

river oracle
#

not the config section

river oracle
# modest garnet https://paste.md-5.net/anobabifaz.java
    private UUID uuid;

    private int SKILL_POINTS = 0;
    private int DEF_EXP = plugin.getConfig().getInt("DEFAULTEXP");
    private int REQ_EXP = 0;
    private int TOTAL_SKILL_POINTS = 0;
    private int STRENGTH = 0;
    private int DEFENSE = 0;
    private int VITALITY = 0;

``` don't do this
#

at the point the field is initialized the instance is still null

#

Fields initialize first

#

as java isn't interpreted order doesn't matter

modest garnet
#

so set the DEF_EXP when i use it?

wooden fable
#

Create an initialize function that will be called in onEnable

river oracle
#

either or work

crisp steeple
#

also dont see what the point of that uuid field is

modest garnet
river oracle
#

your design pattern is flawed

crisp steeple
#

but isnt this listener a singleton?

wooden fable
#

I wouldn't name your variables that way either

crisp steeple
#

you arent comparing the uuid to the playerjoinevent

#

uuid will just be whoever the last person joined is

dull goblet
#
for (Cell cell :
                cells) {
            Bukkit.getServer().broadcastMessage(cell.get_cellName() + ": " + cell.get_timeLeft());
            int timeleft = cell.get_timeLeft() - 1;
            if(timeleft > 1){
                cell.set_timeLeft(timeleft);
                return;
            }
            //Cell has expired!
            MessageSender.BroadcastMessageWithPrefix("Cell &b&l" + cell.get_cellName() + "&r has expired! The previous owner was &b&l" + Bukkit.getPlayer(cell.get_owner()).getDisplayName());
            cell.set_owner(null);
        }```` 
Why is it not executing for the last cell in the cells list?
heavy marsh
quaint mantle
#

Hey, I have this idea of making a plugin that resembles Dynmap but basically 3D. You can go around in the world as if you were in spectator mode, but you aren't logged on in Minecraft at all

#

I initially thought of using Ray-casting, however, there must be a better way.

quaint mantle
#

No, I need to be render the undergrounds too

quaint mantle
#

as if you were in spectator mode

wooden fable
valid totem
#

Today i learned

heavy marsh
valid totem
quaint mantle
#

Yeah..

wooden fable
#

Jup

valid totem
#

Your best bet is to send the client only the block data

#

And the client will render it

heavy marsh
#

Not sure if it would even work outside of loaded chunks?

valid totem
#

Chunk#load()

#

Dude

heavy marsh
#

I suppose

valid totem
#

But you know what this program client is turning into?

#

Minecraft client.jar

quaint mantle
#

Okay... What about allowing admins to only spectate as a player, but in a website

#

I think a ray-cast may be just enough

valid totem
#

you're gonna need some assets as well

wooden fable
#

The client doesn't need to know every blocks in render distance, you only need to render the blocks that have one or more air blocks next to then. With some checking you could increase performance by not sending every block

valid totem
#

at the cost of extra processing

#

you'll just move the load to the server

#

cause now the server is doing the raycasting

quaint mantle
#

I'll make a configuration to set the render distance in the website

valid totem
#

GLHF

quaint mantle
#

Thanks

valid totem
#

its the same one minecraft classic uses

#

just disable movement and load the in blocks from the server

#

its actually easier than you think if you use a library @quaint mantle

quaint mantle
#

what a profile picture

valid totem
#

IKR

quaint mantle
#

How... How do I implement JavaScript in Java though???

valid totem
#

You dont?

quaint mantle
#

Do I just send data to the server every tick?

valid totem
#

no

#

you send on block update

#

and no yo0u are sending from server to client

#

and ther is no java to javascript

quaint mantle
#

I am confused

valid totem
#

you are writing a new client with javascript

#

if you are gonna be making this for the web

quaint mantle
#

How the hell do I get the blocks AND entities from the server then?

valid totem
#

events

quaint mantle
#

Yeah okay but

valid totem
#

send in binary

quaint mantle
#

How tf do I send it to the website...

valid totem
#

WebSockets

quaint mantle
#

,

#

Where do I host the website?

valid totem
#

bruh

quaint mantle
#

It needs to be a single plugin

valid totem
#

you listen on port 80

#

with a http server for java

valid totem
#

no

quaint mantle
#

Okay and how do I implement the JavaScript code you sent me?

valid totem
#
  1. thats deprecated
#
  1. not needed
valid totem
lost matrix
#

Its an external library like JavaFX

lost matrix
quaint mantle
#

How in hell does Dynmap do it then

valid totem
#

really

wooden fable
#

You can let the player host the website

valid totem
lost matrix
valid totem
#

static images are rendered

quaint mantle
#

The client as the Minecraft client or the website?

valid totem
#

This is how you could do it

#

listen on any port greater than 1024

#

for your http server

#

write a client that connects to the server through the same port (websockets)

#

send data from the server to the client

#

in binary

lost matrix
#

You can do frontend in java with vaadin.
But i would not recommend it.
You can as well just shade a directory into your jar (html and js files) and serve them via a java backend

valid totem
#

yea

#

you might want to use a graphics library

#

writing the thing yourself is gonna be a pain

mortal hare
#

holy shit

#

i found a way to hide player's inventory contents

#

without storing data

valid totem
#

what?

mortal hare
#

by yourself

#

you dont need to clear inventory contents

#

for example in gui

valid totem
#

hiding your own inventory or other's inventory

#

for yor own inventory just send an inventory update packet

#

and set everything to air

eternal oxide
#

using the hidden creative hotbars?

mortal hare
#

that wouldnt work

valid totem
mortal hare
#

container synchronizer would update the inventory

#

you need to hook container synchronizer

#

and send window packet

subtle folio
#

is there a way to do like guis without the players inventory showing up?

valid totem
#

add yourself to the io.netty pipeline

#

and filter out the inventory packets

mortal hare
#

what if you're in GUI

#

that would require to filter more than that

#

just use Container Synchronizer class

valid totem
#

you filter out the ones that dont

#

if your method is in NMS it's not that impressive

mortal hare
#

i create ContainerSynchronizer class in NMS apply it to current menu and then send empty window packet

valid totem
#

can you do it with the bukkit api

mortal hare
#

that way all instances are handled for me without filtering it

mortal hare
valid totem
#

thought so

mortal hare
#

well kinda

#

if you store player contents

valid totem
#

yeah copy their inventory into another inventory

mortal hare
#

and then reset it

river oracle
#

when would send the packets to do that?

#

I've never touched pcckets before

#

do you just do it as you call open inventory

mortal hare
#

after that

valid totem
#

packets are easy

#

You create a packet and send it

river oracle
#

I know i never said they were hard

#

I just said I haven't touched them

mortal hare
#

yeah packets are not that hard, your plugin acts as a mini "server" by fooling main "NMS server" and client into thinking that's real data

valid totem
#

thats how i made a noclip plugin

old sail
#

How can I send a packet with higher priority? I send a packet to a player to make them see another player glow. But when the glowing player sneaks or swims the glowing effect disappears.

valid totem
#

packets dont have priority

mortal hare
#

your packets are detected by NMS and client

valid totem
mortal hare
#

as illegitimate

#

thus the effect will be reset

lost matrix
#

Either way you need to keep track of your glowing players in a Set<UUID> or if its player specific a Map<UUID, Set<UUID>>

balmy fox
#

So I am trying to give custom error message when they havent given the right amount of arguments. But when I run this on the server it gives the Internal error error. What should I do diffrenet?

valid totem
#

you cant do that

#

this isnt javascript

#

if arr = []

#

then arr[0] is not null, it will give you an exception

#

use args.length < 1