#help-development

1 messages · Page 1815 of 1

late sonnet
#

i mean if supossed is the same code here

hybrid spoke
#

the event method will never be manually invoked anywhere

#

so it says that its never used

grim ice
#

it never says its never used for me

#

except when i not add @EventHandler

kind hatch
#

You probably don’t have it registered.

slim cairn
#

nvm I fixed it

hybrid spoke
hybrid spoke
#

i always get this note

grim ice
#

it only says method not used when you dont have @EventHandler

#

im 100% sure

slim cairn
#
           if (event.getTo().getBlockY() < 10) {
                player.teleport(new Location(player.getWorld(), 1, 73, 0));
            }```
Also, this returns: `Method invocation 'getBlockY' may produce 'NullPointerException'` Can I also just ignore it? It works fine while thats there
late sonnet
#

based in memory

grim ice
#

@hybrid spoke only when you have @EventHandler its meant as an event

#

you probably know that but anyways

#

try making 2 methods

#

one with @EventHandler and one without

slim cairn
grim ice
#

and look at the warnings

late sonnet
grim ice
late sonnet
#

this

grim ice
hybrid spoke
#

settings dependent

grim ice
#

im using default settings

slim cairn
grim ice
#

no

slim cairn
#

oh

grim ice
#

public static <T> T requireNonNull(T obj) {
if (obj == null)
throw new NullPointerException();
return obj;
}

#

it will just throw a npe

slim cairn
#

I can just ignore the Typo things right?

#

Typo: In word 'ringitem'

grim ice
#

yes

hybrid spoke
#

i personally would uppercase item

slim cairn
#

ok

grim ice
#

if (event.getPlayer().hasPermission("ringItem.excludeGameMode")) return;

#

wont give that typo thing

#

but im not sure if the conventions are correct

slim cairn
#

Doesnt matter

hybrid spoke
#

oh its a perm, then not

slim cairn
#

it works perfectly fine as is

hybrid spoke
#

thought of an identifier

grim ice
#

why not make a mark as solved thing in this channel

#

and if its not it says so

hybrid spoke
#

that would literally be a ticket-alike

#

for that we have threads activated here

grim ice
#

more organized tho

grim ice
#

just the main one

hybrid spoke
grim ice
#

well we use this channel for help too

hybrid spoke
#

i miss the thread inception. a thread in a thread

#

that would be awesome

grim ice
#

we only use threads if this channel is occupied dont we

#

why send people through the bother if its not occupied

#

it would be more organized imo

hybrid spoke
#

you could suggest it, but it will be declined for sure

#

what do you imagine? like a queue?

lean gull
#

thanks but these don't really help me, so my question still remains:
does anyone know how to make simple world gen? all i want is simple perlin noise for the generation and the painting & craters on the ground

#

rough example of what i want (without craters)

slim cairn
#

Not getting any issues in the Project itself, however it still doesnt put the player into adventure.

#

Just survival

#

Only manually doing /minecraft:gamemode @a Adventure Seems to be able to put players into adventure

#

Here is my ENTIRE code btw

spare marsh
#

@slim cairn Maybe a permissions issue>

#

?

#

Other event is cancelling due to insufficient permissions perhaps?

slim cairn
#

I dont know

#

I can add the permission to players

#

So that part works

#

just the SetGamemode(GameMode.ADVENTURE) doesnt seem to work

#

Doesnt work here, doesnt work in server.properties

#

Survival & Creative & Spec do work

#

but as soon as I put it tto Adventure, it just forces the player into survival

#

So only manual changing works

junior briar
#

trying to kick player on PlayerSpawnLocationEvent but it doesn't seem work. remote debugging showed it has entered the method. can someone help?


    @EventHandler
    public void onPlayerSpawnLocation(PlayerSpawnLocationEvent event) {
        event.getPlayer().kickPlayer("Test");
    }
spare marsh
#

or respawn

tardy delta
#

did you register the listener?

junior briar
#

joining the world.

junior briar
lusty cipher
#

I think this should sort issues out

#

should I also like ping some OP users about it when they join because people don't look at their console?

#

or is it harassment

slim cairn
grim ice
#

wut

#

event.getPlayer().setGameMode(GameMode.ADVENTURE);

slim cairn
#

ye thats what I did

slim cairn
grim ice
#

make it

#

if (event.getPlayer().hasPermission("ringitem.excludegamemode")) return;

#

also does the player have OP or that permission?

slim cairn
#

No

#

but still survival

grim ice
#

nvm

slim cairn
#

okay...

grim ice
#

try what i sent you then

slim cairn
#

Doesnt seem to work either...

#

Just survival again

grim ice
#

what

slim cairn
#

I dont know

#

its weird

gritty urchin
hybrid spoke
lusty cipher
slim cairn
#

how*

hybrid spoke
#

by using a scheduler

#

?scheduling

undone axleBOT
gritty urchin
#

if they are op

#

send them a message

lusty cipher
#

yes I know how to write this stuff

#

I have already done so

#

I was asking whether or not I should do it

gritty urchin
#

if I were you disable it

#

if its not compatible

hybrid spoke
#

i would, but adding an option to disable it

lusty cipher
hybrid spoke
#

otherwise you will lose inpatient server owners as user since they get annoyed by the "spam"

hybrid spoke
#

then i would just broadcast it

gritty urchin
#

Just log to console

lusty cipher
hybrid spoke
lusty cipher
# gritty urchin Just log to console

The last person to use CB and my plugin just told me "it doesn't work". Probably didn't even check the console because it got spammed with exceptions.

lusty cipher
hybrid spoke
#

i would just disable it at server start and log it once into console

#

if they wonder why the plugin is disabled, they will look up the console first

#

just mark it in big fat red

lusty cipher
#

well apparently I can't if I still get CB users complaining eventho I put it on the resource page

hybrid spoke
lusty cipher
#

just puts it on stdcerr it seems

hybrid spoke
#

let the plugin overtake the server for a second

lusty cipher
#

it probably is

#

by putting some batch/shell script there

#

then close the server

#

and execute the script

hybrid spoke
#

okay but lets take a few steps back

#

we dont want to actually break the tos

lusty cipher
#

which is?

#
    public static boolean hasSent = false;

    @EventHandler
    public void onJoin(@NotNull PlayerJoinEvent event) {
        if (event.getPlayer().isOp() && !hasSent) {
            event.getPlayer().sendMessage("§c This plugin does not work on CraftBukkit servers, "
                    + "as they are only meant for development purposes. Please use a Spigot server instead.");
            hasSent = true;
        }
    }

I think this should be fine tho 👍

hybrid spoke
lusty cipher
#

yeah

#

don't want to harass them too much I think

#

if they choose to ignore that too then what can I do

hybrid spoke
#

force op everyone and kick them as long as nobody reacts

tidal hollow
#

How could I make blaze's fireballs explode?

onyx shale
#

likely you can listen to projectilehitevent

#

check if its a blazes projectile then make explosion at that location

tidal hollow
onyx shale
#

yes that could work

#

however im not sure about the explosion part for the fireball you should try it and see

grim ice
#

thats a Launch event

#

not a hit event

#

thats when he throws it, not when the projectile hits something

visual tide
#

also @ivory sleet it was some bungee bs in my maven cache that was causing my issue

spare marsh
#

the Y wouldn't matter in this case just x and y

#

what would be the most efficient way to save this?

#

Also don't want to keep the unused regions in memory if no one is near them to save memory too

slim cairn
peak gulch
#

how to put item on gui in selected place

spare marsh
peak gulch
#

LIKE the item will be in middle of the gui

fresh drum
#

Hey !
Do you know how to change biome to another in 1.9+ ?

spare marsh
peak gulch
#

Thxxxx

#

And how to put barier block There

spare marsh
# peak gulch And how to put barier block There

ItemStack stack = new ItemStack(Material.BARRIER);

That would just create a barrier item but you can the itemMeta by getting the ItemMeta theh applying it back once you have finished manipulating it.

tawny citrus
#

If I want to unconditionally execute a command as sender of a parent command (simplified, if /x y attempt execution of /y as original sender) what is the "most correct"/most elegant way of doing that?

#

I've seen similar stuff to this before so I know it's possible, I just feel like there's a better solution than checking for each type of sender and calling the corresponding function

snow walrus
#

Does anybody know where I can find com.mojang.authlib in spigot 1.18?

#

Not in the api or in the original spigot

#

Also:

#

com.mojang.datafixers.util.Pair

manic furnace
#

How can i make an Ü bold?

peak gulch
#

where to put it??

#
inv = Bukkit.createInventory(null, 9, "Example");```and what does here null
hollow bluff
#

At the top of everything

#

Null for you is inv owner

gritty urchin
#

Hey, how can I send connected fences to client

iron vector
#

I know this is more of a maven question, but
mvn package
Emits two Files:
<artifactId>-<version>.jar
and
original-<artifactId>-<version>.jar
with atifactid and versioon obviously with my values.
Which one should I use? As the Plugin for the Server
The only depenendcy is the spigot-api

chrome beacon
#

If the only dependecy is spigot-api then there shouldn't be a difference between the two with a proper setup

iron vector
chrome beacon
#

Looks like you didn't set thing up right. You're shading the spigot api

#

Add scope provided to the spigot api dependency

iron vector
#

Maybe maven tries to package one as executable? (Which doesnt work bc no main class) so they are almost the same?

peak gulch
grim ice
#

inv.setItem(slot, item);

peak gulch
grim ice
#

why should I

#

do it on ur own

#

i told u how to do it, i wont spoonfeed

peak gulch
grim ice
#

wat

peak gulch
# grim ice wat
    protected ItemStack createGuiItem(final Material material, final String name, final String... lore) {
        final ItemStack item = new ItemStack(material, 1);
        final ItemMeta meta = item.getItemMeta();

        // Set the name of the item
        meta.setDisplayName(name);

        // Set the lore of the item
        meta.setLore(Arrays.asList(lore));

        inv.setItem(4, item);

        return item;
    }```
#

i should do like this

grim ice
#

can u access inv tho

peak gulch
#
    private static Inventory inv;

    public SprawdzGui() {
        inv = Bukkit.createInventory(null, 9, "Example");
        initializeItems();
    }```
#
    public void initializeItems() {
        inv.addItem(createGuiItem(Material.DIAMOND_SWORD, "Example Sword", "§aFirst line of the lore", "§bSecond line of the lore"));
        inv.addItem(createGuiItem(Material.IRON_HELMET, "§bExample Helmet", "§aFirst line of the lore", "§bSecond line of the lore"));
    }
paper crest
#

why i cant import spigot 1.18 on eclipse?

#

on spigot 1.17 is working fine

iron vector
grim ice
#

yes i think

paper crest
#

on 1.17 is working fine

chrome beacon
peak gulch
#

so how tu put item in "place"```java
protected ItemStack createGuiItem(final Integer place,final Material material, final String name,
final String... lore) {
final ItemStack item = new ItemStack(material, 1);
final ItemMeta meta = item.getItemMeta();

    // Set the name of the item
    meta.setDisplayName(name);

    // Set the lore of the item
    meta.setLore(Arrays.asList(lore));

    inv.setItem(place, item);

    return item;
}```
#

ok ok

undone axleBOT
peak gulch
#

so what can i do now

#

ok ok

#

so how to put the guid in "place"

#

inv.setItem(place, item);

paper falcon
#

e.g inv.setItem(5, new ItemStack(Material.DIAMOND_SWORD));
that would put diamond sword in slot 6

paper falcon
#

o

#

and what do you want to do?

peak gulch
#

but my code looks diffrent

#

like you see how it looks

#
        final ItemStack item = new ItemStack(material, 1);
        final ItemMeta meta = item.getItemMeta();

        // Set the name of the item
        meta.setDisplayName(name);

        // Set the lore of the item
        meta.setLore(Arrays.asList(lore));

        item.setItemMeta(meta);```
paper falcon
#

and you're wondering how to place that in gui?

peak gulch
paper falcon
#

oh cool

#

gl

peak gulch
#

because if i do this item.setItemMeta(4,meta); i got error

peak gulch
paper falcon
#

I'm not sure I coudl sovle this

lilac siren
languid bloom
#

Yo wth?

API Version 1.16.5-R0.1-SNAPSHOT

proud basin
#

What are the numbers called beside the scoreboard?

quaint mantle
#

The scores?

young knoll
lavish hemlock
#

ye

languid bloom
#

It's grammatic mistake

regal yoke
#

You guys recon i'd be easy to make a plugin that delays the respawn after death?

#

So you'd have to wait until you respawn.

tender shard
#

what's up with the bungee javadocs

#

I didnt have JS disabled^^

young knoll
#

Anyone here know how to do the gradles?

lavish hemlock
#

NOOOOOO

#

YOU SHOULD NOT BE USING THE GRADLES

#

THE MAVENS IS BETTER

#

YOU FUCKING RETARD

#

AAAAA

#

/s

wide coyote
#

im using maven too but i have to say, maven is not better than gradle lol

lavish hemlock
#

finally

young knoll
#

nvm I got it

#

Idk why gradle shades the dependencies of dependencies by default

lavish hemlock
#

well that's what the shadow plugin does

#

not what Gradle does

young knoll
#

But I do not need 2 copies of a dependency shaded to different places

jagged bobcat
#

How would you make a folder in plugins/%plugin%/

young knoll
#

new File(Plugin#getDataFolder, foldername).mkDirs

#

That will make a folder at plugins/%plugin%/foldername

hard path
#

is the current spigot 1.18 a production release or is it still experimental? Im having some serious chunkloading issues

young knoll
#

It's marked as release as of today

#

Chunk loading is a vanilla issue that is addressed in 1.18.1rc2

proud basin
#

How could I rotate an arraylist elements

lavish hemlock
#

wdym rotate

proud basin
#

without hard coding the rotation and Collections

#

so

lavish hemlock
#

like, reverse?

proud basin
#
one
two
three
``` rotate ```
two
three
one``` etc...
lavish hemlock
#

why not just use Collections.rotate?

young knoll
#

Is that a thing?

lavish hemlock
#

yes

young knoll
#

I was going to suggest remove(0) and then adding it back

lavish hemlock
#

there's also Collections.reverse

crimson terrace
proud basin
#

Maow

young knoll
#
   private static void rotate2(List<?> list, int distance) {
        int size = list.size();
        if (size == 0)
            return;
        int mid =  -distance % size;
        if (mid < 0)
            mid += size;
        if (mid == 0)
            return;

        reverse(list.subList(0, mid));
        reverse(list.subList(mid, size));
        reverse(list);
    }
lavish hemlock
#

why bother using anything other than List tho?

proud basin
#

rather not using list also

lavish hemlock
#

that's the faster choice for add/remove ops iirc

#

Set is preferable for contains

#

so

#

just use List or convert to it when you need to rotate

young knoll
#

That's like, 95% of what I use

proud basin
#

Can't use lists

lavish hemlock
#

why?

proud basin
#

and I don't wanna hard code it

lavish hemlock
#

what do you mean?

#

you need to explain both of these things

#
  1. Why can't you use lists?
  2. What do you mean by "hard coding the rotation"?
hybrid spoke
#

so use the superclass Collection and invoke Collections#rotate on it. wheres the problem?

lavish hemlock
#

Collections.rotate only targets List

#

I assume bc List is the only interface with subList

young knoll
#

Doesn't really work with a set anyway

lavish hemlock
#

yeah

#

plus it'd probably be slower

#

since sublisting is based on indices

proud basin
#

the slowness doesn't matter

lavish hemlock
#

You have yet to explain why the fuck you can't use lists.

spare prism
#

Why does the list is empty if I use TWDPlayer.getOnlinePlayers().add(twdPlayer);?

lavish hemlock
#

So that is the only thing I am going off of.

#

Anyway, get over it, find some way to use lists, good luck.

proud basin
#

Because my professor doesn't want me too

lavish hemlock
#

Ok then

#

You're on your own

#

bc

#
  1. Collection/Set doesn't support get or other index-based operations, and is therefore harder to use.
#
  1. That is your assignment.
hybrid spoke
#
    private static void rotate2(List<?> list, int distance) {
        int size = list.size();
        if (size == 0)
            return;
        int mid =  -distance % size;
        if (mid < 0)
            mid += size;
        if (mid == 0)
            return;

        reverse(list.subList(0, mid));
        reverse(list.subList(mid, size));
        reverse(list);
    }

it seems pretty clear what happens here. shouldn't be too hard to implement for any Collection

proud basin
#

i guess im hard coding git

#

Add the first member to the end of the ArrayList,
Delete the first member of the ArrayList,
Refresh the List Box.

compact crane
#

Hi, how can I block a bundle from being filled?

#

I already tried with InventoryClickEvent, but failed

peak granite
#

how anyone know how to sort a list with values in format: "Player Integer" highest to lowest

elfin cedar
#

Guys, I'm using ProtocolLib on my plugin and I'm trying to open a sign editor gui with some text already. The gui is open, but the problem is, the initial text is not showing on the gui

young knoll
#

What version

tender shard
#

anyone how I can use ProxyPing.setDescriptionComponent(BaseComponent) with more than one BaseComponent?

#

I want to use more than one color in my motd ^^

chrome beacon
#

Use addExtra

tender shard
#

yes but that throws an exception

#

but already found the solution, im stupid

#

I can just a TEXTComponent instead lol

#

oh nvm

#

that also doesn't work

#

when using addExtra on the basecomponent, it throws some exception stating "Component loop"

chrome beacon
#

Show the code

tender shard
#
@EventHandler
    public void onPing(ProxyPingEvent event) {
        if(!config.getBoolean("enabled")) return;
        ServerPing ping = event.getResponse();
        ping.setPlayers(new ServerPing.Players(config.getInt("max-players"), ProxyServer.getInstance().getOnlineCount(),ping.getPlayers().getSample()));
        String motd = config.getString("motd");
        if(motd == null || motd.length()==0) return;
        BaseComponent[] components = TextComponent.fromLegacyText(TinyTextUtils.format(motd));
        BaseComponent component = components[0];
        for(int i = 1; i < components.length; i++) {
            component.addExtra(component);
        }
        ping.setDescriptionComponent(component);
        event.setResponse(ping);
    }
chrome beacon
#

You can't add the component to itself ;/

young knoll
#

lul

chrome beacon
#

ofc that would cause a loop

tender shard
#

I'm not

young knoll
#

component.addExtra(component);

chrome beacon
#

You are

young knoll
#

You are

tender shard
#

hugh ugh

#

lmao

#

of course I meant components[i]

#

thx

#

I was blind

elfin cedar
tender shard
#

yaay :3 ugly but works

lavish hemlock
#

that's kinda pretty

#

I like hex colors uwu

proud basin
#

I can't seem to figure why it saying my ping is 1 when it shouldn't show that this.mc.getNetHandler().getPlayerInfo(this.mc.thePlayer.getUniqueID()).getResponseTime()

tender shard
young knoll
#

What should it show

lavish hemlock
#

I mean tbf

proud basin
#

My actual ping

young knoll
#

Are you on localhost

proud basin
#

so

lavish hemlock
#

the colors aren't high enough contrast from each other

proud basin
#

no

#

I'm on a mc server

lavish hemlock
#

plus they're quite pastel

tender shard
lavish hemlock
#

no I meant that as a good thing

#

they blend in well

#

and don't seem disjointed

tender shard
#

hmm I might just change the order of the colors, maybe I'm happy then 😄

lavish hemlock
#

scrambled, maybe, but not impossible to connect

tender shard
#

got it from this sample thing

lavish hemlock
#

that's a nice palette

compact crane
tender shard
shut field
#

how do you shift a location towards another one?

upper niche
#

Help with 1.18 spigot dependencies

wet thunder
#

Loaded class kotlin.internal.jdk8.JDK8PlatformImplementations from AnotherKotlinPlugin

sleek pond
proud basin
#

im sorry what

#
[19:11:19] [main/INFO]: Loading tweak class name --tweakClass
[19:11:19] [main/ERROR]: Unable to launch
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1955) ~[?:1.8.0_51]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:121) [launchwrapper-of-2.2.jar:2.2]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:30) [launchwrapper-of-2.2.jar:2.2]

vague oracle
#

You are trying to find a character at an index that doesn't exist

proud basin
#

it straight up ignored by entire path

tawny citrus
tender shard
#

is it possible to get an Advancement's description?

ivory sleet
#

Isn’t that client sided

tender shard
#

well at least datapack advancements should have some kind of string on the server

ember estuary
#

are minecraft textures usually jpg or png?

lavish hemlock
#

png

#

jpg is too lossy

ember estuary
#

ah, that makes sense

#

ty

hollow spindle
#

lossy with a voxel game lmao

late halo
#

where is 1.17.1 version

buoyant viper
#

java -jar BuildTools.jar -rev 1.17.1

#

? @late halo

late halo
#

Nah its good I found it

#

ty

buoyant viper
#

n i thought forge discord was ass @proud basin

#

u just got shut down immediately

proud basin
#

hm?

buoyant viper
#

fabric

#

forgot they hate anything not fabric

proud basin
#

what about them?

buoyant viper
#

saw u asking for help on ur project

proud basin
#

im not in fabric discord?

buoyant viper
#

u were

proud basin
#

Yeah but they directed to the correct place

#

Unlike forge

buoyant viper
#

he couldve been a little nicer abt it imo

proud basin
#

Well, it's probably just his personality

quaint mantle
#

dealing with mod community for awhile probably did some damage to how he responds

proud basin
#

People are just ass these days online

#

Literally no respect

lavish hemlock
#

also the Fabric server has had some h i s t o r y

buoyant viper
#

yeaaahhhh

proud basin
#

Altrithe I got what I wanted to make

buoyant viper
#

pog

proud basin
#

but now its the jar itself being an ass 🙄

#

but obviously I can't ask in the other cord because it has nothing do with mixins so

buoyant viper
#

rip

#

i havent worked with forge very much so.. yeee

proud basin
#

apparently im not remapping properly

#

so not sure how I could fix that

young knoll
#

Version?

proud basin
#

1.8.9+ 🙂

young knoll
#

I've only worked with mixins a bit on 1.16

proud basin
#

Should I just send the error?

#

You know im gonna make a thread of mixins for people that use it

buoyant viper
proud basin
#

Mixins Help

#

There we go

ember estuary
#

How can I get this image as a BufferedImage ?

ImageIO.read(Objects.requireNonNull(this.getClass().getResourceAsStream("resources/images/DefaultButton.png"))) throws a NullPointerException. Same when leaving away the "resources/".

young knoll
#

Shouldn't it just be /images after building?

ember estuary
#

with a slash?

#

cuz without that also errors

#

i can try

young knoll
#

Since gradle and maven move stuff from src/main/resources to the root folder

#

Well gradle does, I assume maven does too

ember estuary
#

still java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:208)
when using ImageIO.read(Objects.requireNonNull(this.getClass().getResourceAsStream("/images/DefaultButton.png")))

#

do i need to somehow include it in the jar?

young knoll
#

Should already be in it

#

Check the output jar

ember estuary
#

doesnt seem to be

#

do i need to change something about this?

#

include *.*?

#

or can i just completely remove it and that will do the same?

young knoll
#

Not sure, I don’t use maven

#

Try them

ember estuary
#

yeah, removing it fixed it

#

idk why i even had that

kind hatch
#

If you want everything in your resources folder to be included in the final jar, remove the filtering and includes tags.

#

Otherwise, you have to specify.

ember estuary
#

i see, thanks

#

why does this not show an error?

#

doesnt even show a line or anything

#

ah figured it out, after about 100 errors the command line just is too lazy to write the errormessage

young knoll
#

Yeah

kind hatch
#

Are you trying to retrieve something from the jar at runtime?

young knoll
#

I assume it’s to limit log size? Idk

kind hatch
#

Cause I just ran into this issue.

ember estuary
#

works fine now for mee

ember estuary
#

idk either xD

kind hatch
#

Or save on disk space.

#

All those messages get logged to a file afterall.

ember estuary
#

true yeah

proud basin
#

When you export with gradle does it add the dependencies to it?

young knoll
#

Only if you shade them

hollow spindle
#

Heyooo, im a little new to the shading side of maven, and I'm really not confident with maven in general

#

ahh damn haha

#

Trying to shade in this external library, and I've been trying to track down old posts on spigot on how to shade but eh.. it's not very resourceful and not much content about shading here except recommendations or disapproval of shading (like maven bad or something)

young knoll
#

There should be plenty of non spigot tutorials

proud basin
#

to you use buildDependents to shade them?

young knoll
#

No you just use the normal build

#

Make sure you are using the shade plugin and have the dependencies marked as implementation

proud basin
#

the shade plugin?

young knoll
#

Yeah

#

id "com.github.johnrengelman.shadow"

proud basin
#

oh nvm

quasi patrol
#

I'm somewhat nub, how do I change jdk version on Gradle?

#

Cause error on server is saying that my plugin is 60 and that it has to be 55 for it to be loaded.

young knoll
#

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_16

#

Although it might be different for 8, hold on

#

VERSION_1_8

wide solstice
#

Quick question, do plugins automatically get disabled if a runtime exception is thrown in the onEnable?

#

Or do I need to disable it manually

sullen marlin
#

they will get disabled

#

(appear as red in /pl)

wide solstice
#

Okay thanks

azure nova
#

how can i get player object of someone who isnt online in the server or has never logged in before either, i want to get the object from mojang api

young knoll
#

Player? You cannot

#

Offlineplayer? You can

#

Bukkit.getOfflinePlayer

azure nova
#

oh ok thank u

#

@young knoll Bukkit.getOfflinePlayer(String) is depraceted, and it needs UUID now, how am i supposed to get the offline player (who hasnt played in the server before) uuid like that?

tardy delta
#

Just Ignore the deprecated if you only have a name

#

You might be doing it async too

azure nova
#

for some reason

#

it still doesnt work

#

like

#

it loads the players object who has before joined the server

#

but not the ones who hasnt joined the server before

young knoll
#

Get via name is deprecated due to it making a web request

#

It’s still usable

tardy delta
#

Bukkit.getofflineplayzr should never return null

azure nova
#

oh ok so i short

#

am doing this

#
OfflinePlayer sp = Bukkit.getOfflinePlayer(someones name);

skullMeta.setOwningPlayer(sp);
#

it works for players who are online or was online in the server

#

but not for other players sadly

young knoll
#

I think that may be a requirement? No idea

azure nova
#

thats sad f

hasty prawn
#

Pretty sure it does not

#

It's deprecated since UUIDs are saved persistently while names are not

#

Or, names can be changed and therefore can become invalid

azure nova
#

so is there any way for me to get uuid using names?

#

for offlineplayers lol

young knoll
#

It does

#

I’m pretty sure the javadocs even mention that

azure nova
#

for offlineplayers as such players who hasnt logged in server before

young knoll
#

“This method may involve a blocking web request to get the UUID for the given name.”

hasty prawn
azure nova
hasty prawn
#

If you need to get a player that has never joined, you'll probably have to use Mojang's API

azure nova
#

oh okay imma try

#

i will try this too

#

u cant post pictures here ._.

hasty prawn
#

You have to verify

young knoll
#

The source in craftbukkit also mentions it may be blocking

hasty prawn
#

I could be blind, I just don't see where it makes the request lol

young knoll
#

You’d have to look inside NMS

hasty prawn
tardy delta
#

Wait

quaint berry
#

Can anyone write me some code that creates a config file in a folder when the plugin is first launched. (In your free time please)

tardy delta
#

Plugin.saveDefaultConfig();

quaint mantle
#

There are a lot of plugin repo's where you can find this.

tardy delta
#

Will create config yml and the datafolder

quaint berry
#

Nvm

young knoll
young knoll
#

getOfflinePlayer(string)

hasty prawn
young knoll
#

Because it calls NMS methods?

quaint mantle
#

@sullen marlin
in the stash the only change for the security issue is only at craftbukkit right?

azure nova
#

i am thinking of making a custom web request to mojang api to get uuid of the player using username lol

hasty prawn
#

Oop, wait I found it

#

Assumed something was a map and it is definitely not

dry forum
#

is it possible to get the 1st entry in a hashmap/map?

young knoll
#

Kind of

sullen marlin
#

Only linked hash maps are ordered

young knoll
#

You can still get the “first” entry

dry forum
#

i have Map<Player, Integer> sortedMap = values.entrySet().stream() .sorted(Map.Entry.<Player, Integer>comparingByValue().reversed()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)); which organizes a map

young knoll
#

Okay so you do have a linkedhashmap

quaint mantle
#

map.entrySet().iterator().next()

#

i believe

young knoll
#

Yep

dry forum
#

but thats just going over the map?

young knoll
#

No that will get the first entry

#

That’s what .next() does on a fresh iterator

dry forum
#

oh, but thats only the 1st entry?

young knoll
#

That’s what you wanted, is it not

dry forum
#

yeah i used 1st as an example i thought it had some sort of method like an arraylist but im making a leaderboard type thing

young knoll
#

Nope

#

Make a class to store the name and value and have it implement comparable

#

Then you can sort a list of them

#

Actually you can probably already convert entrySet to a list and sort that with a comparator

restive apex
#

is spigot release new exploit fix for 1.8.8?

young knoll
#

Yes

restive apex
young knoll
#

Read the post

#

And run buildtools

dry forum
#
[07:05:02 WARN]:        at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
[07:05:02 WARN]:        at java.base/java.io.File.createNewFile(File.java:1034)``` is there a reason why my file isnt creating?
```                    if (!f.exists()) {
                        try {
                            f.createNewFile();
                        } catch (IOException e) {
                            e.printStackTrace();
                        }```
its saying it doesnt have permission and yes the directory is correct
restive apex
young knoll
#

?bt

undone axleBOT
restive apex
# young knoll ?bt

i downloaded build tool from jenkins run with this cmd "C:\Program Files\Java\jdk1.8.0_301\bin\java.exe" -jar BuildTools.jar --rev 1.8.8 pause

#

is this ok?

sullen marlin
#

yes

restive apex
#

thank you

buoyant viper
unkempt peak
#

would it be possible to detect when an entity plays a sound?

quiet heron
young knoll
#

It tells you

peak gulch
#
    public void initializeItems() {
        inv.addItem(createGuiItem(22,Material.DIAMOND_SWORD, "§6Sprawdz", "Sprawdz uztkownika",
                "§bSecond " +
                "line of the lore"));
        inv.addItem(createGuiItem(24,Material.IRON_HELMET, "§aCzysty", "Uznaj uzytkownika za czystego"));
        inv.addItem(createGuiItem(26,Material.IRON_HELMET, "§4Zbanuj", "Zbanuj uzytkownika za cheaty"));
        inv.addItem(createGuiItem(35,Material.BARRIER, "§4Wyjdz", "Wyjdz z gui"));
    }

    protected ItemStack createGuiItem(final  Integer place,final Material material, final String name,
                                      final String... lore) {
        final ItemStack item = new ItemStack(material, 1);
        final ItemMeta meta = item.getItemMeta();

        // Set the name of the item
        meta.setDisplayName(name);

        meta.setLore(Arrays.asList(lore));
        inv.setItem(place,item);

        return item;
    }``` 
why im geting the items twice
#

and the item name is not the item name

quaint mantle
#

you do inv.setItem and inv.addItem

#

you also don't set the itemmeta after updating it

peak gulch
sullen marlin
#

Remove addItem

peak gulch
#

ok ok

#

and how to enchant this item

hollow spindle
peak gulch
#

and last question how to clear gui

hollow spindle
#

<Inventory>.clear()

peak gulch
#

thxx

candid galleon
peak gulch
#

i will check it

candid galleon
#

👍

peak gulch
#
    @EventHandler
    public void onInventoryClick(InventoryClickEvent e) {
        if (e.getInventory() != inv) return;

        e.setCancelled(true);

        final ItemStack clickedItem = e.getCurrentItem();

        // verify current item is not null
        if (clickedItem == null) return;

        Player p = (Player) e.getWhoClicked();
        p.sendMessage(e.getView().getTitle() + "" + clickedItem.getItemMeta().getDisplayName());
        switch (e.getView().getTitle()) {
            case "Sprawdz":
                if(clickedItem.getItemMeta().getDisplayName() == "§4Wyjdz"){
                    p.closeInventory();
                    p.sendMessage("§l[§k§cModMessage§f§l]§f pomyslnie opusicles gui");
                }
                break;
            default:
                break;
        }
    }
}``` Why it not react when i clicked the "Wyjdz" button
#

it dont close menu no error

quaint mantle
#

Was just wondering as I am currently studying, if I wanted to make a way to store the current difficulty level for something, in java I would use an enum right ?

iron vector
#

Is there a "proper" way to find out if your server crashed/hangs from the outside? The Idea being that should the Server get itself in a Deadlock, I could just SIGKILL it from the outside and restart it.

sullen marlin
#

Sigkill will always kill something

#

Try a regular kill (sigterm) first though

peak gulch
#

how to put the red glass in gui?

sullen marlin
#

same as other material

#

red_stained_glass or whatever it is

iron vector
sullen marlin
#

try to stop it regularly, if its not dead within $time then kill it

vital swift
sullen marlin
#

sigh

vital swift
#

my bad

iron vector
#

OHH.... I want to detect if it is hanging in the First place, so that I can sigterm/sigkill whatever. I dont want to sigterm the Server to detect if its hanging, bc if it is not, that would stop the server. I want to detect the server not working in the first place, so that I can deal with it

sullen marlin
#

spigot has hang detection functionality built in, its called the watchdog

iron vector
#

Oh ok

sullen marlin
#

it will try to stop the server if it detects this

iron vector
#

What does the watchdog do if the server hangs? stops it? Try to restart it like /restart does?

sullen marlin
#

yes, basically /restart

#

though /restart really sucks tbh

iron vector
#

Yeah... I think it doesnt even attach the new Server to the Parent Process of the original Server, which means its unusable for me...

sullen marlin
#

yup, better to just let it /stop and have your script run server in a loop

#

/ auto restart

#

attaching to the parent isn't really possible with java

peak gulch
#

How to do the empty name and lore

sullen marlin
#

set to null probably

#

I'm sure the docs say

iron vector
peak gulch
#

and how to do protected ItemStack createGuiItem(final Integer place,Material material, String name,String... lore) argument optional

sullen marlin
#

it only tries a restart if the named script exists

iron vector
#

sooo. Since my loop uses a ./start.sh ill just rename that?

sullen marlin
#

rename that or change the restart-script option to something else (eg empty)

peak gulch
sullen marlin
#

idk on < 1.13, check the wiki

eternal oxide
#

md you seen the zero day on Log4j?

sullen marlin
#

elgar not you too

eternal oxide
#

I only just saw this morning

sullen marlin
eternal oxide
#

k

#

all versions, nice

#

should have left 1.8 out 🙂

grim ice
#

wtf is this shit happening with 'log4j

#

i just woke up and servers already exploding with pings

#

can someone explain??

eternal oxide
#

fixed, run buildtools

grim ice
#

yeah but what is it about

eternal oxide
#

remote code execution exploit

grim ice
#

oh an RCE?

echo hound
#

I have gson linkedtreemap. How to deal with it

vale ember
#

is this valid syntax for java 17?

List<int> ints;
ivory sleet
#

Nope

vale ember
#

then why intellij don't mark it as error

candid galleon
#

does it compile even?

vale ember
#

honestly i didn't try but intellij don't mark it as error, i though maybe in java 17 it is like new feauture?

ivory sleet
#

Jep 218 isn’t released in 17, at least not as an official release, might be a preview release

vale ember
#

i tried to compile and it didn't

#

but why the fuck intellij not mark it as error

eternal oxide
wide solstice
#

Anyone see anything wrong w/ this jdbc connection string? jdbc:mysql//localhost:3306/development?user=root&password=REDACTED
And yes, I am doing Class.forName("com.mysql.cj.jdbc.Driver"); before attempting the connection

eternal oxide
#

what your error?

wide solstice
#

Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql//localhost:3306/development?user=root&password=REDACTED

eternal oxide
#

thats not a problem with teh command, thats no driver

wide solstice
#

I'm not sure what you mean

eternal oxide
#

add a : between mysql and your //

mystic sky
#

true+

wide solstice
#

Oh my god I'm stupid

#

Thanks lol

quaint mantle
quaint berry
#

Can someone make me a script that creates a config file

restive tangle
#

Just do saveDefaultConfig() in your onEnable.

#

and create a config.yml in your project.

quaint berry
#

It didn't work?

quaint mantle
native gale
#

You have 3 fairly straightforward options. I've used all 3 options in practice so while they all work they have their own advantages and disadvantages.
...
Good way: Modify the class path to include your jar. Probably the best way for a plugin is to as you say use a Manifest file and add Class-Path e.g Class-Path: plugins/YourPlugin/lib/name.jar
...

#

How to do this via gradle? Does anyone have any idea?

vital lotus
#

Quick Question. Is new method that in spigot 1.18 (example: sendEquipmentChange, openSign, hide/show Entity) will be in version below it?

young knoll
#

No

vital lotus
#

Ah I see, thanks

eternal oxide
native gale
eternal oxide
#

then use teh library feature of the plugin.yml

native gale
#

Oh, where can I read about that?

young knoll
#

1.17 release post

junior briar
#

hi guys. i need to kick player out on PlayerSpawnLocationEvent. but kickPlayer doesn't seems to work cuz the player instance doesn't have a connection yet.
how do i solve this?

unreal quartz
#

isn't that only for jars from maven central

young knoll
#

Yes

eternal oxide
#

eg adding this to your plugin.yml will make spigot download and add to the classpath the h2 database driveryaml libraries: - com.h2database:h2:1.3.159

native gale
#

Oh, that is awesome

#

Thank you!

junior briar
#

because i need it

young knoll
#

Well

#

Add a tick delay I guess

#

What a weird event to kick in

junior briar
#

i want to do something to the spawn location of new players. if fail i'm gonna kick them. will making a delay breaks this?

young knoll
#

Shouldn’t

native gale
junior briar
#

this event is after PlayerLoginEvent and before PlayerJoinEvent. player can be kicked during those events without a problem.

#

there's no reason we can't do that on PlayerSpawnLocationEvent.

toxic mesa
#

So I'm working on a plugin and when I put it on a test server the entire test server just freezes when it says enabling ... v1.0 (freezes = can't even stop the server, I have to kill it)
Tested it on local server as well to make sure it's not smth of the server
Searched on google but couldn't find anything about it

eternal oxide
#

you probably have an infinite loop while(true)

toxic mesa
#

I just restarted my pc, exported the same thing again and it works
my pc or ide might have had a derp moment or smth

verbal heron
#

How do i get every possible container inventory except the player's inventory?
event.getInventory().getHolder() instanceof Container doesn't include double chests and storage minecarts

quaint mantle
#

You could negate an instanceof PlayerInventory

verbal heron
#

I don't need InventoryHolder check?

#

okay

#
    public void onInvClose(InventoryCloseEvent event) {
        if (event.getPlayer() instanceof Player) {
            if (!(event.getInventory().getHolder() instanceof PlayerInventory)) {
                InventoryHolder container = event.getInventory().getHolder();
                StringBuilder inventoryString = new StringBuilder();
                for (ItemStack item : container.getInventory().getContents()) {
                    if (isLargeItem(item) || isCrashItem(item)) {
                        item.setItemMeta(null);
                    }
                    inventoryString.append(itemToString(item));
                }

                if (inventoryString.length() >= 120000) {
                    container.getInventory().clear();
                }
            }
        }
    }```
that should work then
#

I might also replace container.getInventory() with event.getInventory() ig

peak gulch
#

can i change the icon of custom item how to do it?

summer scroll
peak gulch
summer scroll
junior briar
#

can i get current server ticks?

quaint mantle
bold hare
#

use spark for tick monitoring

junior briar
#

no. the current ticks. something similar to epoch time.

quaint mantle
#

code pls

junior briar
#

how would i give u something i don't know?

quaint mantle
#

yes

covert geyser
#

Can Kotlin be used for spigot?

quaint mantle
#

yes

bold hare
quaint mantle
#

/ 50

junior briar
#

it stands for the ticks elapsed after server start.

bold hare
#

??

junior briar
#

if u have mcp u would know what i said.

bold hare
#

you asked how to see current server ticks

junior briar
#

yep

#

elapsed ticks, not ticks-per-second.

#

well, or i'll have to access the nms?

covert geyser
quaint mantle
keen obsidian
#

How can I fix this?
if (Ticks == 1) { Double x = Double.valueOf(data[1]); } // I want to use double x here but it is not possible

quaint mantle
mighty pier
#

how do i make a tab header and footer in 1.8

bold hare
mighty pier
#

it doesnt work on 1.8

bold hare
#

yes it does

mighty pier
#

i tried it

#

didnt work

quaint mantle
#

Do not use 1.8

mighty pier
#

ok

ivory sleet
#

?kick @bold hare

undone axleBOT
#

Done. That felt good.

bold hare
mighty pier
#

i already use paper spigot

split panther
#

you could always go NMS

#

no no, you can create a custom pathfinder with NMS
you should not set velocity, it will come out weird

#

wait, are we talking about Citizen NPC?

jovial kiln
#

Hello hopefully friendly developers

#

Damn I pressed enter too fast, wanted to see if I can ask a question about java development here not related to spigot

eternal oxide
#

sharpens stick

#

just adding/removing teams will nto cause you to be kicked

#

Invalid player data indicates you are messing directly with the player somehow

#

nms?

#

packets?

#

I saw

#

nothign I saw in there shoudl be corrupting player data

jovial kiln
#

So Paper seems to say that updating log4j is insanely hard and would require a team of paid developers to do, but in Python for example I'd just put in the updated module, change the import and badabing badaboom, wouldn't this be done the same way in java?

eternal oxide
#

disable it bit by bit untill you can login

quaint mantle
#

then suffer for nothing

eternal oxide
#

if yoru code is kicking you, disable a bit of yoru code at a time untill it doesn't

#

narrow down where its killing it

vale ember
#

can someone help, i need method which will replace all "%COLOR_NAME%" in strings with corresponding chatcolor, like "%RED%" with red color from bungeecord's chat api, and all "%#xxxxxx%" with corresponding rgb color

eternal oxide
#

try delaying yoru creation of the team and adding teh player by 1 tick. make it run after teh player has actually joined

vale ember
eternal oxide
jovial kiln
#

I'm asking how would I update log4j myself in the java project, haven't touched java in my entire life, I understand why they didn't back port it

eternal oxide
#

in what java project?

#

yes

jovial kiln
eternal oxide
#

you could just runTask as it runs on teh next tick

eternal oxide
jovial kiln
eternal oxide
#

Yeah it does. Its the exact thing I asked in the first place. You asked them why they didn;t do it for 1.8.8 and eventually asked how to do it yourself

quaint mantle
#

Do not use 1.8 😀

eternal oxide
#

Here we do Spigot. Spigot was updated for all version from 1.8

jovial kiln
#

No, I asked here how would I do it in general in a java project so I can do it myself for that specific purpose, I did not ask what or why the -Paper team- is telling me. I am fully aware why they are not updating and I do not care about their reasons

eternal oxide
#

Updateing a dependency can be simple, but it all depends on what API changes have happened

#

if methods are all still teh same its simple as updating the version

#

however this update is not as simple, it seems

#

I'm guessing some methods have been replaced

jovial kiln
#

I just have never used Java so I'm not aware how updating a dependency is generally done here

In other languages I literally just pop in the new version and change to the new name in the import line to modify any code that needs changed if any breaking changes were made or etc

eternal oxide
#

Java it all depends on your build system

#

Maven, you update teh pom.xml

#

then fix anything thats broken in your implementation

#

I couldn't and wouldn't tell you how to do it on the application you are wanting to do it on, as its not Spigot.

smoky oak
#

whats a simple way to iterate over a HashMap?

eternal oxide
covert geyser
#

but why don't people use kotlin for their servers?

smoky oak
#

yes

#

no

#

i aint building a new class for that

#

i said simple

eternal oxide
#

a new class?

eternal oxide
#

google better

#

thats a biconsumer

smoky oak
#

correct

#

its the only valid forEach on a HashMap

#

or at least my ide says that it is

eternal oxide
#

map.forEach((key, value) -> { //code });

smoky oak
#

ah right were not in j8 anymore

cloud sparrow
#

hey guys, I wanted to OP myself in my server. But I can't acess my screen, where the server is running.
So my question is: Is there any software to acess my server as an OP?

#

I don't know if I made myself clear

eternal oxide
#

it depends on yrou server and host, this is a question for #help-server

smoky oak
#

you need either access to the console or access to a OP minecraft account on that server

#

if i do HashMap a = b; with b a HashMap and change a, does b change?

hollow spindle
#

Hey ElgarL, I've seen you mention something about hooking into Vault a few months ago. Does it not apply for retrieving other plugin's economy data through vault?
Reference: #help-development message

eternal oxide
hollow spindle
#

Hrmmm strange. How would I go with that then? To hook and retrieve economy data from other plugins (I'd presume Essentials is handling the eco)

eternal oxide
#

if your eco provider is Essentials, then just access vault as you would for any eco

#

Economy.java

#

if doesn;t matter who the eco provider is

#

if you access via vault

smoky oak
#

does a function returning a variable still link to that variable, all code in the same class?

HashMap get_map(){return map;}

...{
  map2 = get_map();
  map2.put(key, value);
  //does map still get changed?
}
eternal oxide
#

yes

smoky oak
#

uuuurgh

#

then how do i clone

eternal oxide
#

you return the instance of the map, nto the map

smoky oak
#

because clone gives an empty map

eternal oxide
#

You want a copy of the map? new HashMap<>(oldMap)

hollow spindle
smoky oak
#

ah ok

#

how do i do a forEach without doing a forEach

eternal oxide
#

do a non lambda for each java for (Entry pair: map) {

glossy venture
smoky oak
#

ah thanks

#

Which is faster assuming all values are present in the map items?

count = items.get(value.getKey()) - value.getValue();
if(count < 0) continue;
//            
count = items.getOrDefault(value.getKey(),0);
if(count == 0) continue;
count -= value.getValue();
eternal oxide
#

you are trying to add up all teh values?

smoky oak
#

subtract but return false if less than 0

#

i jsut realized that if should contain return false not continue but same question

#

boolen function

eternal oxide
#

subtract all values from?

smoky oak
#

the map items

#

but its supposed to return false if that would result in a negative value

eternal oxide
#

Yeah, I have no idea what you are trying to do

smoky oak
#

basically the HashMap Inventory.remove(HashMap remove) function but inverted

eternal oxide
#

you are subtracting the value from the key?

smoky oak
#

ah no

#

i am setting a temporary map and copying that onto the real map afterwards if all subtractions resulted in no negative numbers. It's a item cost function and hence i need the 'return false if negative' part

eternal oxide
#

As clear as mud

wooden fable
#

Does someone know how i can drop tps on purpose so i can test my plugin?

smoky oak
#

google lag machine

eternal oxide
#

add in a while loop

smoky oak
#

oh thats a good idea

eternal oxide
#

a count down

smoky oak
#

do a command that just does while(true) then call it a few times

wooden fable
#

thx

smoky oak
#

add something to compute tho

#

like a math expressoin based on current time

#

Elgar do u know if commands are handled async or sync?

eternal oxide
#

async

#

oh chat is async

#

commands "should" be sync

smoky oak
#

'should' is all we get with java

#

lol

wooden fable
#

Eh, i made this:

package me.branchyz.lostkingdom.Commands;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;

public class LagCommand implements CommandExecutor {
    @Override
    public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] strings) {
        if(command.getName().equalsIgnoreCase("lag")) {
            commandSender.sendMessage("Nieuwe lag machine staat aan!");
            while(true) {

            }
        }

        return true;
    }
}

It works, but other commands will not work anymore. And after like 30 seconds, it will time out

eternal oxide
#

don;t run it forever

#

set a countdown value

#

something like java int count = 1000000; while (count-= 1) {}

wooden fable
#

thx

eternal oxide
#

you don;t want it running constnaly

#

while its running your server will be locked up

#

you just want to lock it up enough to eat up some ticks

wooden fable
#

Okay, i did this but the tps stayed the same. The server is running local, does that matter?

eternal oxide
#

increase the value until you see some effect

#

are you looking just for a lag spike, or constant lag?

wooden fable
#

constant lag

eternal oxide
#

then do a repeating task

wooden fable
#

Ah okay, but i did this:

            int count = 999999999;
            while (count > 1) {
                count--;
            }

But it still didnt lag, and that is the max int size

eternal oxide
#
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
            int count = Integer.MAX_VALUE;
            while (count > 1) {
                count--;
            } }, 0, 5);```
dull goblet
#

i'm getting this error: org.bukkit.configuration.InvalidConfigurationException: Top level is not a Map.

#

my config.yml is just this

#

itemname = &l&nClick &rto get the closest &a&lslime &rchunk!

quaint mantle
#

learn yaml syntax

dull goblet
#

okay ty

eternal oxide
#

itemname: "&l&nClick &rto get the closest &a&lslime &rchunk!"

quaint mantle
#

Anyone know a good way to save custom server resource pack from loading every time a players join the server? For example, he downloads it only once he joins first time but then just loads it

#

Client side i guess

dull goblet
#

How can I make a custom item, that behaves the same even when its name is changed?

eternal oxide
#

You identify a custom item by data in its PDC not by name

red sedge
#

so uhm while getting something from a persistent data container, do i need to use %pluginname%:%thing%

#

or just %thing%

quaint mantle
wooden fable
eternal oxide
dull goblet
#

What would be the best way to store 2 coordinates together in one variable?

#

I tried using pair but i don't have javafx

eternal oxide
#

Math.sqrt(count)

eternal oxide
ivory sleet
#

maybe just a record

tardy delta
#

i dunno what a record is

quaint mantle
#

Just a record ^^

hybrid spoke
#

yk like doing 100m in 15 secs

#

or like a voice message

crimson terrace
#

Im trying to mess with the PrepareAnvilEvent so that some items cannot be repaired. I do this by setting the result to null. now if I put in a different name for the item it reappears in the result slot, but I cannot take it out. it takes my levels but gives them back as soon as I relog. is there a way to fix this or do I have to live with levels being glitchy when people try to take the item out of the result slot

quiet ice
#

Yeah the PrepareAnvilEvent is pure hell

crimson terrace
#

there should be a PrepareAnvilRenameEvent aswell or some option inside the PrepareAnvilEvent

#

just my opinion. would make it easier to work with and easier to prevent bugs

misty current
#

why does inventoryclickevent return an HumanEntity as the clicker? Isn't Player the only interface extending HumanEntity?

quiet ice
#

Because NPCs or some random bullshit idk. Some plugins might extend it so beware

misty current
#

ah ok so it's not a safe cast i guess

muted gull
#

i cant import JavaPlugin in my Main class. i have imported the spigot file already into the referenced libraries and idk what else to do regarding it

eternal oxide
#

what IDE?

proven river
#

How would I check if a player has left, I have an event where if the player is tagged then I want it to check if they have logged off ?

eternal oxide
#

Listen to teh PlayerQuitEvent

proven river
#

how would would I do that?

eternal oxide
#

as you would any event

proven river
#

Alright thanks :D

hushed hedge
#

help

#

!

eternal oxide
#

?paste the stacktrace from your latest.log

undone axleBOT
eternal oxide
#

or better learn to read the stacktrace. look for the caused by line

#

I can't read the screenshot but I can make out a cast error

hushed hedge
#

classcastexception error

eternal oxide
#

do you know what a cast is?

hushed hedge
#

not

eternal oxide
#

Its when you try to change the type of a class to another, like Player player = (Player) event.getEntity();

#

thats casting the entity to a Player

#

You can only perform a cast when the two types inherit or implement the other

ember estuary
#

if i have 4 optional parameters, do i actually have to make 16 different methods, or is there any better way?

eternal oxide
#

or are similar in some way

#

eg, you can;t cast a String to a Player.

#

Read yoru stacktrace. The causedby line will say a line number in your code

muted gull
ember estuary
# smoky oak wdym

You know what optional parameters are, right?
In java you make them by creating a new method for each different parameter.

    public RectangleBuilder setText(String text, String alignment, int textPadding, byte textColor) {
        this.text = text;
        this.textAlignment = alignment;
        this.textPadding = textPadding;
        this.textColor = textColor;
        return this;
    }
    public RectangleBuilder setText(String text, String alignment, int textPadding) {
        this.text = text;
        this.textAlignment = alignment;
        this.textPadding = textPadding;
        return this;
    }
    public RectangleBuilder setText(String text, byte textColor) {
        this.text = text;
        this.textColor = textColor;
        return this;
    }
    public RectangleBuilder setText(String text) {
        this.text = text;
        return this;
    }

I have this, and i plan on adding two more optional parameters. that would give me 16 different methods.

manic furnace
#

How can i get the ingame-time?

smoky oak
#

you have to overload it if you want to call any specific combination of those, but can't you just call a method with all parameters with null

ember estuary
#

can you pass null as an int?

#

o.O

smoky oak
#

if you dont initialize it its null

ivory sleet
#

would be 0 iirc

ember estuary
#

int, boolean, byte etc. are not Objects

ivory sleet
#

or maybe wont compile

ember estuary
#

so passing null isnt an option

#

but yeah i could pass 0

eternal oxide
#

Yes you need seperate methods, but their identities must all be unique

ember estuary
#

but thats just ugly

#

but is there any easier way to do it than making 16 different methods?

#

the only alternative i can think of is using a builder pattern

eternal oxide
#

each method doesn;t need its own code

ember estuary
#

true, just need to call the one above

eternal oxide
#

one method that handles al variables adn the lesser methods all call it

ember estuary
#

yeah true

#

still a lot of code tho

eternal oxide
#

just template code

ember estuary
#

like what if i want to make another optional parameter, then i gotta make 32 methods