#help-development

1 messages · Page 1769 of 1

ivory sleet
#

and iirc this concerns non static final primitive fields also

eternal night
#

same goes for non static ones-

twilit wharf
#

BungeeCord ServerConnectEvent isnt being triggered

paper viper
#

i may have said it wrong maybe for static you cant anymore or smthing

#

cause ik retrooper was complaining about something idk

ivory sleet
#

no they didnt remove it

eternal night
#

static final is no longer mutable through reflection

paper viper
#

^

#

yeah

#

thats what i thought

opal juniper
eternal night
#

non-static final still is

paper viper
#

ic

eternal night
#

but again, if it is a primitive it will be inlined

ivory sleet
#

but might I'm just uncertain whether the compiler inlines even non static true constants like int, String etc

#

ah yeah then its the case

twilit wharf
ivory sleet
#

patience my young one

ancient plank
#

Young padawan

tardy delta
#

🤡

visual tide
#

is there a way to tell whether a player is currently mining a block?

eternal oxide
#

no

rotund pond
#

Hello !
Sorry for disturbing, I have a little question :x

I have a SQL db to store some items. When I get these items, I store them in cache so I can get them easily (DAO / Strategy pattern etc)
But now I need to give a number of these items, and I don't understand the way itemstacks work

Is there a better way than doing this ? :

for(int i = 0; i >= nb; i++) {
  inventory.addItem(item)
}

Ty ^^'

ancient plank
#

an SQL***

slim kernel
#

How can I make a vertical circle out of particle that looks in the same direction than the player looks all the time? I know how to do a sphere but I dont get how I should make the circle move with the players direction.

ivory sleet
rotund pond
tardy delta
#

probably wanting item[i]

rotund pond
# ivory sleet What does strategy pattern have to do with this?

I don't think that's the point of question but w/e xD
I'm using a DAO pattern to get data from files (as usual)
And using a model class to keep data in cache, and a service class the other two files (idk if you know what I mean)
I think my system is based on the same principle as the strategy pattern (not sure because I am still learning by myself, but I have the impression that it looks like it)

hybrid spoke
#

this doesnt have anything to do with the strategy pattern

#

anyways, if you just want to set the amount, you can set it over the itemstack

rotund pond
#

Ah, my bad so

rotund pond
#

Thank you everyone 👍

hybrid spoke
#

👍

manic furnace
#

Is there a list with one keyword and multiple values?

tardy delta
#

what?

#

one key*?

paper viper
#

Multimap

manic furnace
#

Can you give me an exmaple?

tardy delta
#

isnt that just a Map<Object, ArrayList<>>?

paper viper
#

which is "one key", and "multiple values"

tardy delta
#

oki

acoustic pendant
#
            } else {
                PreparedStatement preparedStatement = TimePlayed.getInstance().getConnection().prepareStatement(
                            "INSERT INTO 'bukkitcoding' ('uuid', 'Time') VALUES (?, ?, '')"
                );
            }```
Are this the correct signs or must be `` instead of ' ' ?
quaint mantle
#

those are unecessary

#

on string literals, use ''

#

`` are used only if you have spaces in table/field names

acoustic pendant
quaint mantle
acoustic pendant
#

i mean

#

that code is about MySQL

quaint mantle
#

yes, those are unecessary even for mysql, if you dont have names with spaces

acoustic pendant
#

oh

#

the tutorial guy has just said is because he like using them

#

nvm xD

ivory sleet
#

Who’s that lol

acoustic pendant
#

why

#

this guy

#

OH WTF

#

2016

quaint mantle
#

🙂

acoustic pendant
#

is it outdated?

quaint mantle
#

:)

#

nah

acoustic pendant
#

irony?

lean gull
#

hey everyone, i have a question.
i want to make it so when you press the swap hand and offhand key (default is F key) it will activate or deactivate fly mode, but not the normal kind. it will keep pushing you forward, and will do the gliding animation, but without the legs moving

quaint mantle
#

Use swap event

lean gull
#

and how do i make it per player and that it resets to disabled on restart

#

maybe like a static list?

quaint mantle
#

why static

quaint mantle
lean gull
#

wdym

tardy delta
acoustic pendant
#

?

tardy delta
#

i like his last videos - his last uhum

round gale
#

is there still an event list for bungeecord?

sterile token
#

There you have sir

quaint mantle
round gale
quaint mantle
#

ab

#

ah

sterile token
#

Javadocs are down

#

idk what happen

lean gull
ivory sleet
#

?jd-bc

quaint mantle
#

java dog probably is eatin the javadocs

round gale
#

but for a longer time aren't they?

ivory sleet
#

not down?

sterile token
#

Yeah they are down

ivory sleet
#

?jd

sterile token
#

Conclure

ivory sleet
#

they're not down for me lol

sterile token
#

Its posible to get netty instance from the spigot?

round gale
#

i need JavaScript for the search?

ivory sleet
#

yuh

sterile token
#

How?

#

Its Bukkit.getDatabase()?

ivory sleet
#

@round gale just use the tree function

#

or smtng

sterile token
#

Which itts the method to get the netty instance from Spigot

ivory sleet
#

idk

sterile token
#

You said that yes :/

ivory sleet
#

I haven't dealt with netty a lot regarding spigot tbf

#

its possible, i just dont know how to myself

sterile token
#

Ahh ok

#

Thanks btw

patent horizon
#
    public void rodThrow(Player player, Location loc) {
        World world = ((CraftWorld) player.getWorld()).getHandle();
        EntityFishingHook hook = new EntityFishingHook(EntityTypes.bj, world);
        hook.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
        hook.setShooter(((CraftPlayer) player).getHandle());
        PacketPlayOutSpawnEntity packet = new PacketPlayOutSpawnEntity(hook);
        ((CraftPlayer)player).getHandle().b.sendPacket(packet);
    }``` no errors are coming back but the fishing rod just isnt showing up
tardy delta
#

is event.getMessage() in the chat event whole this thing?

round gale
#

getMessage is just the "hi"

tardy delta
#

and how can i get everything?

round gale
#

hold on a sec

quaint mantle
#

getFormat ig

tardy delta
#

which returns this so i would need string.format
"<%1$s> %2$s"

#

i'm trying to modify the chat so the first line i the message i modified and the second the original from the event so i guess i need to cancel the event

lean gull
tardy delta
#

plugin cannot be null

lean gull
#

i'm guessing that means that i use it before it's set but idk why that is

tardy delta
#

please

#

constructors exist for something
public void setPluginInstance(Main plugin) {
pluginInstance = plugin;
}

lean gull
#

isn't that what i'm doing?

tardy delta
#

thats not a constructor

lean gull
#

from what i understand, a constructor sets a field and then you can use that again instead of only being able to use it in the same method

#

am i wrong there?

tardy delta
#

protocol 420 sounds like

lean gull
#

what am i doing wrong in the setPluginInstance then?

tardy delta
#

idk just use a constructor

lean gull
#

from what i know that is a constructor

quaint mantle
#

No

lean gull
#

this is what im doing, no?

// Create a Main class
public class Main {
  int x;  // Create a class attribute

  // Create a class constructor for the Main class
  public Main() {
    x = 5;  // Set the initial value for the class attribute x
  }```
tardy delta
#

void

hybrid spoke
#

so obv. its null

tardy delta
#

what

#
public class Main {
  int x;
  
  public Main() {
  x = 5;
}
}```
lean gull
#

why you gotta be a meanie about it tho

tardy delta
#

oh smh didnt saw it sarcastic

hybrid spoke
#

please learn java, a class is your project where you can put your xml files in

lean gull
hybrid spoke
#

and you didnt get mine

hybrid spoke
#

so there is no pluginInstance yet

lean gull
#

i don't understand, where do i make a new instance?

hybrid spoke
#

you just set the pluginInstance in your onEnable but throw it away. this is called a deadstore

lean gull
#

wait

hybrid spoke
#

i will explain it to you, wait a sec

lean gull
tardy delta
#

my eyes are burning

hybrid spoke
#
    @Override
    public void onEnable() {

        // instances
        MainMenuEvents mainMenuEventsClass = new MainMenuEvents();
        MainMenuGUI mainMenuGUIClass = new MainMenuGUI(); // CREATING A NEW INSTANCE HERE
        // get plugin
        mainMenuEventsClass.setPluginInstance(this);
        mainMenuGUIClass.setPluginInstance(this); // SET THE PLUGIN INSTANCE UNNECRESSARILY ABOUT A METHOD
        // create gui for mainmenu
        mainMenuGUIClass.createMainMenuGUI();

        getServer().getPluginManager().registerEvents(mainMenuEventsClass, this);

        JoinAndQuitEvents joinAndQuitEventsClass = new JoinAndQuitEvents();
        joinAndQuitEventsClass.createMainMenuItem(); // THIS METHOD HERE USES ANOTHER INSTANCE OF THE MainMenuGUI WHERE YOU DIDNT SET THE PLUGIN INSTANCE AS YOU CAN SEE IN THE NEXT CODE BLOCK
    public void createMainMenuItem() {
        // getting the MainMenuGUI class to use the createItem method
        MainMenuGUI mainMenu = new MainMenuGUI(); // CREATING AGAIN A NEW INSTANCE
        // lore of the item
        List<String> mainMenuItemLore = new ArrayList<>();
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "&8GUI"));
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "&8&m                         "));
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "&b&lDESCRIPTION"));
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "  &8» &7The &bMain Menu&7!"));
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "  &8» &7Can be used to access"));
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "  &8» &7many different things!"));
        mainMenuItemLore.add(ChatColor.translateAlternateColorCodes('&', "&8&m                         "));
        mainMenuItem = mainMenu.createItem(Material.CHEST, ChatColor.translateAlternateColorCodes('&', "&b&lMAIN MENU"), mainMenuItemLore, "main-menu-item");
    }
quaint mantle
#

Welp I always do this

    public void onenable() {
      ClassNameHere here = new ClassNameHere(this);
  }
}
public class ClassNameHere{
    
    Main plugin;
     
    public ClassNameHere(Main plugin) {
      this.plugin = plugin;
  }   
}```
idk if that is different than what you did so uhh just my example lol
lean gull
quaint mantle
# ivory sleet no not really

welp, that ClassNameHere here = new ClassNameHere(this); i can put it everywhere i like, like out of the onEnable, or in it lol so i dont see anything wrong here then

#

People might use


    public void onenable() {
      here = new ClassNameHere(this);
  }```
#

but i tested and it still functions the same lol

patent horizon
lean gull
hybrid spoke
#

because its not the same instance and the variable is an instance variable. it will only go with the instance, not globablly

lean gull
#

i don't understand

hybrid spoke
#

static class MyObject {

  private final int x;

  public MyObject(int x) {
    this.x = x;
  }
}

public static void main(String[] args) {

  MyObject obj1 = new MyObject(3);
  MyObject obj2 = new MyObject(4);
}

in this example you can see one static class, which we will instantiate to our object and a main method which instantiate 2 of those objects. each instance of this class does now have its own x.

patent horizon
#

do you know what an instance actually does derpy

#

or do you just use it because thats what tutorials online say

lean gull
#

from what i know, an instance is a variable set to a class

patent horizon
#

an instance is quite literally, an instance of the class

hybrid spoke
#

if your class is the blueprint of an house, your instance / object made out of it is the house

patent horizon
#

^

lean gull
#

ok imma just stop listening to godcipher and do what i was told

patent horizon
#

if you grab an instance of something, your instance is a carbon copy of that class from when the instance was created, and nothing afterwards

ancient plank
#

there it is

hybrid spoke
ancient plank
#

saw it coming

lean gull
#

godchiper knows that metaphors confuse me and yet they made one

patent horizon
#

does anyone wanna help me with nms crap though ._.

vale ember
lean gull
#

ok!

ancient plank
#

they're learning java as they learn spigot, so important things will be missing. oh, and if you don't wanna be blocked by them, don't tell them to learn java first!

hybrid spoke
#

shit

#

?learnjava

undone axleBOT
lean gull
#

fail

vale ember
#

no offense, but you really should return to learning basic java, your lack in knowledge in java and oop princliples will not let you go forward!

chrome beacon
lean gull
#

everyone do be tellin me to learn java basics or give up tho

patent horizon
#

yeah the one thing all new java learners -- well any new software language learners hate is "lEaRn BaSiC <insert language>"

vale ember
ancient plank
hybrid spoke
#

currently you do things you dont understand, derpy. you should really try to understand the things you do first, before doing them

ancient plank
#

I think I'm blocked too but idk SC_ZERO_THINK

lean gull
#

ur not blocked

chrome beacon
vale ember
#

why you dont understand? doing what you are doing is like trying to jump from basic arithmetic to pre-calculus

hybrid spoke
lean gull
#

yay people are making fun of me wooo

#

fun times

hybrid spoke
#

literally

lean gull
lean gull
#

he do be makin fun and denyin it tho

spare prism
#

I'm trying to get the distance between two chunks and if it is less than 10 chunks - to do smth, but it doesn't work
code:

                for(Player player : Bukkit.getOnlinePlayers()) {
                    if(MathUtils.getDistance(player.getLocation().getChunk().getX(), player.getLocation().getChunk().getZ(), event.getLocation().getChunk().getX(), event.getLocation().getChunk().getZ()) < 10*16) {
                        event.setCancelled(true);
                        return;
                    }
                }

getDistance() method:

    public static double getDistance(int x1, int z1, int x2, int z2) {
        return Math.sqrt((Math.pow(x2, 2) - Math.pow(x1, 2)) + (Math.pow(z2, 2) - Math.pow(z1, 2)));
    }
vale ember
#

i don't pretend that this is the best way, but if you really want to learn java i'd recommend core java -- volume 1. it explains from basic hello world up to concurrency and collection frameworks

ivory sleet
tardy delta
#

making fun isnt bad

ivory sleet
#

I wouldn't even say they're making fun of you

vale ember
#

?learnjava

undone axleBOT
lean gull
tardy delta
#

how can Bukkit.getOfflinePlayer(uuid) returns an object if it performs a lookup for that uuid which might not exist?

vale ember
lean gull
tardy delta
#
Gets the player by the given UUID, regardless if they are offline or online.
This will return an object even if the player does not exist. To this method, all players will exist
vale ember
eternal night
#

it creates a new offline user using a uuid v3 afaik

ivory sleet
tardy delta
#

oh even if that uuid is not in the database of all the players

#

kinda..

lean gull
misty current
#

can you set the resulting damage of an event ignoring the opponent's protecting causes? (armor, enchants, resistance)

lean gull
#

doing something that you know confuses someone while directing it towards that person is just plain out rude

#

it is making fun of them, and then he added the extra "hey hey hey, he dont understand metaphors"

misty current
#

whats the issue derpy

lean gull
#

i'm bein bullied

#

as per usual

misty current
#

what are you being bullied for?

lean gull
#

not learning the basics of java

misty current
#

not understadning "methaphores"

misty current
lean gull
#

i'm trying a different way. let me be

misty current
#

if you tell them you don't want to learn java yet they have to help you in java

#

you know

ancient plank
#

how is someone supposed to remember that someone they don't know doesn't understand metaphors

lean gull
ancient plank
#

far fetched to think that everyone here will know/remember that you don't understand something

tardy delta
lean gull
misty current
#

anyways this ain't the place to argue, if you are not willing to learn java we are not willing to help with java

tardy delta
#

smh my english sucks

ivory sleet
#

iDerpy, how do you want us to help you then, if we cannot explain these fundamental concepts?

hybrid spoke
hybrid spoke
lean gull
ivory sleet
#

define "certain ways"

misty current
#

you can't explain java if you don't use java terminology

hybrid spoke
#

at this point he have to be trolling

lean gull
#

certain ways being multiple people pressuring me to learn the basics of java, metaphors, etc etc

hybrid spoke
#

everytime he ask something i explain it to him in at least 5 different ways and every of those 5 ways is wrong

lean gull
#

things that you wouldn't want happening to you

misty current
#

who is even using methaphores

ivory sleet
misty current
#

if with that you mean technical terminology

misty current
#

lmfao what

lean gull
ivory sleet
#

how do you want the knowledge explained?

#

if not by metaphores?

lean gull
#

simply and slowly

ivory sleet
#

be concrete

lean gull
#

what's that

misty current
solid cargo
#

bro wtf is hapenning

ivory sleet
#

even metaphors can be simple or slow

misty current
#

if that's how u say it

misty current
solid cargo
#

one of my jar imports doesnt.. resolve

ivory sleet
#

so what do you mean by simple and slow iDerpyOfficial?

#

give me an example

lean gull
#

i do not want a "this is like that", i want a "this does this"

misty current
#

and with "methaphores"

ivory sleet
#

okay

solid cargo
misty current
#

a lol

#

need help?

ivory sleet
#

An instance in object oriented programming is a unit based of a class

lean gull
#

for example, i want a "an instance is a variable set to a class", not a "an instance is like a house blueprint"

solid cargo
#

i have imported a thing

ivory sleet
#

is that good enough?

lean gull
#

wdym by "unit based of a class"

misty current
solid cargo
misty current
#

or are you importing it from your computer?

solid cargo
#

from pc

ivory sleet
#

by unit a mean a sample/object, and based of a class means it was created using the/that class

misty current
#

oh then you can do something like this

#

hold on

#
<dependency>
    <groupId>com.codingforcookies</groupId>
    <artifactId>armorequip</artifactId>
    <version>1.7.2</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/ArmorEquipEvent-1.7.2.jar</systemPath>
</dependency>
``` this is what i did for an armor equip api
lean gull
#

from what i understand, an instance is an object that is set to a class, which you can then use to use methods from said class

misty current
#

and i've put the jar in the resources

#

where u put ur plugin.yml basically

ivory sleet
#

set to a class?

hybrid spoke
#

3 different topics, make threads

brisk estuary
#

Bro, if you don’t even know what an object means in OOP you shouldn’t be trying to make a plugin, start with something easier…

lean gull
#

what are instances

hybrid spoke
#

thanks

solid cargo
#

ty

misty current
#

also this question is kinda offtopic since you know

#

this is a spigot help channel

lean gull
misty current
#

not a java help channel

hybrid spoke
#

doesnt matter

tardy delta
#

this becomes interesting

hybrid spoke
ivory sleet
misty current
#

well not completely basic ones

ivory sleet
#

with that being said, we do not guarantee a professional answer nor instantaneous help

misty current
#

from someone who doesn't even know OOP principles

hybrid spoke
#

what a conicidence that spigot 1.17 came out and now java 17 is out

misty current
#

fr lol

hybrid spoke
#

spigot have to be java

misty current
#

spigot owns oracle?

ivory sleet
#

well not completely basic ones
it still is, although its encouraged to self teach yourself around java since there's a lot of information on the web

misty current
#

agreed

keen lily
#

hey guys

hybrid spoke
#

refering to the channel desc:

Serious Spigot and BungeeCord programming/development help | Ask other questions here

keen lily
#

i kinda need help with smth

hybrid spoke
#

?ask

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. Create a thread in case the help channel you are using is already in use!

misty current
#

anyways i was gonna ask if there is a way to set the damage ignoring means of protection(armor, pot effects,and so on)

#

since im pretty sure you can't change the final damage

tardy delta
#

doesnt the buildtools jar contains the intellij annotations?

misty current
#

i've imported them separately

#
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>16.0.1</version>
        </dependency>```
tardy delta
#

i lost it and now i also have it separately, which i dont want

ivory sleet
#

why not?

#

its just annotations anyways

#

they're not needed at runtime anyways so having a different version wont matter

misty current
#

yeah i don't really see an issue with that

tardy delta
#

hmm ye

misty current
tardy delta
#

also some plugin colored my name in chat red

#

how can i remove it

#

that plugin doesnt want to work with me

ivory sleet
#

Essentials

#

I think?

chrome beacon
#

Probably yeah

tardy delta
#

nah i was stylizer

#

it goes brr

misty current
chrome beacon
tardy delta
#

i do like namecolour gray, this isnt gray

misty current
#

wait you can?

iron palm
#

Hi

Whats wrong with this
i tried another entity (enderpearl) and it worked

chrome beacon
tardy delta
#

i'm trying to do it with code rn and after that remove that plugin

drowsy pawn
#

hello can help

#

with

misty current
drowsy pawn
#

Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "command");

lean gull
tardy delta
#

damage the entity?

misty current
#

wouldn't that call EntityDamageEvent again

drowsy pawn
#

who can give this command full

tardy delta
#

if its just entity.damage() i dont think

drowsy pawn
#

@everyone

tardy delta
#

i think you need to damage it ingame to launch an event

#

yea that

misty current
#

there's a CUSTOM constant in the DamageCause enum so im pretty sure damaging a player with an event calls the listener

#

and i can't filter it out since i'll also need the event to fire from damage done with the damage method

ivory sleet
#

@drowsy pawn what are you trying to do?

drowsy pawn
#

need comand Bukkit.dispatchCommand(player, "command args")

chrome beacon
tardy delta
#
public RulesMenuGUI() {
        inv = Bukkit.createInventory(this, 54, "Main Menu");
        getMainMenuGUI();
        init();
    }

    private void getMainMenuGUI() {
        mainMenuClass = pluginInstance.getMainMenuGUIClass();
    }```
lean gull
#

oh ok

tardy delta
#

when calling RulesMenuGUI() plugininstance == null

#

just pass your plugin through the constructor and not with a setter

drowsy pawn
#

example

#
        if (cmd.getName().equalsIgnoreCase("cv")) {
            Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), /op );
            sender.sendMessage("work");
            return true;
        } ```
chrome beacon
#

Why not just hook multiverse api?

lean gull
#

oh and thanks

iron palm
chrome beacon
#

What about them isn't working

iron palm
chrome beacon
#

Show your code

drowsy pawn
#

@ivory sleet

iron palm
#

what the

#

it is working now

ivory sleet
#

art of programming

chrome beacon
#

^

iron palm
#

lol

misty current
#

so can I somehow set the damage of an EntityDamageEvent ignoring player's protection means?(armor, potion effects)

chrome beacon
#

You could just set the player health directly

#

And then setDamage in the event to 0

misty current
#

wouldn't it create inconsistencies

chrome beacon
#

It could cause a few with other plugins but the again not many keep track of damage

misty current
#

i need it for a private project so compatibility is not an issue

drowsy pawn
#

@ivory sleet example public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if (cmd.getName().equalsIgnoreCase("cv")) { Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), /op ); sender.sendMessage("work"); return true; }

keen lily
#

Hello, I need help with adding a value to scoreboards

chrome beacon
misty current
#

imagine ((Player) sender).setOp(true)

drowsy pawn
#

here is example

#

no no

#

need command executor

chrome beacon
#

Why

misty current
#

anyways i'll try that thanks

drowsy pawn
#

@chrome beacon need execute command

chrome beacon
#

Why

misty current
#

in what case would an attacking entity not be a livingentity?

#

oh an arrow i guess

ancient plank
#

are you able to explain it better than just "need command" because people can't really help you if you just say "need command" "need command executor"

drowsy pawn
#

look but not work

misty current
#

wait what

#

can it attack you

drowsy pawn
#

ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
String command = "command";
Bukkit.dispatchCommand(console, command)

chrome beacon
#

Not the attacker

misty current
#

nono attacker

ancient plank
#

does getting hit by a falling block count as being attacked LULW

chrome beacon
#

Probably

eternal oxide
#

Dispenser

misty current
#

a dispenser's not an entity at all tho

drowsy pawn
#

look error ``` public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {

    if (!(sender instanceof Player)) {
        Player p = (Player) sender;
    }
    return false;
    
    ConsoleCommandSender console = Bukkit.getServer().getConsoleSender();
    String command = "command";
    Bukkit.dispatchCommand(console, command);
}

}```

misty current
#

so i guess the arrow

eternal oxide
#

the arrow it shoots is

misty current
#

ah ye right

#

well not gonna have bows in my server so i can ignore that T.T

chrome beacon
#

Just do an instanceof check

mighty burrow
#

can someone help me with this

misty current
#

yea i mean i won't do anything if the entity is not an instanceof LivingEntity

misty current
#

never leave casting unchecked

chrome beacon
eternal oxide
#

At what point in your code are you attempting to get the service?

misty current
neon storm
#

What's the best method to determine if a plugin is preventing players from switching/toggling a block, for example a button?

#

Using spigot api

chrome beacon
#

Just hook the common plugins like WorldGuard or you could also fire the interact event and check isCancelled

eternal oxide
mighty burrow
#

that's all the stuff i tried

eternal oxide
#

If it prints "service is null" then it is null. Reasons for that could be eco disabled?

#

Did essentials fully start with no errors?

misty current
#

stupid question probably but do you have both vault and essentials in ur server

eternal oxide
#

or is yoru Economy.class the correct import?

mighty burrow
young knoll
#

Are you loading after vault

eternal oxide
#

and no errors on startup?

eternal oxide
#

eco can be disabled in essentials via the config

mighty burrow
#
[00:04:46] [Server thread/INFO]: [Essentials] ServerListPingEvent: Spigot iterator API
[00:04:46] [Server thread/INFO]: [Essentials] Starting Metrics. Opt-out using the global bStats config.
[00:04:46] [Server thread/INFO]: [Vault] [Economy] Essentials Economy hooked.
[00:04:46] [Server thread/INFO]: [Essentials] Using superperms-based permissions.
[00:04:47] [Server thread/INFO]: Server permissions file permissions.yml is empty, ignoring it
[00:04:48] [Server thread/INFO]: Done (62.017s)! For help, type "help"
[00:04:48] [Server thread/INFO]: [Essentials] Essentials found a compatible payment resolution method: Vault Compatibility Layer (v1.7.3-b131)!  
[00:04:48] [Craft Scheduler Thread - 0/INFO]: [Vault] Checking for Updates ... 
[00:04:49] [Craft Scheduler Thread - 1/INFO]: [Essentials] º6Fetching version information...
[00:04:50] [Craft Scheduler Thread - 0/INFO]: [Vault] No new version available
eternal oxide
mighty burrow
#

look

#

it says Essentials Economy hooked.

#

no errors previously

#
[Vault] Loading Vault v1.7.3-b131
[00:03:45] [Server thread/INFO]: [Clans] Loading Clans v1.0
[00:03:45] [Server thread/INFO]: [Essentials] Loading Essentials v2.19.0
[00:03:45] [Server thread/INFO]: [Vault] Enabling Vault v1.7.3-b131
[00:03:45] [Server thread/WARN]: [Vault] Loaded class com.earth2me.essentials.api.Economy from Essentials v2.19.0 which is not a depend, softdepend or loadbefore of this plugin.
[00:03:45] [Server thread/INFO]: [Vault] [Economy] Essentials Economy found: Waiting
[00:03:45] [Server thread/INFO]: [Vault] [Permission] SuperPermissions loaded as backup permission system.
[00:03:46] [Server thread/INFO]: [Vault] Enabled Version 1.7.3-b131
#

at the start

#
depend: [Vault]
softdepend: [EssentialsX]
#

thats in my plugin.yml

eternal oxide
#

Then I see no reason for it to be telling you its null

mighty burrow
#

yeah im so stumped

#

stuck on it for days

eternal oxide
undone axleBOT
dull sparrow
#

is it possible to cancel a bukkit task, and then re-run it again? I have two states, idle and running and when i set the state to idle i want to stop the bukkittask so no extra memory is being used, or is this pointless and instead every tick in the run() method i just check if the state is idle if so return; ?

quaint mantle
dull sparrow
#

I don't know 😄

quaint mantle
#

The 2nd variant us just easier

dull sparrow
#

Yeah i figured

#

Alright I guess thanks

eternal oxide
mighty burrow
#

hmm 😔

old cloud
#

Hello, what is PersistentDataAdapterContext for?

eternal night
#

a context object that allows you to create new persistent data container instances

old cloud
#

Okay but why is it in the toPrimitive method in PersistentDataType as parameter?

#

and fromPrimitive

eternal night
#

afaik that should be documented

old cloud
#

No

eternal night
#

I mean, because you need it ?

old cloud
#

I don't need it and since it only has the one method to create a container it seems pretty useless to me

eternal night
#

okay ?

#

if you don't need it doesn't mean no one needs it

#

you'd need a new pdc

#

for which you need the context

old cloud
#

Ah right, thanks 👍

winged horizon
#

Is anyone aware of a convenience method that gives you an array of ItemStacks from a material and an amount that might be larger than the materials maxStackSize?

young knoll
#

No but you could make one

winged horizon
#

I guess I'll have to, was just wondering if I was not finding it in the API

young knoll
#

Don't think so

#

Enumset time

winged horizon
#

isn't there an isEdible?

#

somewhere

young knoll
#

Looks like it

quaint mantle
#

<> doesnt work on mobile only?

woeful moon
#

I have a plugin that executes a console command whenever a player executes a command, which is configurable in the config. I want to support the %player% placeholder in the config, and replace it with the player that executed the command. I already have a string for the command, how would I go about replacing %player% with the player name?

buoyant viper
#

String#replace / String#replaceAll ?

woeful moon
#

Do either work?

buoyant viper
#

they should

#

cant remember if .replace does all occurrences of a word or just the first

woeful moon
#

Ah

#

I'll do replaceAll then

#

Thanks

#

yep, worked 🙂

opal juniper
#

it does all

#

afaik

quaint mantle
#

replaceAll is for regex

woeful moon
#

replaceAll() worked

digital rain
#

hey, quick question, what be the easiest way to count time since an event passed

tardy delta
#

runnable?

digital rain
#

hmm

tardy delta
#

not sure though

digital rain
#

well theoretically it would fit my needs

foggy estuary
#

How do you add hex colors to an custom item?

winged horizon
#

you could log the time the event took place at, and compare to current time if you just need the time difference to a later point

tardy delta
#

use System.currentimemillis for that

digital rain
#

thanks, but ill first try the runable

digital rain
tardy delta
#

no

digital rain
#

😄

foggy estuary
#

no

#

they are BORING COLORS

unkempt peak
#

Are you trying to use hex colors for chat?

#

I don't think that's possible

#

Maybe with a resource pack or something

hybrid spoke
#

her colors.. everything reminds me of her

unkempt peak
#

Lmao autocorrect

silver shuttle
#

Can somebody explains to me what happens when an event is listened to by 2 different plugins and they have 2 different methods under the event, but only one cancels it?

foggy estuary
#

no im trying to get hex colours for items

#

as its name

tardy delta
silver shuttle
hybrid spoke
silver shuttle
#

thank you

unkempt peak
hybrid spoke
#

oh well, maybe not a good example but its in there

tardy delta
#

kiddo do you miss her? 🌝

foggy estuary
hybrid spoke
#

and she's beautiful

foggy estuary
#

u sure? @unkempt peak

hybrid spoke
#

blinking in different colours

#

have an on off button

#

and i can stick my usb stick into her

unkempt peak
foggy estuary
#

yes

#

default#

hybrid spoke
unkempt peak
#

Huh I've never seen that before

hybrid spoke
#

1.16+ supports hex

foggy estuary
#

i need to know how you use hex colours for items

tardy delta
hybrid spoke
#

should it be

foggy estuary
#

ty

quaint mantle
#

component support when

golden turret
#

hello, i need help to store recipes

#

basically i have an auto crafter

#

and it will store the recipe

#

and the recipe can be of any type and any item

foggy estuary
# hybrid spoke ChatColor.of("hex")

org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Could not parse ChatColor &#ff5555E&#f54b60n&#ea406ad&#df3575 &#d52b80s&#ca208ah&#bf1595a&#b50ba0r&#aa00aad

#

are you sure you said it right?

chrome beacon
foggy estuary
#

idk its the way it was shown to me

#

i tried this too meta.setDisplayName(ChatColor.of("#FFFF") + "End Shard");

#

and it didnt work just pooped out this msg

#

Could not load 'plugins/CraftingRecipeDM.jar' in folder 'plugins'
13.11 21:36:39 [Server] INFO org.bukkit.plugin.InvalidPluginException: java.lang.IllegalArgumentException: Could not parse ChatColor #FFFF

chrome beacon
#

That hex color is too short

mortal hare
#

ok wtf

foggy estuary
#

can you give an example?

shadow dragon
#

white = #FFFFFF

foggy estuary
#

oh

#

lol.

mortal hare
#
this.idMap.computeIfAbsent(id, k -> Collections.newSetFromMap(new IdentityHashMap<>()));
foggy estuary
#

im stupid then.

mortal hare
#

should create set inside hashmap right?

#

but guess what

#

whenever i try to output the result to console

#

java.lang.NullPointerException: Cannot invoke "Object.toString()" because the return value of "java.util.Map.get(Object)" is null

ivory sleet
#

What map implementation

mortal hare
#

IdentityHashmap<Integer, Set<>>

#

another identityhashmap works properly

#

with the same method

ivory sleet
#

IdentityHashMap does not work with Integer

mortal hare
#

but it doesnt use integer as a key

#

yea

#

that's what i was gonna mention

ivory sleet
#

Ya so that might be why

mortal hare
#

but why

#

it doesnt

#

cant it just autobox the primitive

ivory sleet
#

Because integer is a value based class where Integer(6) and Integer(6) can be different instances thus different keys

mortal hare
#

isnt there any implementation to disable this specification

#

i don't mind this

ivory sleet
#

No there isn’t

#

However afaik Integer provides an O(1) time complexity

#

For containsKey etc

#

get

quaint mantle
#

Int2Object Map btw??

ivory sleet
#

Yuh that too

mortal hare
#

i really would love to have true memory hash map

#

even if autoboxing could break it

ivory sleet
quaint mantle
#

idk about spigot but paper provides fastutil maps n collections

mortal hare
#

so i should use Int2Object map?

#

i use paper too

#

and i have fastutils

ivory sleet
#

Yeah don’t think spigot does that sadly but

#

Sure dovidas

quaint mantle
#

If you care about performance.. I'd use guava multimap in your case tho

ivory sleet
#

it scales well

#

Why?

quaint mantle
#

the Map<?, Collection<?>> is just bulk to work with. A multimap is a fancy wrapper around

mortal hare
#

meh, its handled by internal functions

#

maybe i will switch it

ivory sleet
#

Actually I don’t know if a HashMultimap<Integer,V> or if OpenInt2ObjectHashMap<Set<V>> is faster

mortal hare
#

but i need memory comparison hashmaps

ivory sleet
#

Don’t remember the exact name for the latter but it’s something like that

quaint mantle
#

like, as i said before, if you care about performance use fastutil

mortal hare
#

if i ask Integer == Integer i mean 0xFF00 == 0xFF00 without any exceptions

quaint mantle
#

ok

#

I dont understand your problem honestly

mortal hare
#

IdentityHashmaps doesnt allow integer type. I need to store entity ID's in there for quick search times

#

that's the problem

quaint mantle
#

Why do you need an IdentityHashMap

ivory sleet
#

As manya pointed out

#

Int2ObjMap

mortal hare
#

because its faster than vanilla hashmap?

ivory sleet
#

It works similarly to an IdentityHashMap with int as a key

mortal hare
#

lemme see

ivory sleet
#

Yeah put it up in some benchmarks

quaint mantle
mortal hare
quaint mantle
#

ints does not have references or memory addresses

#

Its just 4 bytes

mortal hare
#

Well ints are stored somewhere, right

quaint mantle
#

directly

mortal hare
#

even on stack it haves memory addresses

ivory sleet
#

Actually dovidas, I believe the jvm allows the Integer cache size to be increased as a jvm flag

#

But really Int2ObjMap is probably your goto here

foggy estuary
#

#FFFFF + #FFFFF1 ?

mortal hare
# foggy estuary #FFFFF + #FFFFF1 ?

what i would do is to convert base 16 (HEX) to base 10 (Normal int system) and then add up and convert back to base 16 (HEX), but im pretty sure there's algorithm to add these up directly

foggy estuary
#

u got link?

foggy estuary
#

ty

mortal hare
#

impl something like this in your code

#

and you're good to go

#

although you can pirate code from stack overflow

quaint mantle
#

Tbh that sounds like
"I just found out what identity hash map is lets abuse it anywhere if possible because fsdt optimization"

#

Premature optimizations are evil

#

This class is not a general-purpose Map implementation! While this class implements the Map interface, it intentionally violates Map's general contract, which mandates the use of the equals method when comparing objects. This class is designed for use only in the rare cases wherein reference-equality semantics are required.

#

@mortal hare you are very picky about the slightest performance

#

I like it

mortal hare
#

im just prototyping

#

you know what

#

fine

#

im gonna use vanilla hashmap

#

but only for set

quaint mantle
#

thats just waste of time. Better do some elegant design that would be easier to work with and maintain in future rather than fucking with map implementation

#

Well, Multimap is your friend

mortal hare
#

I swear if i were in a some sort of dev team, i would nag everyone that someone just wasted something on resources

#

i can't control this..

#

i feel like im coding on commodore 64

ivory sleet
#

Just optimizing to its very extent isn’t always optimal as a whole, sure optimizations are fun. However, optimization isn’t just speed, clean code optimizes maintainability etc. Anyways if you end up optimizing speed, I’d advice you to make it a functional requirement because obviously a non functional requirement is a fast software. Making it a functional requirement can be done by for instance putting a requirement on it such as "this is going to be able to index 3,000,000 users in 10 seconds" or something.

native bloom
#

Probably a dumb question, but what is a quick way to check if a material is a block (i.e. it can be set/placed)?

winged horizon
#

isBlock?

#

something like that exists for Material, pretty sure

#

or isPlaceable

native bloom
#

ah, thanks

pastel carbon
#

How would u make a while true statement that will always run and would work when restarting the skript. if u just put it to like skript start event then it wont change if u reload the skript

mortal hare
#

seek for skunity's discord server

pastel carbon
#

oh sorry wrong server

mortal hare
#

np

lavish hemlock
#

@mortal hare You cannot access the memory address of a stack type without Unsafe usage, but at that point the value is no longer on the stack, and instead allocated somewhere in off-heap memory, and requires manual deallocation (freeMemory).

patent horizon
#

is there an easy way to change from spigot to paper apis? im using the mc plugin development plugin if that helps

lavish hemlock
#

Actually, as a general rule, you cannot access anything's memory address in Java (unless it's via foreign memory in Java 17+) without Unsafe.

mortal hare
#

ik, i'm just used to C/C++ pointer stuff

#

i miss those

#

but eh

#

kinda not at the same time

lavish hemlock
#

I mean I understand ya considering I too love manual memory but

lavish hemlock
#

Java isn't the kind of language for that.

sullen marlin
#

yes, the spigot server is definitely the appropriate place to ask how not to use spigot

quaint mantle
#

True

blazing scarab
#

||Helping people get away from spigot||

patent horizon
#

spigot is missing a method to prevent items from being picked up

#

sorry

near shoal
#

im trying to make a plugin with nms (the mojang mappings) and im getting this noClassDefFoundError. Does anyone know what might cause this?

sullen marlin
#

setPickupDelay(-1) or something

#

did you remap your plugin

patent horizon
#

not yet

#

does that support both mobs and players?

sullen marlin
#

probably

#

and if it didn't, you know there's a bug tracker where you can put feature requests

sullen marlin
near shoal
#

oh i think so

lavish hemlock
#

yeah you need to remap it back to the unmapped code when distributing it outside of a dev environment

near shoal
#

pretty sure cause im using things that are only in the mojang mappings i think

lavish hemlock
#

mojang mappings aren't used in MC's production jars soo the names conflict when placed in a prod. environment

near shoal
#

ok so how would i remap it back to the unmapped code then

#

also that seems like a pain to do that every time u wanna test if it works

sullen marlin
#

the 1.17 release post has example maven config

#

if you're not using maven then idk

near shoal
#

im using maven

lavish hemlock
#

what about Gradle, markdown_fifth?

sullen marlin
#

make sure to change to 1.17.1, the commands are still 1.17

quaint mantle
#

any special source gradle alternatives?

near shoal
young knoll
#

I’ve seen a few on GitHub

#

Haven’t tried any

quaint mantle
#

📰 🏋️

#

any way to automatically update the built jar to an ftp automatically? kind of annoying to keep dragging the jar over to the ftp client

ivory sleet
#

Ik a gradle plugin that can do it

quaint mantle
#

maven moment

mellow edge
#

does vannila mc use maven or gradle or anything like that?

near shoal
#

so ive added the example maven config to my pom.xml and replaced the 1.17s with 1.17.1 but im still getting the same error

#

java.lang.NoClassDefFoundError: net/minecraft/world/entity/player/Player

chrome beacon
#

Could you show your POM

young knoll
near shoal
#

post the entire thing here?

torn oyster
#

should i add "final" before my method parameters when possible

sullen marlin
#

did you build with maven and not your ide

near shoal
sullen marlin
#

<outputFile>C:\Users\shada\OneDrive\Desktop\1.17 server\plugins\terminator.jar</outputFile>

#

this probably breaking it

#

try removing that

near shoal
#

so where will the output file be then?

sullen marlin
#

in the target/ folder of your source dir

#

if it works you can change the target in the specialsource goal instead

near shoal
#

ok so theres 4 . original, normal, remapped and remapped obf

sullen marlin
#

normal

near shoal
#

those were there before and after building

#

yessssssss no errors

#

now to test if the plugin actually works

#

and the plugin works too!

#

thank you so much for helping me

sullen marlin
#

no worries

near shoal
#

I’ve been stuck on this for a few days and probs would have quit soon

granite burrow
#

in intelij is there a way to automatically change my output file location on project creation

drowsy helm
#

For maven theres a param

round finch
#

how do you cancel Creeper Destory Items on ground?

#

what do i need?

foggy estuary
#

player.sendMessage(ChatColor.valueOf("#9874d3") + "The Bank Heist Has Begun!"); How do you make this text into hex it

#

since this is wrong.

#

I have tried ChatColor.of(Color.("hex") btw

#

it doesnt work for text

round finch
#

use Bungee in spigot?

crimson terrace
#

I think you have to listen to EntityDamageEvent and cancel if the damaged entity is an item

granite burrow
#

itemMeta.getLore().add("test"); should add "test" to an items lore correct? regardless of what lore the item previously had

young knoll
#

Think getlore may return a copy

round finch
#

The ChatColor bungee component is built into Spigot

patent horizon
#

how do i create a item entity that isnt stackable

foggy estuary
#

i just tried that

round finch
#

ChatColor.of

make sure it’s the bungee one tho

foggy estuary
#

gives me error

granite burrow
round finch
young knoll
#

Store getLore to a variable and if it’s null set it to a new arraylist

#

Then use setLore

wild grove
#

is there a better way to do this?

// get number of occurrences with percentage and times ran
    public int getOccurrences(int timesRan, double percentage){
        int occurrences = 0;
        for (int i = 0; i < timesRan; i++){
            if (Math.random() <= percentage)
                occurrences++;
        }
        return occurrences;
    }
#

please @ me

twilit wharf
#

getting this error with my ServerConnectEvent: java.lang.NoClassDefFoundError: org/bukkit/entity/Player
note, this is bungeecord

torn oyster
#

its proxiedplayer

twilit wharf
#

OHHHH

#

goodness

lavish hemlock
#

don't use Math.random

#

use Random

round finch
#

NoClassDefFoundError

#

it litterally says Not Faund 🤣

lavish hemlock
#

@wild grove

round finch
#

Sometimes java make me nuts REEE

#

i were sitting and wondering why my List keep running null on first load

patent horizon
normal spire
#

Hello!

Why since 1.17 the versions of NMS classes packages are no longer specified, but the names of CraftBukkit packages still contains server version?

round finch
#

List = Config.getList(VAR_Path); Before Gives Null
List = (List<?>) Config.getList(VAR_Path); Now

#

can't believe this was actually my mistake

patent horizon
#

oh shoot

#

i misread

#

tbh it's kinda one step into the right direction imo

quaint mantle
#

hello, how to manage the bidding of residents and the loss of totems from casters on version 1.16.5

patent horizon
#

how can i prevent an item from being picked up

#

item.setPickupDelay(-1); this didn't work

young knoll
#

Set it to Integer.MAX_VALUE

quaint mantle
#

@young knoll

#

how to manage the bidding of residents and the loss of totems from casters on version 1.16.5

patent horizon
#

that sentence seems like it only serves the purpose of sounding sophisticated

young knoll
#

Actually looks like Short.MAX_VALUE

patent horizon
#

oh

young knoll
#

The wiki says it will not count down if set to 32767

#

Also keep in mind hoppers will still work

quaint mantle
#

trade

#

villagers

#

and

#

totem drop

#

the translator is bad(

round finch
#
public void SetUp() {
        
    List<?> list = getList(DefaultFile(), "Noob", (List<?>) Arrays.asList("Fairy","Joe","Jiff"), true);
    
    Bukkit.broadcastMessage("List:" + list);
    }
#
public static List<?> getList(File File, String VAR_Path,  List<?>  VAR_LIST, boolean Do_Set) {
        
    YamlConfiguration Config = getConfig(File);
    
    List<?> List;

    List = (List<?>) Config.getList(VAR_Path);
    
    if(Config.getList(VAR_Path) == null) {

    if(Do_Set == true) {    
    SetList(File, VAR_Path, VAR_LIST);
    List = Config.getList(VAR_Path);    
    
    } else {
    List = (List<?>) Arrays.asList("");    
    }
    
    }
    
    return List;
    }
#

why does this run null on first run?

quaint mantle
#

хз

round finch
#

I'm missing something?

young knoll
#

Ahh the variable names

#

I don’t think getList will return null, use isSet instead

round finch
#

like Yaml?

#

or do you mean List

young knoll
#

Yamlconfiguration.isSet

round finch
#

Same thing

#

some code must be wrong

#

it only seems to work second time

#

So then i do getList(DefaultFile(), "Noob", (List<?>) Arrays.asList("Fairy","Joe","Jiff"), true);
2 times it runs perfectly fine

#

i could if null repeat itself?
on set

#

np any way thanks for giving information

foggy estuary
#

Does anyone know how to reverse this? ```
{

    ItemStack item = new ItemStack(Material.AMETHYST_SHARD, 4);
    ItemMeta meta = item.getItemMeta();
    meta.setDisplayName(ChatColor.of("#9874d3") + "End Shard");
    List<String> lore = new ArrayList<>();
    lore.add("Fragment off a burning planet");
    meta.setLore(lore);
    meta.addEnchant(Enchantment.LUCK, 1, false);
    meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
    item.setItemMeta(meta);
    ItemStack endshard = item;
    
    //actual shapeless recipe 
    
    
    
    
    ShapelessRecipe sir = new ShapelessRecipe(NamespacedKey.minecraft("endshard"), endshard);
    sir.addIngredient(1,Material.DRAGON_EGG);
    Bukkit.getServer().addRecipe(sir);
}


 ItemStack item = new ItemStack(Material.AMETHYST_SHARD, 4);
 ItemStack degg = item;
 



}
```
#

so the lore item turns into dragon eggs

grave hound
#

does BlockDamageEvent apply to bedrock

foggy estuary
#

chatcolor

round finch
#

ArrayList 1_Item_Lore = ItemMeta.getLore();

2 Item:

Item2Meta .. setLore(1_Item_Lore)

Item2.setMeta(Item2Meta)

left swift
#

how can i edit entity hitbox size?

round finch
#

i said it exact same >of<

foggy estuary
#

oh shit

#

lol mb

round finch
#

it happens mistakes happens

#

@foggy estuary did you figure the Lore thing?

foggy estuary
#

yes ty very much

round finch
#

glad to help 🙂

#

i can pretty much most all the simple java stuff and some basic spigot
mns is too hard for me

grave hound
#

how do I check the nbt data of a tool used in the playerinteractevent ?

mortal hare
#

i have one simple question

#

Do you guys use protected keyword often? If so, do you feel bad for breaking encapsulation?

#

or you're the i'll encapsulate as much as I can guy

grave hound
hybrid spoke
#

first of all, you mostly use the protected keyword to share a variable or method via inheritance

#

second, with protected still encapsulation is possible and useful but in some cases unnecressary

young knoll
#

Oh wow, there is no API for canDestroy

#

You’ll have to use an NBTapi or NMS

mortal hare
#

do they access it directly, or they store reference variable inside it

hybrid spoke
#

not they, you. anonymous classes just have or access what you give them to access

mortal hare
hybrid spoke
#

yeah or a final field

#

static

#

or pass it as an parameter

#

there are many ways

mortal hare
#

you can access instance variables, not just statics

#

by using that

#

yea

hybrid spoke
#

yeah like you already said

mortal hare
#

im just wondering how anonymous classes store the references inside

#

or do they access the fields directly via this keyword

hybrid spoke
#

anonymous classes are just normal classes within your code. they act like if you would implement/extend another class with it

#

they dont have any really different behaviour

#

as i said, there are many ways to access the field.

#

and also you can store the reference

#

thats a design thing and totally up to you

mortal hare
#

well yes, but whenever you extend class in new .java file you don't have access to class field, while anonymous classes have this functionality by default

#

im not asking for a design opinion, im asking how that field passing works internally

#

no matter what field is it, private or public it could access it

hybrid spoke
#

when you instantiate an anonymous class within another class its still a part of the other class so you can access the fields

mortal hare
#

im just curious

hybrid spoke
#

its like nested classes

#

you are still inside your class but within another class

#

better said they still underly the class you instantiate them in, even if they are an own class

left swift
#

How can i change nms entity hitbox size?

paper viper
#

like slimes

hybrid spoke
#

well yeah you can

paper viper
#

and combine their hitboxes

hybrid spoke
#

but it will do nothing

paper viper
#

mhm

hybrid spoke
#

since the client has its own definition of the hitboxs size

young knoll
#

I mean

mortal hare
#

well you can, but you need to do pathtracing

young knoll
#

You could reimplement combat server side

mortal hare
#

there's no easy way to do this

hybrid spoke
#

just a hacky way

left swift
#

hmm, ok thx!

young knoll
#

To be fair path tracing is pretty easy now

#

Used it to let players swing through grass and stuff

broken hare
#

How to update BossBar for players, I use setProgesss(), but it doesn't update

young knoll
#

It should

#

What did you set it to

mortal hare
#

well path tracing concept is simple. Do something until it detects something along the path

young knoll
#

The API has methods for it

mortal hare
#

yea i saw it

rough jay
#

How do I detect the following actions in order to prevent them?

  • Break a block
  • Place a block
  • Open a check
  • Hurt player (or any entity)
  • Redstone usage
  • Spawn of entity (other than player)
mortal hare
#

actually to properly ray trace stuff manually you would need to get NMS bounding boxes

mortal hare
#

that's a bit of work

#

but API

#

is enough to do this

crimson terrace
round finch
#

Yo I did it :))
i fixed my Config setList Mothed

modest garnet
#

anyone know how i could have 2 separate vault economies

e.g. "tokens" and "money"

without using, plugins which require /<pluginname> <econame>

noble lantern
#

When you get a UUID from lets say a Skeleton, does the UUID for that mob ever change?

crimson terrace
#

no

#

the uid in uuid stands for unique id

round finch
#

EntityID

round finch
#

getUniqueId()

round finch
#

You can store the Entities how ever you want and get Entity

#

i believe you can also store the Entity itself

patent horizon
#

is there a built in method or something to check if a string contains only alphanumeral characters?

foggy estuary
#

Is there any way to create a double echest ( like double chest )

patent horizon
#

you could make a double chest gui and store every item in every slot

dry forum
#

i have a quick question about maven, lets say i add an api (jda) for example. is the .jar file supose to be bigger?

patent horizon
#

probably

round finch
worldly ingot
worldly ingot
#
private static final Pattern PATTERN_ALPHANUMERIC = Pattern.compile("[A-Za-z0-9]");```
patent horizon
worldly ingot
#

No, native Java

patent horizon
#

ah ok

noble lantern
worldly ingot
#

Can use that expression with PATTERN_ALPHANUMERIC.matcher(string).matches()

#

Just wherever you need

patent horizon
#

ah ok

#

and just shove it in the constructor of my class?

worldly ingot
#

The Pattern? Yeah. It can be a field so it only has to compile once

patent horizon
#

awesome

round finch
#

@foggy estuary

you first choose a Location

you set first chest at that Location

you take the Chosen location and minus it by - 1 or + 1 at Neither x or z
then you place another chest at the new location

young knoll
#

I mean that won’t magically make a double ender chest

round finch
#

well if it is a double ender chest not possible
but he could make a Double Chest GUI and save it to a file

round finch
granite burrow
#

why does my config not save my comments, I use saveDefaultConfig(); to generate the config when enabling my plugin

round finch
#

First set
then save

#

Not Sure if saveDefaultConfig() override itself on creating agein agein (i have not tested or look at it)

else... check if file is not existing

ancient plank
#

snakeyaml doesn't support comments, only the one at the very TOP (header) iirc if you overwrite the config it'll remove every comment except the header, or smth like that

rough jay
#

bruh BlockRedstoneEvent cannot be cancelled...

ancient plank
#

been a while since I've done a config tbh

rough jay
#

VehicleMoveEvent can't be cancelled either...

round finch
#

that weird hmmm

round finch
rough jay
#

no VehicleMoveEvent

#

anyways I won't use that event

#

I'll use VehicleCreateEvent

round finch
#

Sad only paper has EntityMoveEvent

worldly ingot
#

Or at the very least, setNewCurrent(getOldCurrent())

round finch
#

wait i faund org.bukkit.event.entity.EntityEvent

worldly ingot
#

Yes. All entity-related events extend from it

#

It's a base event

#

You can't listen to it, if that's what came to your head lol

round finch
#

i gotta test

worldly ingot
#

No, you can't use Listener. EntityEvent has no handler lists

#

You cannot listen to that event ;p

round finch
#

i saw..

worldly ingot
#

It exists solely to supply an Entity to child events

#

There exists also PlayerEvent, WorldEvent, ServerEvent, and BlockEvent

round finch
#

@worldly ingot what would you do to block Entities Moves?

worldly ingot
#

Slowness 255 or something lol

round finch
#

AI False lel

worldly ingot
#

Or add a modifier to their movement speed attribute

#

Yep, disabling the AI as well is also an option

round finch
#

oh nice!
got the idea

disable AI on Spawning XD
for the specific mob 👍

surreal prawn