#help-development

1 messages · Page 2003 of 1

hybrid spoke
#

ah

smoky oak
#

couldn't be me. *sweats*

#

fair enough

#

then again

#

who reads plugin code

#

ah well

#

i havent had much issues with player objects yet

sage dragon
smoky oak
#

lemme guess

#

invisible armor stand

fickle frost
#

I'd assume because it wasn't actually removed.

#

Seeing your code and how you're doing it would probably help.

quasi flint
#

maybe resend lighting packet?

#

or remove it properly

sage dragon
#

Yes, just a moment

quaint mantle
#

3 minutes have passed

sage dragon
quaint mantle
#

why not on this web

#

?paste

undone axleBOT
trail pilot
#

i have an issues

sage dragon
sage dragon
quaint mantle
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

trail pilot
#

about custom config, its save default thing, but its wont read

#

if i restart server its read it

quaint mantle
#

loaded it yet?

#

oh?

trail pilot
#

first start dont read
second start work perfectly

quaint mantle
#

uhm

sage dragon
quaint mantle
#

then just ignore it

trail pilot
#
 if (!file.exists()) {
            saveResource( "message.yml", false );
            yaml = YamlConfiguration.loadConfiguration( file );
        }```
quaint mantle
trail pilot
#

i didnt specify yaml

sage dragon
trail pilot
#

wdym

#

i dont know still working on fixing mini bugs

#
if (args.length == 0) {
            if (SingleHomeUtils.getHomeNull( player )) {
                player.sendMessage( ChatColor.translateAlternateColorCodes(  '&', ConfigUtils.getPrefix() + " " + SHMessageUtils.noHome( player ) ) );
            } else {
....
}```
quaint mantle
#

Is there a way to trigger something from a different plugin ? For example force a leaderboard update that I have coded in another plugin.

trail pilot
young knoll
#

Sure

#

You can get an instance of the plugin with Bukkit.getPluginManager.getPlugin

#

But a proper API is generally better

quaint mantle
echo granite
#

wtf bro

young knoll
#

No

#

Just an expose an API from within the plugin

trail pilot
#

its like
Homes: uuid: x ect...

#

or maybe should make a list for multihomes

quaint mantle
tardy delta
#

nice code formatting

young knoll
#

You can add whatever you want as a dependency with gradle

fickle frost
quaint mantle
#

I just don't understand the part of where I add the API in the plugin.

tardy delta
#

im saving homes in a database lol

#

made a dedicated Home object

trail pilot
tardy delta
#

h2 😌

hybrid spoke
#

.txt

trail pilot
trail pilot
hybrid spoke
trail pilot
hybrid spoke
#

(╯°□°)╯︵ ┻━┻

sage dragon
trail pilot
lean gull
#

dum person here, i forgor somethin: how do i stop code from contuning? like if this and that is not that, then stop code

#

(in an event)

young knoll
#

return

lean gull
#

return;?

young knoll
#

Mhm

lean gull
#

ok

#

thank you

tardy delta
#

event.setCancelled(true)?

lean gull
#

no i meant to stop the code, not the event

tardy delta
#

ah

trail pilot
#

dumb question should be

if(!(sender instaceof Player)){ }
or
if(sender instaceof Player){ }

tardy delta
#

?

#

for doing what?

trail pilot
#

oh

young knoll
#

And command blocks

trail pilot
#

console cant use commands

young knoll
#

Don’t forget them :(

#

Yes it can

trail pilot
#

i mean i wont

young knoll
#

I mean if it’s a private plugin then you can skip it if you want

trail pilot
hardy swan
young knoll
#

In a public plugin you have to idiot proof it for everyone

trail pilot
#

im just asking because i always use (!(ect))

young knoll
#

In a private plugin you have to idiot proof it for yourself

halcyon mica
#

Does anyone know how to use specialsource with yarn instead of mojmap?

hardy swan
trail pilot
#

oh ok thanks

young knoll
#

Still wish java allowed !instanceof

tardy delta
#

happy path sounds like elfs and dwarfs 👀

hardy swan
young knoll
#

Better than those stinky brackets

hardy swan
#

It can be interpreted two ways

#

Same

young knoll
#

Squarecurly’t brackets

tardy delta
#

curly brackets

hybrid spoke
#

👼

tardy delta
#

your mom brackets

#

🥶

halcyon mica
tardy delta
#

or take it as "people dont know"

halcyon mica
#

That is what no means in this context

quaint mantle
halcyon mica
#

ungh

hasty prawn
#

So give it yarns mapping file instead of spigots

#

Or mojangs or whatever you're trying to do

rough drift
#

@raw ibex I've had some compilcations with SSL

#

give me a min

halcyon mica
#

Hm, let me check

#

It's a universal layout, right

#

Nope, won't work

#

ss requires a single consolidated mappings file

misty current
#

am I stupid or should this not warn me about getDrops returning null?

halcyon mica
#

yarn is split into individual classes

misty current
#

(getScrap is annotated as nullable)

chrome beacon
lean gull
#

how do i set a variable in another class to an instance of the plugin? i forgor

misty current
misty current
chrome beacon
#

You can create a variable or use Optional#ofNullable

misty current
#

if you mean passing it, use dependency injection

round finch
#

?paste

undone axleBOT
lean gull
#

i'm tryna call a function from the onEnable thing to my other class and then setting it there, but i can't call a non-static method from a whatever

round finch
misty current
chrome beacon
#

So Optional.ofNullable(getScrap(amount)).orElse(getResource(amount))

misty current
#

also they are called methods in java

chrome beacon
misty current
#

aight leme try it rq

#

yep

#

thanks

round finch
#
public static String getTowny_Name(Player p) {
    TownyAPI  TownyAPI = com.palmergames.bukkit.towny.TownyAPI.getInstance();
         
    Resident resident = null;
    
    try {
        resident = TownyAPI.getDataSource().getResident(p);
    } catch (TownyException e ){
        // TODO Auto-generated catch block
        e.printStackTrace();

    }
    
    if (resident.hasTown() == true){
    
    Town town = null;
    try {
        town = resident.getTown();
    } catch (NotRegisteredException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    
    return town.getName();
    }
}
tardy delta
#

== true shame on you

misty current
#

^

tardy delta
#

never understood why people write the full package name too

misty current
#

anyways what's the issue here?

round finch
tardy delta
#

lol

hasty prawn
misty current
hasty prawn
#

Otherwise, I doubt SS will work.

round finch
lean gull
#

RayGunShoot.getPluginInstance(this);

    DerpPlugin plugin;

    public void getPluginInstance(DerpPlugin plugin) {
        this.plugin = plugin;
    }``` it not work
tardy delta
#

ye

hasty prawn
tardy delta
#

why not

round finch
#

gimme second to update it

tardy delta
#

do your dependency injection with a constructor

hasty prawn
lean gull
#

1 sec i gotta learn what constructors again and how to use them

tardy delta
#

smh you still dont know

lean gull
#

i did... and then i forgor

tardy delta
#

how can you forget that

hasty prawn
#

Atleast he's going to figure it out himself instead of asking us.

#

That's definitely the right way to do it.

tardy delta
#

i told him to use constructors months ago

lean gull
#

months ago being the keyword

#

i forgor since then

tardy delta
#

forgor sounds russian

#

hello im forgor i drink wodka every day

#

💀

grim ice
#

simplest way to explai nti

tardy delta
#

does he know what events are? 😎

grim ice
#

and making the constructor private

#

is basically

#

event.setCancelled(true);

lean gull
#

ok i hate this

#

all i had to do is make an instance of the other class

tardy delta
#

static factory method ;skull;

grim ice
lean gull
#

do events have to be static?

tardy delta
#

no

grim ice
#

since u can init it inside of the method

round finch
lean gull
#

oh ok good

round finch
#

i solved it now :))

smoky oak
#

afaik u cant init events tho?

round finch
#

wrong version

tardy delta
#

good boy

round finch
#

i deserve headpat

#

xd ijk

hasty prawn
round finch
#

oh well thank you!!

#

:))

grim ice
#

give lib ideas

round finch
tardy delta
#

creates penguins and sends them to santa

grim ice
#

should i make smth like

tardy delta
#

this man is using /reload

round finch
#

oh shit

#

caught in 4k

#

yes i reload after export

smoky oak
#

use plugman

grim ice
#

boolean SafetyChecker.isThreadSafe(method)

round finch
#

it running on my pc not a host

smoky oak
#

dont throw a halting problem at us here

round finch
hasty prawn
#

Reload is fine for development purposes

grim ice
#

but actually that might be useless

hasty prawn
#

Please don't use plugman NotLikeThis

smoky oak
#

urgh whatever

round finch
#

why plugman breaks some plugins?

hasty prawn
#

Well it can, but there's really just no reason or benefit to use it

grim ice
#

give ideas for libs pls

round finch
#

some plugins developed crash on reload

#

reeeeeeeee

grim ice
#

ehhhh

#

that might be a good idea

#

so what does it do

#

a semi detailed explanation

tardy delta
#

nms 👀

hasty prawn
#

LibsDisguises but not garbage

grim ice
#

Hypixel nick feature is pure garbage

tardy delta
#

why

grim ice
#

it has a set of skins to choose from

#

its almost easy to know when a player is nicked

#

the amount of skins in that set isnt that huge

#

you can memorize them if you want to

lean gull
#

how do i check if an item has a custom tag

hasty prawn
#

Just don't use the skins then

grim ice
#

so basically it lets you change ur name

lean gull
#

i know i need to use PersistentDataContainer but idk how

grim ice
#

to something

#

and ur skin to something

#

and lets you randomize it as well

#

to randomize i might use something like NameMc API if that exists

#

to get real players ign

#

and change stuff on them

tardy delta
#

for what do you need it?

grim ice
#

to randomize a player skin

#

anyways

tardy delta
#

nah the pdc

lean gull
trail pilot
#

i dont know if i need to add message for tabcompleter

tardy delta
#

save an uuid in string format

trail pilot
#

its worth?

tardy delta
#
persistentDataContainer.set(namespacedKey, PersistentDataType.STRING, uuid.toString())```
lean gull
#

i wanna know how it works though

tardy delta
#

everything saved there needs a namespacedkey

trail pilot
#

anyway im op lol

#
if (args.length == 0) {
            list.add("home");
        }```

should i need to add that?
tardy delta
#

tabcomplete?

trail pilot
#

or isnt worth?

tardy delta
#

ye you would, its not because you're an operator the args length will be different

trail pilot
#

and for custom aliases?

#

with config

tardy delta
#

aliases?

#

every player can use aliases if they are registered correctly

trail pilot
#

already done

#

i want ppl do custom aliases

#

like
`aliases:

  • idk`
tardy delta
#

plugin.getCommand("home").setAliases(plugin.getConfig().getStringList("aliases"))

next stratus
#

Hey, am I correct in saying worldedit 7 released with 1.13?

hasty prawn
trail pilot
#

hm

hasty prawn
#

If sender is not a player

#

For that to pass it has to not be a player and not be delhome command

trail pilot
#

its bugged af

#

with tab

#

if(sender instanceof Player && command.getName().equalsIgnoreCase("delhome")) { return null; }

trail pilot
#

if (!(sender instanceof Player && command.getName().equalsIgnoreCase( "delhome" ))) { sender.sendMessage( ConfigUtils.getPrefix() + " you cant use this command on console" ); return true; }
onCommand

hasty prawn
next stratus
#

I've decided to rewrite my plugin to support only newer versions and was wondering what the best worldedit version was to use

hasty prawn
trail pilot
#

send nothing lol

hasty prawn
#

If your plugin supports 1.13+ then depend on 7.0.0

trail pilot
#

[15:40:39 INFO]: VinavilVerde issued server command: /sethome test [15:40:43 INFO]: VinavilVerde issued server command: /sethome [15:40:50 INFO]: VinavilVerde issued server command: /delhome

#

see lol

#

sethome work

next stratus
#

damn paper only has 1.17?

trail pilot
next stratus
#

wait no i was in wrong repo 🥲

trail pilot
#

PluginCommand home = getCommand("home"); home.setExecutor(new TeleportHome()); home.setTabCompleter(new TeleportHome());

hasty prawn
#

Are sethome and delhome in the same class?

trail pilot
#

multiple class for all commands.

chrome beacon
hasty prawn
#

^

next stratus
#

damn paper only has like 1.18

rapid rock
#
        getCommand(discord).setExecutor(new DiscordCommand());```
is it nessecary to like use the double quotes while registering plugin?
cause someone who works on my pl didnt use it
#

as u can see at top

#

i mean

hasty prawn
#

It's a variable

grim ice
#

do u know java

rapid rock
#

registering command

#

e

#

yes

grim ice
#

u dont

next stratus
#

^

hasty prawn
#

If it's a String variable, then that's perfectly valid.

rapid rock
#

bruh i learnt java 2y ago

trail pilot
rapid rock
#

ok

next stratus
#

2hex, you just destroyed them.

rapid rock
#

e

chrome beacon
grim ice
#

im not tryna destroy, i just said the truth

#

u def dont know basic java

next stratus
#

I find it funny tbh

rapid rock
#

Bruh i learnt it 2y ago and i am getting back into it pwez no bully 😦

#

anyways

#

lets pretend that never happened

#

🗿

next stratus
#

pwez

hybrid spoke
#

?learnjava

undone axleBOT
grim ice
#

no

#

u cant undo stuff irl

trail pilot
rapid rock
#

im... out

next stratus
#

bye

#

🙂

grim ice
#

cya

next stratus
#

lol

trail pilot
#

now its work

#

lol

hybrid spoke
grim ice
#

my guy

#

ur still doing

#

what he said to not do

next stratus
#

What's the fastest / lightweight command manager?

grim ice
trail pilot
tardy delta
#

nah he's talking truth, you exactly need 103 instances for the command

#

and 35 tabcompletors

trail pilot
#

that shit make you laugh?

tardy delta
#

🤡

#

i'm sorry my cat was sitting on my keyboard and typed that

tardy delta
#

bad cat

west oxide
#

hi everyone,

hope you all doing great!

question is this enough to update STATE ?

            PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("UPDATE " + tableName + " SET STATE=? WHERE LIVE=?;");
            ps.setString(1, state);
            ps.setInt(2, 0);
            ps.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }```


LIVE is always set to 0 
i want to store state of a tournament (points,eliminations etc..)

using sql cuz i want to also use a discord bot and maybe also a website later
tardy delta
#

have you tried it?

west oxide
tardy delta
#

also not closing statements causes memory leaks

next stratus
#

Is ACF considered "lightweight"?

ivory sleet
#

Myes

#

Relatively

tardy delta
west oxide
#

and now am looking for what the issue is

tardy delta
#

is there even a match?

west oxide
tardy delta
#

does the WHERE finds something?

west oxide
# tardy delta does the WHERE finds something?
        PreparedStatement ps;
        try {
            ps = plugin.SQL.getConnection().prepareStatement("CREATE TABLE IF NOT EXISTS " + tableName +
                    "(STATE VARCHAR(100),LIVE INT(100));");
            PreparedStatement ps1 = plugin.SQL.getConnection().prepareStatement("INSERT IGNORE INFO" + tableName + " (LIVE) VALUES(?);");
            ps1.setInt(1, 0);
            ps.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }```
i have this on onEnable so am guessing yes ?
tardy delta
#

INT(100) useless lol

#

still works

#

what does IGNORE INFO do?

west oxide
hasty prawn
#

It won't throw an error if it already exists I think

trail pilot
#

so how i can make tabcompleter?

tardy delta
#

bad design lol if you dont want to check

tardy delta
tardy delta
#

so let your command class implement TabCompletor first

trail pilot
#

and for setTabSomething

west oxide
eternal needle
#

hi how do i send i message on the player screen?

tardy delta
#

might not work in your case but ye

tardy delta
#

looks complicated but the whole tabcomplete is based on one method: StringUtils.copyPartialMatches

#

first arg is the last arg that the user enters so if the args.length == 2 then it will be args[1]

west oxide
tardy delta
#

second is an iterable, the options to have printed

#

i dunno

#

third is in my case always new ArrayList<>()

#

(the output)

trail pilot
#

oh ok

#

now its work i dont know how lol

tardy delta
#

is it working?

rapid rock
tardy delta
#

because it hasnt been pushed to github i guess

vocal cloud
#

It hasn't been added to git so it's red

hybrid spoke
tardy delta
#

and that is?

trail pilot
hybrid spoke
tardy delta
#

i do

#

wel not the TabCompleter

hybrid spoke
#

CommandBase dont

tardy delta
#

im passing a method reference instead of this

#

so that method can be private

hybrid spoke
#

for what

tardy delta
#

the less accesible methods the better

rapid rock
#

ok i did it with git but it still is red

tardy delta
#

did you push it?

rapid rock
#

ye

#

wait commiting works

west oxide
tardy delta
#

smh i still dont understand the difference between execute and executeupdate

ivory sleet
#

I mean

viral crag
ivory sleet
#

its just api for different type of operations you might do fourteen brush

tardy delta
#

i always forget which ones

west oxide
viral crag
#

its invalid after the last row

west oxide
#

what

olive lance
#

has anybody ever used db4o

#

with spigot

west oxide
viral crag
#

If there were no more records, next() returns false, and you can no longer. Once the next() method has returned false, you should not call it anymore. Doing so may result in an exception.

west oxide
viral crag
#

no, next does not work that way

west oxide
#

i meant that if value.next is true then it gets the value and returns it or else it sets the value to the default value

#

thats what i meant to say

viral crag
#

no, the first part is right, the last part is not how it behaves

west oxide
#

am talking about this part

        try {
            PreparedStatement ps = plugin.SQL.getConnection().prepareStatement("SELECT * FROM " + tableName + " WHERE LIVE=?;");
            ps.setInt(1, 0);

            ResultSet results = ps.executeQuery();
            if (results.next()) {

                state = results.getString("STATE");
            } else {
                PreparedStatement ps1 = plugin.SQL.getConnection().prepareStatement("INSERT " + tableName + " (STATE,LIVE) VALUES(?,?);");
                ps1.setString(1, state);
                ps1.setInt(1, 0);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }

        return state;
    }```
viral crag
#

it is one of the quirks with iterating in sql

west oxide
#

then what should i try to do ?

tardy delta
#

please work with try with resources

viral crag
#

test to make sure you are not at the end and deal with it

west oxide
tardy delta
#

because statements needs to be closed

radiant cipher
#

Hey who wants to make an easy $10

#

lmaoo

torn badge
radiant cipher
viral crag
west oxide
tardy delta
#

if you do a try with resources which looks like this, the statement will be closed automoatically

try (PreparedStatement ps = connection.prepareStatement(sql)) {
  // do stuff
} catch ...```
#

finally block goes brr

radiant cipher
#

I've tried compiling it and got a few different problems including wrong version etc.

tardy delta
#

asserting that the statement != null isnt good either

west oxide
#

man

radiant cipher
#

if someone can get it working I'll paypal u $10

west oxide
#

||fuck sql||

hasty prawn
west oxide
#

lol

tribal holly
#

Is there a way to get the title of an inventory via Inventory class ?

radiant cipher
#

this is for paper btw

hasty prawn
#

Change the version in the pom.xml to 16 and it should work fine.

#

Doesn't matter, Minecraft 1.17.1 doesn't work on Java 17 lol

radiant cipher
#

and yes I tried that

tardy delta
tribal holly
#

i wanna get inventory title from the event InventoryMoveItemEvent

tardy delta
#

isnt there a getInventory or getView method?

tribal holly
#

i already have the inventory

#

but there is any method which return title

#

Inventory::getTitle doesn't exist

tribal holly
torn badge
tribal holly
#

yes i know

#

so how do you get inventory title

viral crag
hasty prawn
radiant cipher
#

on a server?

hasty prawn
#

Although it stops because I haven't set anything up

#

Yeah

radiant cipher
#

dm me jar file

tribal holly
#

look the event is use

radiant cipher
#

if it works ill paypal u

viral crag
tribal holly
#

this is not a version problem

west oxide
torn badge
#

@tribal holly

viral crag
west oxide
#

i looked trough all the code until i found the issue is somewhere in the sql syntaxes

#

and rewatched the tuts i made that from

tribal holly
west oxide
#

||sql is dumb||

torn badge
tribal holly
viral crag
torn badge
#

My bad, try getTitle() directly on getOpenInventory()

viral crag
viral crag
tribal holly
west oxide
tribal holly
#

i'm not on 1.8

viral crag
tribal holly
#

dude getDestination return an Inventory

#

as your method

viral crag
torn badge
hasty prawn
tribal holly
#

thanks Dessie

west oxide
viral crag
#

so you call next and it should return false, however if you were already at the end, it will return garbage and likely evaluate as true

#

the same will happen if the rows are empty - table is empty

#

this is also where it should give you the exception and be handled as fr3qu3ncy said

west oxide
viral crag
#

In my head I would think it should - but only on the first time it is called

#

however, it would be more prudent to test if there is a first row

west oxide
#

ohhh

#

okok i will try something and see if i understood ( i doubt i did LOL)

viral crag
#

you already do it mostly, however you are depending on next() to be false to do the insert

quaint mantle
#
package me.emerald.mphone;

import org.bukkit.block.Block;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.plugin.java.JavaPlugin;

public final class Mphone extends JavaPlugin implements Listener{

    @Override
    public void onEnable() {
        // Plugin startup logic
        System.out.println("Starting plugin...");
    }

    @EventHandler
    public void event(BlockBreakEvent event){
        Block block = event.getBlock();
        Player player = event.getPlayer();

        player.getWorld().spawnEntity(block.getLocation(), EntityType.CREEPER);
    }
}
#

Would this work?

#

When testing, it doesnt seem to

#

Have I made a mistake or smth?

craggy prawn
#

register the event

quaint mantle
#

Wdym register it

#

How would I do that?

craggy prawn
#

You have to register the event in order for it to work. Bukkit.getPluginManager().registerEvents(Class<? extends JavaPlugin>, Class<? extends Listener>);

tardy delta
#

// Plugin startup logic kekw

#

twice 'this' as parameter

quaint mantle
#

Near the top or..

#

Also, would I replace class as what

craggy prawn
#

Inside your onEnable

craggy prawn
quaint mantle
#

wdym 'this'

#

im new to java im sorry lol

hasty prawn
#

?learnjava

undone axleBOT
hasty prawn
#

this refers to the current instance.

quaint mantle
#
public final class Mphone extends JavaPlugin implements Listener{

    @Override
    public void onEnable() {
        // Plugin startup logic
        Bukkit.getPluginManager().registerEvents(Mphone extends JavaPlugin, Class extends Listener);

        System.out.println("Starting plugin...");
    }
#

So like that?

undone axleBOT
craggy prawn
#

^. Essentially, you must insert two parameters: the first must extend JavaPlugin, and the second must be Listener.
Because your Mphone class extends both, the parameters might be 'this.' as DessieYT suggested, they refer to the current instance.

tardy delta
#

....registerEvents(this, this)

misty current
#

can you get a field even if it is in the superclass of an object?

#

i'm trying to get the knowncommands with reflections map but it's throwing an exception

hasty prawn
#

wdym if it's in the super class

#

Like accessing a super field from an extending class?

glossy venture
#

if its not private you can

quaint mantle
#

OH WAIT I SEE WHAT YOU MEAN

#
getServer().getPluginManager().registerEvents(this, this);
misty current
quaint mantle
#

Like that?

#

*it auto fills the this parameter for me

quaint mantle
#

sorry xd

glossy venture
#

yes but learn java

misty current
#

i'm tryna get that field

#

and from the field the object

glossy venture
#

what exception are you getting

#

and what is knownCommands

river root
#

Falling block collision detection

misty current
#

basically it says the field doesn't exist

glossy venture
#

is that a protected field

misty current
hasty prawn
#

It's protected

misty current
#

hold on

hasty prawn
#

You should just be able to do this.knownCommands from an extending class.

misty current
#
        try {
            this.bukkitCommandMap = (CommandMap) FieldUtils.readDeclaredField(Bukkit.getServer(), "commandMap", true);
            this.knownCommands = (Map<String, Command>) FieldUtils.readDeclaredField(bukkitCommandMap, "knownCommands", true);
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e);
        }
#

the commandmap i can get just fine

hasty prawn
#

You don't need to use reflection though

#

I am very confused on what you're trying to do lol

misty current
#

i don't want to deal with the bs package names

misty current
hasty prawn
#

this.knownCommands#put()??

#

You already have access to the field if you're extending SimpleCommandMap

misty current
#

saying it can't get the field

glossy venture
#

what is this for

misty current
#

this is a class from the spigot jar

glossy venture
#

oh

#

lmao

hasty prawn
#

commandMap doesn't exist in SimpleCommandMap

misty current
#

it's the one that the second reflection gets

misty current
#

that's why i asked if you could get super fields

hasty prawn
#

No it's not

misty current
hasty prawn
#

Mhm and where do you see a commandMap field Thonk

glossy venture
#

not commandMap

misty current
#

knowncommands i said

hasty prawn
#

Ohh oh

glossy venture
#

what exception is it throwing

misty current
#

this is the method from apache

#

and it's basically failing to get the field

#

it throws the second exception here

#

the cannot locate declared field...

hasty prawn
#

Send the exception

misty current
#

java.lang.IllegalArgumentException: Cannot locate declared field org.bukkit.craftbukkit.v1_18_R1.command.CraftCommandMap.knownCommands

#

do you want the whole stacktrace

glossy venture
#

is there just a getField one

hasty prawn
#

CraftCommandMap != SimpleCommandMap

glossy venture
#

or i mean readField

misty current
#

dude craftcommandmap extends simplecommandmap

hasty prawn
#

erm wait hang on

lean gull
#

is it possible to set durability for an item that can't take damage?

misty current
#

no you need to manage it on your own

glossy venture
#

is there a FieldUtils.readField(...)

misty current
#

yeah readdeclaredfield

#

or something similar

glossy venture
lean gull
#

1.18.1

misty current
#

tho i've often used these reflection methods and they worked fine

brave sparrow
#

Then no

misty current
#

oh yea there is

glossy venture
#

i dont know for sure but declared field sounds to me like a field declared in the class

misty current
#

oh now i get the difference

glossy venture
#

itself

misty current
#

makes sense lemme try

glossy venture
#

try using that

misty current
#

seems to have worked

#

lemme see if it registered the command

#

yes it did

#

thanks

glossy venture
#

nice

#

np

misty current
#

and now i actually know whats the difference lmao thought they were the same

lean gull
viral crag
misty current
halcyon mica
#

Is there a way to have the build tools build both craftbukkit and spigot?

quaint mantle
#
@Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args){
        if (command.getName().equalsIgnoreCase("challenge")){
            if(sender instanceof Player){
                Player p = (Player) sender;

                if(damageEvent == true) {
                    damageEvent = false;
                    p.sendMessage(ChatColor.RED + "Challenge has stopped.");
                }else{
                    damageEvent = true;
                    p.sendMessage(ChatColor.RED + "Challenge has began!");
                }
            }
        }

        return true;
    }

Why doesnt this work? Im 99% sure I typed this correctly.

viral crag
lean gull
#

im not on paper discord and i thought this place is ok, and also i need 1.18.1 cause no one uses 1.18.2 yet

halcyon mica
#

Because as it is right now, it just deletes and clears the entire directory, including previously built artifacts

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.

halcyon mica
#

But I need both spigot and craftbukkit in my enviroment

hasty prawn
halcyon mica
#

Yes, but that only builds craftbukkit

#

And on rerunning to build spigot, it deletes everything and clears the directory

quaint mantle
#

You have to register commands?

#

Hold on lettme try that

#

turns out that isnt what I had to do

#

had to place this in yml file

#
commands:
  challenge:
    description: Starts the server challenge.
    usage: /<command>
#

Speaking of, how would i create an array and set it as a variable, like so:

{"Object": 5}
#

I think thats how it works here idk

tardy delta
#

/<command> will just print /<command>

hasty prawn
#

Just worked for me lol

quaint mantle
#

so would I do:

String[] special = new.Map
#

or

glossy venture
#

?learnjava pls

undone axleBOT
tardy delta
#

hehe

halcyon mica
onyx fjord
#

is there a performant way to replace certain types of blocks on chunk generation?

tardy delta
#

isnt it better to do that on world creation?

onyx fjord
#

wdym

#

if possible sure

#

just need to know how

quaint mantle
#

Last question I swear lol:

How do I get the name of a block broken?

hasty prawn
#

getType().name()

onyx fjord
#

my current method isnt fast

hasty prawn
#

20,000% lol

onyx fjord
#

it has to do 100k calculations per tick

#

LMFAO

tardy delta
#

...

glossy venture
#

im having problems running buildtools with

"C:\Program Files\Java\jdk-17.0.1\bin\java.exe" -jar BuildTools.jar --rev latest

it throws an IOException right after starting the clone of Bukkit:

Exception in thread "main" org.eclipse.jgit.api.errors.JGitInternalException: Could not rename file Bukkit\._LICENCE.txt17408649439070871510.tmp to Bukkit\LICENCE.txt
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:215)
        at org.spigotmc.builder.Builder.clone(Builder.java:1051)
        at org.spigotmc.builder.Builder.main(Builder.java:327)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: java.io.IOException: Could not rename file Bukkit\._LICENCE.txt17408649439070871510.tmp to Bukkit\LICENCE.txt
        at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1516)
        at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:563)
        at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:467)
        at org.eclipse.jgit.api.CloneCommand.checkout(CloneCommand.java:385)
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:212)
        ... 3 more
Caused by: java.io.IOException: Could not rename file C:\Users\atomf\Desktop\code\.other\Bukkit\._LICENCE.txt17408649439070871510.tmp to C:\Users\atomf\Desktop\code\.other\Bukkit\LICENCE.txt
        at org.eclipse.jgit.util.FileUtils.rename(FileUtils.java:323)
        at org.eclipse.jgit.dircache.DirCacheCheckout.checkoutEntry(DirCacheCheckout.java:1514)
        ... 7 more
lean gull
#

how do i check if a players inventory can hold something

#

whats that do

undone axleBOT
glossy venture
#

at least for now

tall dragon
#

this wont account for partial stacks tho

lean gull
#

i'm usin a non stackable item anyway

tall dragon
#

for example 32 dirt

#

fits 32 more dirt

#

ur check skips that

viral crag
tall dragon
#

so for an accurate check probs gonna need to loop over the content

glossy venture
#

yeah

#

probably

glossy venture
#

its a common function

#

i know

#
public enum InventoryFitsItem {
  YES_IT_DOES_FIT_THE_ITEM,
  NO
}

public static InventoryFitsItem doesInventoryFitTheSpecifiedItem(Inventory inventoryToCheckIfItFitsIn, ItemStack itemToCheckFor) {
  int amountOfTheItemToCheckIfItFits = inventoryToCheckIfItFitsIn.getAmount();
  for (ItemStack itemStackInInventory : inventoryToCheckIfItFitsIn.getContents()) {
    if (itemStackInInventory.isSimalar(itemToCheckFor) && itemStackInInventory.getAmount() + amountOfTheItemToCheckIfItFits <= itemStackInInventory.getType().getMaxStackSize())
      return InventoryFitsItem.YES_IT_DOES_FIT_THE_ITEM; 
  }
  return InventoryFitsItem.NO;
}
``` @quaint mantle
#

i made it good

#

no

quaint mantle
#

@quaint mantle ?

Map<String, Number> cases = new HashMap<>();
    cases.Entry<"OBSIDIAN", 10.0>;
#

like so?

glossy venture
#

please learn java

quaint mantle
#

wym

#

Do i set it to Int?

glossy venture
#

?learnjava pleasepleaseplease

undone axleBOT
glossy venture
#

oh ofc

#

i gtg

tall dragon
#

💀

onyx fjord
#

bro the naming

#

best

tall dragon
#

var name take more bits than the entire method

onyx fjord
#

like who gives a fuck

#

if its bytecode anyway

#

😂

kindred valley
#

hey

#

guys i need a plugin like when player dies, there wont be a respawn screen till someone comes and heals him. Do you know a similar plugin?

lean gull
#

how do i color an item? (leather horse armor)

onyx fjord
#

bro

solar sable
onyx fjord
#

what do i do to stop server screaming at me for modifying blocks async

#

i know what im doing

tall dragon
#

do it sync

#

:D

lean gull
onyx fjord
solar sable
#

you wanted to color it right?

tall dragon
lean gull
#

yes, it has a model with a colorable layer

solar sable
#

then use a texture pack or to be exact, make your own

onyx fjord
lean gull
#

but it's a leather horse armor, i can color it with hex

quaint mantle
solar sable
#

yeah

quaint mantle
#

Its cause im asking for help.

tall dragon
#

i generated 27 million blocks with methods in the link above without any lagg

lean gull
#

how do i use that

quaint mantle
#

@quaint mantle So, I did research, but IntelJ or whatever its called says its not correct.. Any idea why?

HashMap<String, Integer> tableBlocks = new HashMap<>();
    tableBlocks.put("OBSIDIAN", 10.0);
    tableBlocks.put("QUARTZ_ORE", 7.0);
    tableBlocks.put("EMERALD_ORE", 7.0);
    tableBlocks.put("DIAMOND_ORE", 7.0);
    tableBlocks.put("LAPIS_ORE", 5.0);
    tableBlocks.put("REDSTONE_ORE", 5.0);
    tableBlocks.put("GOLD_ORE", 5.0);
    tableBlocks.put("IRON_ORE", 3.0);
    tableBlocks.put("COAL_ORE", 3.0);
rough drift
#

when the 2nd parameter is Integer

lean gull
#

remove the .0s

quaint mantle
quaint mantle
rough drift
#

just change Integer to Double

quaint mantle
undone axleBOT
quaint mantle
rough drift
quaint mantle
#

import java.util.HashMap;

halcyon mica
quaint mantle
#

yep

halcyon mica
#

Unsupported api version huh

#

I don't see where

ivory sleet
#

1.18 would suffice iirc

chrome beacon
#

^^

lean gull
#

i dunno how to use that

quaint mantle
#

i just had to move it lol, also, why is hashmap.get requiring a bool

#

isnt the .get functionality for finding an object in a hashmap?

tall dragon
#

i don't think this applies for horse armor

#

i cant be sure tho

quaint mantle
#

wait so i am doing it correct or

shrewd sentinel
#

How do I get the GameProfile from a NPC? (EntityPlayer)

tall dragon
#

so it does

lean gull
#

still don't know how to use it

chrome beacon
tall dragon
#

why have i never seen colored horse armor before

#

ahh, that would explain it

lean gull
#

it doesn't include leather horse armor

chrome beacon
lean gull
#

guess what? i still do not know how

chrome beacon
#

1.14 so not really

vocal cloud
#

Docs outdated? What.

warm mica
chrome beacon
#

Someone might have forgotten to change the text

#

It does not match the code

warm mica
#

They're automatically being generated from the actual API. Nothing on the Javadocs page is being manually done

lean gull
#

and that will still function like normal meta and add the color thing?

chrome beacon
lean gull
#

okie, thank

#

is it not possible to use base components on lore?

chrome beacon
#

You can with NMS or Paper API

#

Spigot does not support it sadly

lean gull
#

eh i'll just use text components

quaint mantle
#

@quaint mantle you do know that colored horse armor is deprecated right?

#

it was suppost to be a feature but to my knowledge, was never implimented

#

so colored horse armor isnt existant

#

but its value still exists for some reason

quaint mantle
#

Have you ever seen colored horse armor?

#

Without a texture pack

chrome beacon
#

Yes

#

I just made some

quaint mantle
#

Bedrock or Java

chrome beacon
#

1.18.2

#

Java

quaint mantle
#

what since when did that exist

tall dragon
chrome beacon
quaint mantle
#

id like to see this

chrome beacon
spiral light
#

sus

quaint mantle
#

Ik it exists on bedrock, not java

#

Remember both are VERY different

chrome beacon
#

My guy just open the game

quaint mantle
#

Im on my laptop lmao

spiral light
#

how do you color the armor ?

quaint mantle
#

^

chrome beacon
#

Just like any leather armor

#

Dye with the horse armor

terse ore
#

Wth is that a feature

#

:oo:

quaint mantle
#

I refuse to believe that

spiral light
quaint mantle
#

There is no way that exists

terse ore
#

^

chrome beacon
#

It does just accept it ;/

quaint mantle
#

Send a video

terse ore
#

I refuse to

quaint mantle
#

Unless its a mod or smth

#

Like that I cannot accept

chrome beacon
#

Don't believe me just read the mc wiki or smth

#

or you know open the game

spiral light
buoyant viper
#

just checked the wiki

#

u can color them on java

#

wack

worn tundra
spiral light
#

just wtf

tardy delta
#

lol

terse ore
#

I'll commit suicide, it was nice to meet you

#

ded

shrewd sentinel
#

How do I get the GameProfile from a NPC? (EntityPlayer)

spiral light
#

i litterly never saw that

terse ore
#

I've been playing since 2010

#

And I've never noticed this

spiral light
shrewd sentinel
#

1.18.1

spiral light
#

if not remapped you should try to find the method for "GameProfile"

shrewd sentinel
#

Not remapped. I'll try findining it

chrome beacon
#

Why is everyone making their own NPCs

shrewd sentinel
#

Because Citizens can't do everything

chrome beacon
#

It can

spiral light
shrewd sentinel
#

Id rather make it myself then work it out with citizens api

chrome beacon
#

It will be 10x faster and documented with Citizens

shrewd sentinel
#

Sure, But I wanna experience it how you actually do it

chrome beacon
#

When working with NMS you're going to be mostly on your own

spiral light
chrome beacon
#

I haven't

#

To many steps to do

wet breach
#

enum change?

spiral light
#

all i need is the OldEnum-class to do smth but it takes soooo long

lilac dagger
#

can i get the generic type of a List<Type> at runtime?

#

even when the list is empty

spiral light
#

to check if the obj you want to add is the same ?

lilac dagger
#

no, i need a class type for my config serializer

ivory sleet
#

like normally the type passed gets erased

#

but for instance

#

class SpecialList extends AbstractList<Server> implements List<Server> {

}

lilac dagger
#

i assume it's still carried somewhere

ivory sleet
#

there the type cannot be erased

#

so it'd be left there even during runtime

lilac dagger
#

yeah

ivory sleet
#

which is for instance what gson uses for serializing collections

lilac dagger
#

the decompiles know the types too which by that point there shouldn't be any info

ivory sleet
#

myeah

#

type erasure is all very weird

lilac dagger
#

private Class<T> persistentClass; public Constructor() { this.persistentClass = (Class<T>) ((ParameterizedType) getClass() .getGenericSuperclass()).getActualTypeArguments()[0]; } hmm

#

what a difficult way to get a list of the classes you need

ivory sleet
#

🥲

quaint mantle
#

@quaint mantle Whats the difference between p.SendMessage

#

and getServer().SendPluginMessage

ivory sleet
#

sendPluginMessage does something completely else from what you probably think

quaint mantle
#

in the server

#

to all the player

ivory sleet
#

^

quaint mantle
#

Sorry

ivory sleet
#

tho it requires a broadcast permission for each receiver

lilac dagger
#

I think I'm gonna wrap a collection to add the type on top

quaint mantle
#

like getAllPlayers() and 1 by 1 send it

#

or smth

#

^^^

#

Thats what I was thinking

#

but How would I grab every player?

tall dragon
ivory sleet
#

myes, if you just wanna send to every player Bukkit.getOnlinePlayers().forEach(sender -> sender.sendMessage("message")); in principle

#

idk epicgodmc

tall dragon
#

pretty sure theres 2 serperate methods

ivory sleet
#

but last time I read the code nope

#

might have changed

undone axleBOT
ivory sleet
#
int broadcastMessage(@NotNull
String message)
Broadcast a message to all players.
This is the same as calling broadcast(java.lang.String, java.lang.String) to BROADCAST_CHANNEL_USERS
#

states pretty obvious here that it uses the BROADTCAST_CHANNEL_USERS permission

quaint mantle
#

ah

quaint mantle
ivory sleet
#

myes

quaint mantle
#

oh ty

ivory sleet
#

could make it static

#

as its pretty much a static helper method

quaint mantle
#

Already done

#
sendGlobalMessage(ChatColor.RED + "Challenge has began!");
#

Works perfectly

#

?

#

something wrong..?

ivory sleet
#

I mean doesn't matter really but yeah a bit more succinct, in return a bit slower

#

yeah, was just clarifying pros and cons as it might not be trivial to them

trail pilot
#

@quaint mantle hey friendo

river oracle
#

Support hex color >:)

trail pilot
#

we was talking about node system how i can make it?

ivory sleet
#

is already supported by ChatColor::translateAlternateColorCodes tho

river oracle
#

Not quite

ivory sleet
#

yes

#

it literally is

river oracle
#

Unless that's new with 1.18

trail pilot
#

@ivory sleethello too my friendo

ivory sleet
#

its been supported with aforementioned method since hex arrived

river oracle
#

Everything I saw requires chatcolor.of from md5s api

ivory sleet
#

yes which is what you should use

#

bungee chat api has been around since 1.8 and even earlier

ivory sleet
river oracle
ivory sleet
#

I mean thats the case

#

tho the format is a bit ugly

river oracle
#

Which wasn't working in my tests so what am I doing wrong

ivory sleet
#

&x&F&F&F&F&F&F would provide white

river oracle
#

Oh lord

ivory sleet
#

yeah

river oracle
#

Nvm I'm keeping the way I have it lol

ivory sleet
#

sounds better

#

its not really user friendly, but hey its there at least

river oracle
#

#FFFFFF > whatever that was

ivory sleet
#

yeah

marsh burrow
#

Hey fellers, would anyone know how to center items in a chest recursively with just an input of 1 to 9 items?

ivory sleet
#

I use minimessage myself but having a format like that is also nice

river oracle
#

What is minimessage

ivory sleet
#

its delicious yeah

trail pilot
#

hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm

ivory sleet
#

and yes its incredibly fast

river oracle
#

I've never used text components Idk what they were even

trail pilot
#

how

#

why

ivory sleet
#

ah fair, well just a more object oriented way of dealing with string and display data

trail pilot
#

;p

#

ok...

#

why 0?

#

oh i get it

#

its the max homes?

#

OH

#

still dont get it

trail pilot
#

im too stupid for understand that xd

dire salmon
trail pilot
#

or im stupid or you dont know how to explain

#

there are 2 option

#

he is a op mega master

#

he understand all its too op

elfin steppe
#

Someone who has got a good documentation for working with teams (f.ex. for a duel plugin) ?

#

Ping me in ur answer please ty

tardy delta
#

microsoft teams?

viral crag
solar dew
#

@undone axle