#help-development

1 messages · Page 1684 of 1

crude charm
#

uhh

formal dome
#

is there a function that is enabled within log4j that is triggered on a generic message sent to standard out?

crude charm
#

well

#

um

formal dome
#

the the log4j output seems to be broken into many different types of messages

crude charm
#

First off, it's a plugin not a datapack / mod so you need a server to run it. Do this by hosting a local server then put the plugin in that folder or run the server on a vps up to you. Also this goes in #help-server . If you want to code one then I cba.

tired oar
#

Oh ok cool thanks

tame fern
#

Anyone else have problems with BlockPopulators and 1.17.1? Can't seem to get the populate method to fire.

formal dome
#

this is sure a big class xD anyone know where the final built log message could be found in this?

ember crag
#

hi, so im trying to set a motd using serverlistping by loading it from an arraylist, but the new line character isnt working, and \n shows up in the motd, whats the fix?

quaint mantle
#

Can someone explain to me why it returns null?

#

😖

dry forum
#

for a warp plugin, how could i get the direction a player is facing *the person who is making the warp * then when a player teleports to that wark they also face that direction?

formal dome
#

def more question askers than answer givers lol

azure ravine
#

bump lol

azure ravine
quaint mantle
quaint mantle
quaint mantle
proud basin
#

private MyClass myClass = new MyClass();

#

why are you making them all static

quaint mantle
proud basin
#

Is this in your main class?

quaint mantle
paper geyser
#

I have this idea but I'm assuming my execution isn't the best possible

quaint mantle
#

Nothing returns.

paper geyser
#

Whenever someone fishes (PlayerFishEvent) I want it to send an actionbar that has random placement that increases and decreases and right now I'm using public static voids and my plan is to use a bunch of if statements and generate random numbers to call those but ik it's really bad and inefficient but it's the only way ik. Any ideas? I also plan to check what part of the actionbars they're on

proud basin
#

Show your pluginManager class

quaint mantle
proud basin
#

remove static from them

#

If you're gonna use static do PluginManager.mymethod

quaint mantle
#

works now

#

but

#

in other class no

proud basin
#

although why are you putting them in a different class

quaint mantle
proud basin
#

why not just have it in your main

#

what's the error under it?

quaint mantle
rustic gale
#

What has to happen for the event PrepareItemCraftEvent to be called?

proud basin
#

is getMySQL not static?

quaint mantle
#

youyou told me to remove

proud basin
#

oh I see

#

well

#

because you were not using it in the other class

quaint mantle
#

Oh ok

#

i`m using in other class

proud basin
quaint mantle
#

PluginManager is for getting other classes

#

I need to start the pluginmanager class to start mysql

rustic gale
proud basin
#

also I believe you are gonna get a null pointer when you run it

quaint mantle
#

How do I fix to be able to initialize a mysql function?

proud basin
#

let me check something Greater

#

?docs

#

?dk

#

one sec

rustic gale
#

ok

#

ty for helping me

proud basin
#

seems to be when the item is crafted

torn vale
proud basin
#

The player doesn't exist

torn vale
#

but why?

#

Im struggling with this code for 2 days now

proud basin
#

are they offline?

torn vale
#

I texted myself

proud basin
#

print out args[0]

#

prefixes may effect it

vague oracle
#

Your code makes no sense

#

you store a player object

#

then you get a new player object using the old ones name?

#

simple player.isOnline()

proud basin
#

isn't that deprecated?

vague oracle
#

Not only that, it will never work because you need 2 maps

torn vale
#

Im sorry for asking this lol but im awake for like 15 hours now and I want to finish this feature before going to sleep. Could maybe someone just change my code so it works? :c

vague oracle
#

You need one for sender -> receiver then one for receiver -> sender

#

Well im telling you how to fix it

torn vale
#

so I should simply use if (player.isOnline(target)) {?

vague oracle
#

:/

#

why the target

torn vale
#

okay this makes no sense, im sorry

proud basin
#

use your argument

vague oracle
#

Give me a couple of mins and I can re-write it for you, then you can learn off of it

ember crag
#

nah dont spoonfeed, its bad practice

proud basin
#

?spoonfeed

ember crag
#

@torn vale what are you trying to do exactly?

vague oracle
#

I will comment to help them learn

torn vale
#

Im trying to simply program a Essentials Plugin with a /msg and /r command for learning

vague oracle
#

There is that much wrong with it its going to take ages to help them

torn vale
#

but /r doesnt work

ember crag
#

ok lemme take a look at your code real quick

proud basin
#

I'd have to say /tell is much better

torn vale
#

in germany a lot of servers use /msg so I thought it would be a good feature for practice 😄

proud basin
#

97% of the minecraft server community uses /msg

ember crag
#

ok, just a quick thing, use uuids instead of player names, its easier to fetch a player using uuid

torn vale
#

like this:
HashMap<UUID, UUID> map1 = new HashMap<UUID, UUID>();

ember crag
#

yea

#

ok so everything looks alright, except for here

#

wtf embed

#
target.sendMessage("§7[§e" + player.getName() + " §7➡ §e" + target.getName() + "§7] " + msg);
               player.sendMessage("§7[§e" + player.getName() + " §7➡ §e" + target.getName() + "§7] " + msg);```
#

there

#

see that?

#

the second line>

torn vale
#

no

#

yea, what is with it?

ember crag
#

shouldnt the target and player name be opposite?

torn vale
#

no?

ember crag
#

wait hold on

#

i mean the first line

rustic gale
#

do u mind telling me where in the java docs it says that tho cause

#

ive looked too

#

guess im just blind xd

torn vale
ember crag
rustic gale
torn vale
formal dome
#

how do you make a codeblock in the forum?

torn vale
ember crag
torn vale
#

but if I type /r this message comes: This player isn't online!

proud basin
tame fern
#

Whhhhyyyyy

ember crag
torn vale
#

if I use UUID this 4 Warnings will show up

#

I changed every "getPlayer()" to "getUniqueId()"

#

oh wait a sec

#

stil doesn't work

vast sapphire
#

stone isn't in that list

quaint mantle
#

how to i get the name of a material? its just showing this, but armour and tools are ok

worldly ice
#

you get the item's item meta using Item#getItemMeta(), then get the name using the item meta

quaint mantle
#

i did, all null

worldly ice
#

ItemStack*

paper viper
#

you forgot to it for this one

worldly ice
random epoch
quaint mantle
#

itemMeta.setDisplayName("[" + capitalize(kitName) + "] " + item.getItemMeta().getDisplayName().toLowerCase().replaceAll("_", " "));

#

i tried

#

still null

quaint mantle
random epoch
worldly ice
#

What's item?

quaint mantle
#

local var of new itemStack made from paramater material

worldly ice
#

You already tried Material#name() right?

quaint mantle
#

yes

quaint mantle
#

works on bow and armor and tools, not arrows and golden apples

#

its wired like that 😦

#

i also tried Material.getDisplayName()

young knoll
#

What’s the issue

quaint mantle
#

the names of items and food return null, but items and armor return their name

#

not null on armor and items

young knoll
#

getDisplayName will be null unless you have done setDisplayName at some point

quaint mantle
#

so how do i get a static name from mc?

young knoll
#

There is Material.toString which will return the enum name

quaint mantle
#

that returns null

young knoll
#

And I thin ItemMeta.getLocalizedName also exists

quaint mantle
#

ill try localized

young knoll
#

Material.toString cannot be null unless material is null

#

In which case you would get an error

astral imp
#

anyone know how to get a custom models data?

young knoll
#

What do you mean

#

Iirc ItemMeta has a getCustomModelData

astral imp
#

like get an items model data from in game

young knoll
#

You could easily make a plugin for it

quaint mantle
young knoll
#

There might be a way with the in game commands, I’m not super familiar with them

quaint mantle
#

return null;

young knoll
#

What line is 87

quaint mantle
#

PluginManager.getAccount().saveData(allData.getUUID());

young knoll
#

Then something there is null

#

Probably getAccount or allData

paper geyser
#

I'm trying to make a custom fishing system which is going swimmingly (pun intended) but my issue is that the player can catch regular fish still. how do I prevent the player from catching any fish?

young knoll
#

There is a PlayerFishEvent

quaint mantle
#

Even with return, will the code still be generated every 10 minutes?

vast sapphire
#

How do I use the worldguard api to check if a player is in a region by name

young knoll
#

Calling autoSave once with the if condition not met will make the code keep running on a timer

quaint mantle
#

@young knoll the Material#toString is not working, and getDisplayName is not working, and Material#name is not working, and i need a way to simply get the name of an item!!!

torn vale
paper geyser
#

cancelling player fish event would cancel throwing the bob

#

i want the player to throw the bob BUT also not be able to get anything

#

I want fishing to be dealt with by my plugin

#

its for custom fishing

quaint mantle
#

i think there is an event for when the player catches a fish, just cancel that

#

if (event.getCaught() instanceof Fish)

paper geyser
#

hmm ok

#

wait but what if it's not an instance of fish?

#

the player will still get other loot right?

quaint mantle
#

yeah

#

check if its not null @paper geyser

#

just look at the docs and see what you wanna do

paper geyser
#

ahh alright thanks!

granite beacon
#

How do I make a EntityPlayer body rotate?
Right now I'm using:

final float[] newYaw = {npc.getEntityPlayer().yaw};
Bukkit.getScheduler().runTaskTimer(getInstance(), () -> {
    newYaw[0] += 7.5F;
    EntityPlayer entityPlayer = npc.getEntityPlayer();
    for (Player player1 : npc.getVisibleToPlayers()){
        PlayerConnection connection = ((CraftPlayer) player1).getHandle().playerConnection;
        connection.sendPacket(new PacketPlayOutEntityHeadRotation(entityPlayer, (byte) (newYaw[0] * 256 / 360)));
    }
}, 0, 2);

But the following occurs

worldly ingot
#

holy shit that's creepy lol

granite beacon
#

lmao ik

worldly ingot
#

iirc EntityPlayer does have a method for body rotation PES_Think

echo basalt
#

Having an issue with the attribute system

granite beacon
#

I thought it was client sided

echo basalt
worldly ingot
#

Well it would be a mix of both

echo basalt
#

Sends debug message but has no change

#

Has no change for Generic_movement_Speed but works with health 🤔

remote gazelle
#

is it bad idea to save world to mysql? xD

echo basalt
#

uh

#

yes

#

you can save block data sure but the entire world is a bad idea

granite beacon
remote gazelle
#

i mean its not survival world but just minigame map

#

with 200*200

unreal quartz
#

well hypixel used to store housing plots in an SQL database

#

doesn’t mean it’s a good idea but it worked at scale for some time

echo basalt
#

it's not to serialize a whole world objec

remote gazelle
#

what is .mca file?

echo basalt
#

region file

remote gazelle
#

ah that

#

hmm than how shoulld i save it to mysql

#

compress it?

unreal quartz
#

you can just literally write the contents as a blob, but saving huge files into a sql database isn’t exactly a good idea

#

consider saving the world a file system instead or use something like amazon S3, and store the URI to the world in the database instead

granite beacon
#

small file space and with FAWE it shouldn't be too hard to load/unload

echo basalt
#

What I do is like

remote gazelle
#

omg i should set my profile image

remote gazelle
#

ohh

remote gazelle
#

is this your plugin?

echo basalt
#

and allow saving in multiple types too

#

yeah it's mine

remote gazelle
#

thats cool

#

so IslandData includes island blocks?

echo basalt
#

my saving methods call a void(File[] savedFiles) once they're done saving

#

the IslandData stores a reference of those files

#

And it all gets serialized at once

#

not the best but it works

remote gazelle
#

wait that will cause outofmem error

echo basalt
#

not really

#

but

#

one thing I realized is like

#

I should store the byte[]'s along with the files

#

just storing the files probably won't work

#

as a file is just a fancy path to a real file in the file system

remote gazelle
#

ok its compliczted

echo basalt
#

basically my code does the following

OnLoad -> query database -> store file in a temp location (world or cache schematic) -> load file
OnSave -> save file -> grab contents -> save to database -> delete file

remote gazelle
#

do i hhave to set sql query max length higher?

echo basalt
#

set it as mediumblob

remote gazelle
#

i mean as i know, there is max query length

remote gazelle
#

..ok

#

lets code

#

phew

#

what is Schematic class?

echo basalt
#

FAWE stuff probably

remote gazelle
#

umm

echo basalt
#

check imports

#

where you seeing Schematic at?

remote gazelle
#

FAWEHandler

echo basalt
#

yeah it's FAWE stuff then

#

Might have to change it to Clipboard not sure

remote gazelle
#

hmm

frozen heron
#

Is there a way to backup server files that are in game and not in the files? Cause we lost all our files and there hasnt been a restart.

#

So can I execute a command within the console to save everything in the game loaded

echo basalt
#

loaded data is usually on the world folders

#

But what you basically want is to save all data loaded in RAM

#

worlds auto-save and whatever

#

The region folder contains all the blocks, entities, states

#

the playerdata folder contains all the player data (inventory, attributes, enderchest, position, world etc)

frozen heron
#

But what if that was deleted

#

How would I save all the ram live

#

Like right now

echo basalt
#

I'd just recommend you start backing up the world data automatically

#

preferably on a cloud service

frozen heron
#

^^

#

Is there a way

echo basalt
#

It's a bad idea to do that in the first place

#

saving the world is the equivalent of doing that

frozen heron
#

Well at this point we lost about tons of paid plugins, hard worked worlds and much more. So I would like to know anything that can help us towards the fix

echo basalt
#

Paid plugins can be re-downloaded on spigot

frozen heron
#

I realize that, but I want to know any possible way we can do it

echo basalt
#

It's not really possible I believe

#

closest you got is hard drive recovery

frozen heron
#

How would that work

echo basalt
#

when you delete a drive you just delete file pointers

#

they just remake the pointers and whatever

#

but really there's no way back I believe

young knoll
#

There are probably a bunch of tools that can look for deleted stuff

echo basalt
#

that too

young knoll
#

But if any of it’s been written over you’ll get corrupted data back

#

Or you need to resort to expensive recovery services

#

Get a backup system

frozen heron
#

What would /dump do

#

Not asking because of my question above

#

Just in general

young knoll
#

Is that a server command or OS command

echo basalt
#

that isn't a spigot/paper/whatever command

young knoll
frozen heron
young knoll
#

Looks like it’s for copying files from one drive to another

#

Doesn’t look to be related to live RAM

echo basalt
#

ehh

#

He just wants to get his server files

young knoll
#

I mean you should have had backups

#

If the world is still running you can force a save-all for the world files

#

But nothing like that exists for plugins afaik

elfin creek
#

how do i detect if a player causes damage to a mob

frosty tinsel
elfin creek
#

and how do i check instances of mobs like...

#
            
        }```
i want to detect if a cat is hurt
frosty tinsel
#

getType

#

Yes

elfin creek
#

ohh thanks

#

:)

remote gazelle
echo basalt
echo basalt
#

I just serialize the entire object

remote gazelle
#

what but that will not save the file

#

schematic flie

echo basalt
#

Yeah just get the byte[] and save it

#

Then you create a temp cache file, write the byte[] to it and load it

#

that's one thing I did wrong and will fix eventually

remote gazelle
#

hmm ok thanks

neat trellis
#

How do you make frosted ice that ages and doesn't leave water behind?

tepid cargo
#

Trying to do this tutorial: https://www.spigotmc.org/wiki/creating-basic-command-functions-in-bungeecord/

My Lobby class don't seem to work. Any ideas?

package me.chainsawninja.chainlobby;

import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.chat.ComponentBuilder;

public class Lobby extends Command {

    public Lobby() {
        super("Lobby");
    }

    public void execute(CommandSender sender, String[] args) {
        if ((sender instanceof ProxiedPlayer)) {
            ProxiedPlayer p = (ProxiedPlayer) sender;
            p.sendMessage(new ComponentBuilder("Connecting you to the lobby!").color(ChatColor.RED).create());

            p.connect(ProxyServer.getInstance().getServerInfo("lobby"));
        }
    }
}

I get the error
"package commands does not exist"

when calling it

ProxyServer.getInstance().getPluginManager().registerCommand(this, new commands.Lobby(this));
eternal oxide
#

new Lobby()

tepid cargo
#

thanks 🙂

#

that worked

torn oyster
#

how do i get the nearest clay block

#

from a location

tepid cargo
#

what do I need to import to use

player.getServer()
delicate steeple
#

When is plotsquared being updated for 1.17.1? Literally just bought it and didn't realise it is not supported Nevermind, stopped getting errors now for some reason

eternal oxide
#

a radial search

tepid cargo
#

dude i never know what to import x.x

eternal oxide
#

what IDE do you use?

quaint mantle
#

ProxiedPlayer, no?

echo basalt
#

what if you toss it in the middle of nowhere

torn oyster
echo basalt
#

Then I suggest you get chunksnapshots and do the queries to them async

eternal oxide
#

just do a radial search, you are only checkign a 10 block radius

echo basalt
#

or be lazy like me

#

do a top-bottom search and sort by distance

#

Since chunksnapshots exist now

#

We can do them async

#

1 thread per chunk, add up all the results

#

and bam performance

eternal oxide
#

I guess it depends on how often you need to search and for how many players

#

a snapshot probably wouldn't work in this instance as you can;t assume you have 10 blocks in either direction. You'd have to snapshot 4 chunks each time and the overhead of that may negate any performance gain you get from searching async.

#

however, reading data async is generally fine when reading blocks.

#

I've never had an issue with it. Changing anythign is a no no though

echo basalt
#

ehh you'd have to snapshot up to 4

#

Up to

eternal oxide
#

or you can ignore snapshots all together as you are only reading, and just search async

echo basalt
#

(locationx - 10) >> 4 etc

eternal oxide
#

you still have the overhead of creating "up to" 4 chunk snapshots

echo basalt
#

eh I guess

#

at some point we just say "screw spigot" and read from the region files

eternal oxide
#

You can't change anything async, but reading seems to be fine.

echo basalt
#

wish there was a way to cache a chunk section for that extra perf

#

can't bother reading spigot code that does it

eternal oxide
#

I guess it depends on your use case again

pastel hemlock
#

is there a way to ignore the limits of each tool. Like I could ignore it and a shovel would break stone at the same speed as a pickaxe

tulip owl
#

what's the event for right clicking? i can't find it on javadocs (i'd prefer to use the "block place key" event as i have my controls inverted)

tulip owl
#

i'll give it a look on javadocs, i'm new to this 😆 only done python before

worn tundra
#

Oh yeah, recommend you look at some tutorials on YouTube

tulip owl
#

i have 😄

worn tundra
#

Going to help you along the way a lot

#

With helpful events mostly

tulip owl
#

thanks 🙂

toxic mesa
#

Does anyone know how this packet is called? It might be PacketPlayInFlying or smth but idk and currently on shitty laptop so I cant test 😅

tepid cargo
# quaint mantle `ProxiedPlayer`, no?

maybe im dumb, but

public class LobbyGo extends Command {

    public LobbyGo() {
        super("Lobby");
    }

    public void execute(CommandSender sender, String[] args) {
        if ((sender instanceof ProxiedPlayer)) {
            if (sender.getServer().getInfo().getName().equalsIgnoreCase("lobby")) {
                sender.sendMessage(new ComponentBuilder("You are already connected to the Hub!").color(ChatColor.RED).create());
                return;
            }
            ProxiedPlayer p = (ProxiedPlayer) sender;
            p.sendMessage(new ComponentBuilder("Connecting you to the lobby!").color(ChatColor.GOLD).create());

            p.connect(ProxyServer.getInstance().getServerInfo("lobby"));
        }
    }
}

doesn't work, and I have tried everything. it just doesn't like "sender.getServer()"

#

nvm, fixed lol

#

put "ProxiedPlayer p = (ProxiedPlayer) sender;" first and used that

restive tangle
#
        for(Player p : Bukkit.getOnlinePlayers()){
            String rankName = PlayersYAML.get().getString("Players.." + p.getUniqueId().toString() + ".rank");
            if(rankName == "PLAYER"){
                Bukkit.broadcastMessage("e");
            }
``` this does not work and i don't know why , it seems to be when i check if the rankName is equal to something , the yml file is structured like 

Players:
dc2bb58d-743e-461a-9809-258a455ac280:
kills: 0
deaths: 0
rank: PLAYER

ivory sleet
#

use "PLAYER".equals(rankName)

#

Two strings with the same content may not be of the same object

#

Also it should probably be Players. instead of Players..

tulip owl
#

i can't seam to find out how to do this, anyone here know?

public void onPlayerInteract(PlayerInteractEvent e){
        ItemStack block = e.getItem();
        System.out.println(block);
        if(block == Material.BOW) {
            System.out.println("clicked with a bow");
        }

i think you can see what i'm trying to do 🙂

ivory sleet
#

Nope I can’t see

restive tangle
#

thanks conclure , it works

tulip owl
#

if the player right clicks with a bow then it'll send a message in console saying they clicked with a bow (i know this has no use yet, at some point it will)

glad badger
#

Make sure the action is RIGHT_CLICK_BLOCK or RIGHT_CLICK_AIR as well, otherwise you will get when players step on pressure plates and whatnot as well

tulip owl
#

ah i'll change that

#

to RIGHT_CLICK_AIR

glad badger
#

Also, do you have an @brave glenHandler above it?

#

ughh

#

Accidentally pinged someone lol

tulip owl
#

yep i do

tulip owl
glad badger
#

listener is registered?

tulip owl
#

wdym?

#

oh

#

yea 🙂

glad badger
#

Oh, so is something not working?

tulip owl
glad badger
#

oh

#

duh

#

I'm sorry I missed that

#

Check the itemstacks type

#

ItemStack#getType returns an ItemStacks material

tulip owl
#

thanks 🙂

#

also where do i put the RIGHT_CLICK_AIR? i'm new 😆

glad badger
#

The PlayerInteractEvent class has a method called 'getAction' which returns a class instance called 'Action'

tulip owl
#

ah

glad badger
#

You should, more or less, be able to check if e.getAction() == Action.RIGHT_CLICK_AIR

tulip owl
#

thanks 🙂

glad badger
#

My pleasure 🙂 Good luck

tulip owl
#

thanks!

manic furnace
#

How can i make a directory with my Plugin?

worldly ingot
#

Depends on whether you want to NIO or IO. The first is more modern and uses Path instances, the second is older but a bit more object-oriented

manic furnace
#

ok thanks

shadow tide
#

How would I give an entity (TNT) some acceleration/movement?

#

like after spawnEntity(TNT)

glad badger
#

get the entities velocity, change the vector, then set the entities velocity

shadow tide
#

I have no idea

#

what that means

glad badger
#

uhh

#

getVelocity should return a Vector object. Store that to a variable. Use the multiply method on that or set methods on that. Then use setVelocity on the entity back to the cached variable

shadow tide
#

got it I think

glad badger
#

Granted, multiply on a velocity of 0 will give no effect lol

shadow tide
#

ye

#

so add?

glad badger
#

Yeah, you can add to it

shadow tide
#

so how would I get the velocity of it

glad badger
#

Entity should have a getVelocity method

#

and spawnEntity should either return an Entity, or you can provide a Consumer that takes in an Entity. (could just use lambda)

shadow tide
#

I really have no idea what the means (I know your really trying but I'm new)

glad badger
#
Entity entity;
Vector velocity = entity.getVelocity();
velocity.setY(2);
entity.setVelocity(velocity);
shadow tide
#

Thank you this makes so muck more sense

glad badger
#

Do you have programming experience from another language?

shadow tide
#

yeah

#

C#

#

and I do have a little java experience

glad badger
#

Got it. So practically the same syntax due to Oracle not selling out to Microsoft lol

ivory sleet
#

C# is pog tho

shadow tide
#

ye

glad badger
#

Anyway, when I say Method, you may think of a function. Not technically the same, but ya know.

#

When I say "Entity should have a getVelocity method"

#

I am referring to the Class Entity having a Method called getVelocity

shadow tide
#

ik that

glad badger
#

I realize I could've been more clear with the instructions as a whole

#

"get the entities velocity, change the vector, then set the entities velocity" isn't quite

#

understandable to someone who doesn't know the methods

shadow tide
#

my problem was I was being super stupid and idk what I was doing but I wasn't even using the Class Entity

#

I was just doing player.getWorld().spawnEntity(player, Entity.TNT)

glad badger
#

Gotcha

#

spawnEntity should return the entity object

shadow tide
#

soo after it I do return Entity?

glad badger
#

no

shadow tide
#

ok

glad badger
#

spawnEntity is a method of World that returns Entity

#

Think of it in terms of

#
public Entity spawnEntity() {
  return brandNewEntityYeetYeet;
}```
#

The World#spawnEntity method returns an entity

#

So you would use it like

#
Entity entity = player.getWorld().spawnEntity(```
restive tangle
#
        if(!(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK)) return;
        if(p.getItemInHand() == null) return;
        if(e.getItem().getItemMeta().equals(ItemManager.statisticBeacon.getItemMeta())){
            Stats.showStatsGui(p);
            p.playSound(p.getLocation(), Sound.CHEST_OPEN,1,1);
        }

This does not seem to work even though it should

glad badger
#

To my knowledge... ItemMeta doesn't override .equals() so it's just comparing instances directly

shadow tide
#

Keehl im going to dm you a screenshot

eternal oxide
glad badger
#

Good call

restive tangle
#

ok , it still does not do anything

ivory sleet
#

may I ask what u r trying to do

restive tangle
#

i am trying to see if they right click an item

#

a custom item

ivory sleet
#

just use event.getItem().isSimilar(ItemManager.statisticBeacon)

#

comparing the stacks content without amount

restive tangle
#

i did

#

it does not work

glad badger
#

And if you put debug or something in prior to the similarity check, the debug fires?

restive tangle
#

No

#

wait

#

it's a problem with my gui

acoustic pendant
#

Hello, i did a simple plugin but i want to do a file for change the message, could anyone pass me a guide or something like that

#

pls 😄

restive tangle
#

for some reason it cant send the playerinteract event probably when i try to show the gui

tacit drift
#

this makes no sense

#

at line 131 i check if it's null

#

why tf does it return a NullPointerException

chrome beacon
#

jda is null

lavish hemlock
#

is jda null?

#

yeah

#

you're calling getGuildById on it when its null, which throws NullPointer

tacit drift
#

oh wtf

#

i made two jda

#

🤣

lavish hemlock
#

in all fairness, old NPEs are fucking annoying

#

in newer versions of Java you can see what's actually null tho, which is nice

#

not like I work in anything besides Java 1.8

chrome beacon
#

^ I always use Java 16 when possible

lavish hemlock
#

Well, I use Kotlin so versioning doesn't matter. It's better to get compatibility.

chrome beacon
#

I'm bad at using new features though

lavish hemlock
#

And Kotlin doesn't need the fancy NPE messages of newer versions, since it's a null-safe language.

ivory sleet
#

Any? -> Any? (:

lavish hemlock
#

listen here buckaroo

#

Any? is good for one purpose:

#

a value representing anything, even null

#

but should not be used in many contexts

#

the main one I can think of is println

ivory sleet
#

Maow?

#

MutableList<Void?>? (:

lavish hemlock
ivory sleet
#

Fuk unit

lavish hemlock
#

why would you even use a boxed primitive in Kotlin

ivory sleet
#

Void sounds so much better

#

Yeah it was just an example to make you feel bad

lavish hemlock
#

also

#

why is your List nullable

#

aaaaaaaa 😭

ivory sleet
#

And mutable (:

lavish hemlock
#

I have no issues with mutable lists

#

mutability doesn't give me heart attacks bc I'm not concurrent

ivory sleet
#

Oo not one of those mutability haters then pog

lavish hemlock
#

listen there's this one library that would be better if it was mutable

ivory sleet
#

Which is?

lavish hemlock
#

This thing is great! But I fucking benchmarked it and oh god.

ivory sleet
#

Oh those kind of libs

#

Yeah

lavish hemlock
#

I like functional code, a'ight?

ivory sleet
#

Well that’s for functional nerds

#

I mean it’s great sometimes

lavish hemlock
#

Yeah but the thing is, it's fucking slow as hell.

#

Lemme find my benchmark.

ivory sleet
#

Lol yep

lavish hemlock
#
Benchmark               Mode  Cnt   Score   Error  Units
Main.standard_library  thrpt   25  14.163 � 0.202  ops/s
Main.vavr              thrpt   25   0.828 � 0.015  ops/s
#

It can't even perform one operation in below a second.

restive tangle
#
        ItemStack other = new ItemStack(Material.PAPER);
        ItemMeta otherMeta = other.getItemMeta();
        otherMeta.setDisplayName(Utilities.color("&3&lStatus &r&7(" + p.getName() + ")"));
        List<String> otherLore = new ArrayList<>();
        lore.add("    ");
        lore.add(Utilities.color("&7∙ Online: &aTrue"));
        lore.add(Utilities.color("&7∙ K / D: " + KDR));
        lore.add("   ");
        otherMeta.setLore(otherLore);
        other.setItemMeta(otherMeta);

The lore does not appear

lavish hemlock
#

I mean there's a good reason why it's so slow too

lavish hemlock
#

All of its methods create a new List

ivory sleet
#

🥴

lavish hemlock
#

It's safe for concurrency, sure, but you lose out on any benefit that concurrency would give you when it can't even run a single operation in less than a second.

#

My benchmark code (not perfect, but they do the same thing I'm sure):

ivory sleet
#

Yeah that’s probably one of the better reasons to have stuff immutable

lavish hemlock
#

what're you doing with other after that?

restive tangle
#

i set the item

#

in a gui

stats.setItem(15, other);

lavish hemlock
#

can you show me the code from Utilities.color?

#

I'm just curious since I can't see much wrong with it

restive tangle
#
        return ChatColor.translateAlternateColorCodes('&', msg);
    }
lavish hemlock
#

yeah idk what's wrong here

#

sorry

ivory sleet
#

Quzack push the source to GitHub

#

Or gitlab if u prefer that

restive tangle
#

my github is there for the sole purpose of looking like i know github , i don't

unreal quartz
#

the list is called “otherLore” not “lore”

#

@restive tangle

lavish hemlock
#

nice catch

lavish hemlock
restive tangle
#

oh yeah , i must be legally blind

#

i will , thanks

lavish hemlock
#

do you have a lore list or smthn? lmao

#

I'm pretty sure it wouldn't even compile without one

ivory sleet
#

?kick 421921261996867585 emote spam

undone axleBOT
#

Done. That felt good.

tulip owl
#

how do i do cooldowns? i have done the code below but the cooldown doesn't work

public class PlayerInteract implements Listener {

    @EventHandler
    public void onPlayerInteract(PlayerInteractEvent e){

        Map<String, Long> cooldowns = new HashMap<String, Long>();



        ItemStack coalOne = new ItemStack(Material.COAL); //making a hashmap of 1 coal
        coalOne.setAmount(1);

        Player p = e.getPlayer(); //getting the player

        if (cooldowns.containsKey(p.getName())) {
            //in hashmap
            if (cooldowns.get(p.getName()) > System.currentTimeMillis()) {
                //still has time left
                long timeleft = (cooldowns.get(p.getName()) - System.currentTimeMillis()) / 1000;

                p.sendMessage(ChatColor.RED + "You still have " + timeleft + "s left");
                return;
            }
        }
        cooldowns.put(p.getName(), System.currentTimeMillis() + (5 * 1000));

        if(e.getAction() == Action.RIGHT_CLICK_AIR) {
             if(e.getItem().getType() == Material.NETHERITE_PICKAXE) {
                 System.out.println("clicked a netherite pick");
                 if(e.getItem().getItemMeta().hasCustomModelData()) {
                     if(e.getItem().getItemMeta().getCustomModelData() == 1) {
                         System.out.println("you r-clicked an item with custom model data of 1");
                         if(p.getInventory().contains(Material.COAL)) {
                            p.getInventory().removeItem(coalOne);
                            e.getItem().addUnsafeEnchantment(Enchantment.DIG_SPEED,7);

                         }
                         else {
                             p.sendMessage(ChatColor.AQUA + "You don't have any coal. can't speed up!");
                         }


                     }
                 }
            }
        }

    }
}
eternal oxide
#

Your Map is a local variable inside your event. It only last for the duration of the event.

tulip owl
#

so do i have to define it outside of the event? like in the main class

eternal oxide
#

in teh same class, just move it outside the method

tulip owl
#

k 🙂

acoustic pendant
#

how can i do to update the config.yml with a command?

#

i mean

#

to set if is true or false

restive tangle
#

you get the path and then set it , lets say i have the section funny: in my config.yml , its set to false by default but i can change it to true by doing getConfig().set("funny", true); and then saving the config

graceful cargo
#

hey! how could i scan a chunk, then retrieve it's blocks into a list that can be used later?

restive tangle
#
    Main plugin;
    public Message(Main inst){
        plugin = inst;
    }

    @EventHandler
    public void chat(AsyncPlayerChatEvent e){
        Player p = e.getPlayer();
        String message = e.getMessage();
        String prefix = Ranks.getRank(p).prefix;

        if(plugin.getConfig().getBoolean("useCustomChat") == false) return;
        e.setFormat(Utilities.color(plugin.getConfig().getString("chatFormat").replace("%rank%", prefix).replace("%player%", p.getName()).replace("%message%", message)));
    }

for some reason it does not work

#

the format

#

it just does not work

#

no errors

quaint mantle
#

Why did you using if config.getBoolean == false

#

Lmao

#

Just set if (!cfg.getBoolean(...))

restive tangle
#

i did , i thought that was the error

#

but it's not so i am here

quaint mantle
#

Don't use e.setaformat for that

#

use e.setMessage

#

Or e.setCancelled and send message with your method

restive tangle
#

ok

#

it does not change anything

quaint mantle
restive tangle
#

no errors , i get
<PLAYER Hockus> the message but not what it was supposed to do

#

yes i did register it

#

yes

#

no

#

my config boolean is set to true by default

solid cargo
#

any like good NMS tutorial?

#

well not tutorial, but setup

undone axleBOT
solid cargo
#

wait does nms 1.17 work for .1 ?

brittle loom
#

Hello, I'm trying to figure out how to add a sword into a chest if there aren't any in it. I've tried all the solutions I could think of but it is still not working, could you help me? ```final ItemStack sword = RandomUtil.nextItem(itemStacks);
boolean isSwordInChest = false;

    for (final ItemStack item : inventory.getStorageContents()) {

        if (item != null) {
            final boolean isSword = item.getType().name().contains("SWORD");

            if (isSword)
                isSwordInChest = true;

            if (isSwordInChest)
                break;
            else inventory.addItem(sword);

        }
    }```
#

The chests keep getting filled with swords

restive tangle
#

yeah , i don't even think its firing

#

i removed the check for boolean and it still does not work

#

ok , so it does work but the format does not change anything

hushed pasture
#

hey i have a line in my custom item plugin
private static void createWand() {
and
private static void createDiamondWand() {

now what does the createDiamondWand mean??

restive tangle
#

why are you asking us

hushed pasture
#

no like i am making 2 custom wands and one of them starts is createWand and the other is createDiamond wand soo will both of these be diffrent item or not

restive tangle
#

its just the method name

hushed pasture
#

actually technovision's code

solid cargo
#

coding tutorial guy

brittle loom
#

I've tried using the contains method before but it wasn't working either.```final ItemStack sword = RandomUtil.nextItem(itemStacks);
for (int i = 0; i < inventory.getSize(); i++) {
final ItemStack item = inventory.getItem(i);

        if (item != null) {
            final boolean isSword = inventory.contains(sword);

            if (!isSword)
                inventory.addItem(sword);
        }
    }```It isn't working because I need to check if the chest contains multiple different types of swords. I'm trying to see if the chest contains any of the items in the itemStacks list.
#

I didn't think of that, thanks a lot I'll try it out.

restive tangle
#

I don't know , everything works fine except when it reaches format

#

alright

hushed pasture
#

hello again other question if u want to add a command to get an item do u have to use @Override on the start of each command or just once and type the other code

tardy delta
#

probably

restive tangle
#

hold on , it actually has an error

hushed pasture
restive tangle
#

it is a nullpointer error

#

but everything seems to be fine

tardy delta
#

idk how your structure looks like

hushed pasture
#

wait can i send it here

restive tangle
#

i am a retard , i was using a custom yml to store messages my bad for wasting your time

solid cargo
#

btw i couldnt find anything

#

idk how to like

#

pretty much i have problems getting on how to start it

lean gull
#

i still need help, pls (1 more bug below message)

outer crane
#

Caused by getting the display name from the itemstack rather than the item meta

sharp bough
north cipher
#

are you aloud to do external link payments? (payments not through spigot)

unreal quartz
north cipher
#

alright thanks

lilac dagger
#

you can allow them to use paysafe and add them yourself

north cipher
#

alr

proud basin
#

bump

ivory sleet
#

Freestyler long time no see x)

lilac dagger
#

hey there 😄

unreal quartz
#

ignored by conclure. ouch

ivory sleet
#

Nonoonon

ivory sleet
#

?

acoustic pendant
#

Hey, i have 2 commands registered in plugin.yml but when i put the commands in minecraft it doesn't appear nothing, maybe i have them bad registered or something like that?

hasty prawn
tardy delta
#

what would be the best way to give players a reward after an hour online time?

#

i dont want to use a runnable

acoustic pendant
acoustic pendant
#

do i send you the code?

hasty prawn
#

Yeah send your onEnable & plugin.yml

#

?paste

undone axleBOT
hasty prawn
#

Could check PLAY_ONE_MINUTE Statistic, once it hits 72000 (ticks in 1 hour), reward them

#

But you still need to have a Runnable checking that

lilac dagger
ornate heart
tardy delta
hasty prawn
#

That would work, yeah

restive tangle
#
        Team owner = scoreboard.getTeam("1");
        Team player = scoreboard.getTeam("6");

people in owner team would be higher in the tablist than the people in players right?

unreal quartz
#

pro bably

restive tangle
#

well i added people to teams but it does not seem to prioratize me in the tablist

#
       Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
        Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
        Team owner = scoreboard.getTeam("aOwner");
        Team player = scoreboard.getTeam("gPlayer");

        if(owner == null){
            owner = scoreboard.registerNewTeam("aOwner");
        }
        if(player == null){
            player = scoreboard.registerNewTeam("gPlayer");
        }

        for(Player p : Bukkit.getOnlinePlayers()){
            String rankName = PlayersYAML.get().getString("Players.." + p.getUniqueId().toString() + ".rank");
            if("PLAYER".equals(rankName)){
                player.addEntry(p.getName());
            }
            else if("OWNER".equals(rankName)){
                owner.addEntry(p.getName());
            }
        }

I have been trying for a while but players still have higher priority than me for some reason

restive tangle
#

what numbers

#
        Scoreboard scoreboard = Bukkit.getServer().getScoreboardManager().getNewScoreboard();
        Team owner = scoreboard.getTeam("aOwner");
        Team player = scoreboard.getTeam("gPlayer");

        if(owner == null){
            owner = scoreboard.registerNewTeam("aOwner");
        }
        if(player == null){
            player = scoreboard.registerNewTeam("gPlayer");
        }

        for(Player p : Bukkit.getOnlinePlayers()){
            String rankName = PlayersYAML.get().getString("Players.." + p.getUniqueId().toString() + ".rank");
            if("PLAYER".equals(rankName)){
                player.addEntry(p.getName());
            }
            else if("OWNER".equals(rankName)){
                owner.addEntry(p.getName());
            }
        }
#

nothing?

#

it still does not work my god

tardy delta
#

to override the same listener from a plugin do i need to set the priority to high or low?

tame coral
#

LOWEST will be triggered first

#

MONITOR will be last

tardy delta
#

lol

#

i would think highest would be triggered first

quiet ice
#

nah, it wouldn't have the final say then

tardy delta
#

to override worldguard :/

solid cargo
#

if i want to add DPS for my custom mob, do i need to fudge with their NMS?

tardy delta
#

uhm ugh if i call a method in the oncommand, which returns true, does that stops the command?

eternal oxide
#

Why would calling a method that does anything affect the actions of onCommand?

tardy delta
#

i havent really thought about it

tropic rapids
#

can anyone help, how can i put my members playtime on my smp like it shows on the tab list next to their name

visual tide
#

i use the worldguard api in my plugin, tmcsumo, and on some servers i get this tracktrace which i don't understand at all. could this be caused by an outdated luckperms?

tardy delta
#

"not supported yet"

short shale
#

how can i do to push some player upwards?

visual tide
compact cape
#

What the ...

Caused by: java.lang.NoSuchMethodError: 'org.bukkit.entity.Entity org.bukkit.World.spawnEntity(org.bukkit.Location, org.bukkit.entity.EntityType, boolean)'
ivory sleet
#

Binary incompatibilities, what server version do u use

#

And what version do u build against

compact cape
#

1.17.1

tardy delta
# quiet ice nah, it wouldn't have the final say then

uhh i read this and i want to uncancel the event if it has been cancelled by worldguard so isnt it the highest priority?

When changing values of an event the changes of one with the higher priority will override any changes done before by a listener with a lower priority so that in the end the one with the highest priority can have the final say in the actually outcome.
compact cape
#

Both 🤷

eternal night
#

your server is probably not on the latest version

compact cape
eternal night
#

rebuild your server from latest and also nuke your local maven/gradle depdency of spigot

#

yea but spigot introduces new API in 1.17.1

ivory sleet
#

pretty sure some pr got accepted that yeeted some of the spawnEntity methods very recently

halcyon mica
#

Who here has experience with the nms pathfinding and navigation system?

#

Because I need some assistance

compact cape
halcyon mica
#

Well, I already reimplemented everything to properly annotate, deobfuscate, document and actually make it readable

#

Yet I am still lost

compact cape
#

The most success I had was I made zombie not attack players 😂

compact cape
eternal night
#

there are. They just moved from the World interface to the RegionAccessor

ivory sleet
#

Might check one of the super interfaces in case they contain it

#

Ye as lynx said

halcyon mica
compact cape
#

I was using spigot-api to make my plugin work on other versions 🤔 so they made it incompatible

halcyon mica
#

I am talking about fucking with the underlaying system

eternal night
#

nah it should still be fine

#

you are just using a method that your server does not yet know of

#

update your server to the latest of 1.17.1 and you should be fine

royal vale
#

/particle largeexplode ~ ~ ~ 2 2 2 2
How do I convert this in code? Couldn't find anything in the docs with delta x, y and z in spawnParticle().

tardy delta
#

so if i remember correctly and i have worldguard listening for an event on EventPriority.HIGH and i want to uncancel the event should i use EventPriority.HIGHEST or LOWEST?

compact cape
#

You need NORMAL or lower I think

eternal night
#

highest will be run second to last

#

and is your best bet if you are overwriting/undoing other plugin modifications

compact cape
#

🤦

#

I always make mistake with these 😂

tepid cargo
#

I was using "getPing()" for a function, but it doesn't update post connection. Anyway way to update the ping?

tardy delta
#

so highest?

crimson terrace
#

Im setting a slimes velocity to (0,-3,0). How would I do something once it reached the ground? is there an event that gets called when something hits the ground? (except the EntityDamageEvent)

misty zenith
quaint mantle
misty zenith
quaint mantle
#

chat farsi

#

😐 👍

misty zenith
quaint mantle
#

Alan mian ban midn XD

misty zenith
#

Hey guys do we have any path finder that custom entity move to special location. ?

quaint mantle
#

Hello everyone i just started looking at spigot and the event. I would like to set a glowing Potion effect to a sheep when i shear it ... but i get an Entity from the Event so ... how can i get a living Entity ?

lost matrix
solid cargo
#

are there ways to get damaged by your custom made entity for lets say, every 10 ticks?

lost matrix
solid cargo
#

like a DPS

#

have you ever fought hypixel skyblock zombie slayers?

#

like that

#

they do certain damage every second

opal juniper
#

hypickle 🤮

solid cargo
#

its an example

#

thats the only example I could think of

lost matrix
# solid cargo gen AOE dmg

Get all entities in a radius. Filter them. Damage them.
How you schedule this action is up to you but you should def abstract
a lot here.

solid cargo
#

alright thanks mate :)

solid cargo
#

can i have more than 1 event in 1 class?

minor garnet
#

how it works
calculating the speed of a projectile falling on minecraft

lean gull
#

pls help me i've asked like 5 times already (1 more bug below that message)

solid cargo
#

oh so i dont need to make each event in seperate class?

ivory sleet
lean gull
#

no one is helping anyways tho

#

if someone helps i will make a thread

solid cargo
#

p o r q u e?

ivory sleet
#

cuz its a method

#

all methods has the ( and ) at the end of them

severe oracle
#

for some reason my plugin can't connect to my database unless i manually log intro it first

solid cargo
#

perfect!

#

for me?

#

its a custom entity, so it will get killed in like 10 minutes

lean gull
#

i wonder why no one's helpin lol

#

(that was sarcasam)

#

i actually thought everyone just hates me cause i called them out for being toxic

#

anyways i didn't try because i don't know what's going on in my own plugin lmao

#

i have no clue how to fix it

#

or where to start

solid cargo
#

btw how can i make it in seconds

lean gull
#

wdym?

solid cargo
#

tried making an int, didnt really work

#

well it colored red

#

ohhh

quaint mantle
#

that can break

solid cargo
#

dont i need like a

#

divider

#

entity.getTicksLived / 20

quaint mantle
#
int secondsLived = (int) entity.getTicksLived() / 20;
solid cargo
#

smth like thiat

#

ah yes

#

thats what i thought

#

ty

quaint mantle
#

ticksLived returns a long

#

ints cant handle too many digits or it will break

solid cargo
#

its a boss so it lasts for like 7 mins

quaint mantle
#

still

#

better safe than sorry

proud basin
#

how many ticks are in 20 milliseconds

lilac dagger
#

1/3 of a tick

proud basin
#

Are you sure about that

lilac dagger
#

1 tick is like 50

#

so actually it's 2/5

#

of a tick

quaint mantle
#

What event could I use to get the y level of a player?

lilac dagger
#

getlocation

#

and it's not tied to a specific event

#

it's an entity method

#

like player

quaint mantle
#

No i want to listen for when the player hits a certain location

lean gull
#

so um can anyone help please?

lilac dagger
#

@quaint mantle moveevent

#

and its getTo

#

simplify it with block change checks

#

if getfrom block is same with getto block then don't do anything

quaint mantle
#

If i want to teleport a player should I use event.getPlayer().getLocation().add(0,200, 0);

unreal quartz
#

just use the teleport function lol

quaint mantle
#

thx

lost matrix
lean gull
#

this is the updated version of my problem:

code for the events of the gui: https://hastebin.com/damuwayave.java

bug 1: when i put a recipe that is not just 1 item i have to click an allowed slot in the gui to update it and only then it puts the result in the result slot
bug 2: after i do bug 1 and take the item from the result slot it will remove 1 of each item in the crafting grid, let me take the item but then it will put another one in its place, then if i take that one it will just give me another one and disappear from the result slot"

lean gull
#

you mean minecraft version or...?

lost matrix
#

Yes

lean gull
#

1.17.1

lost matrix
#

ok

lost matrix
# lean gull this is the updated version of my problem: code for the events of the gui: http...

Lets start by making this code a bit more maintainable and performant.
if (!(e2.getSlot() == 11 || e2.getSlot() == 12 || e2.getSlot() == 13 || e2.getSlot() == 20 || e2.getSlot() == 21 || e2.getSlot() == 22 || e2.getSlot() == 29 || e2.getSlot() == 30 || e2.getSlot() == 31 || e2.getSlot() == 24)) {
This should be replaced by a
private final Set<Integer>
in your class on which you call contains(int) on.

Pls change this and re-send the class.

lean gull
#

what

quaint mantle
#

?

#

what aint u understand

#

💀

lean gull
#

everything

quaint mantle
#

Is there a way to temporarily disable fall damage on a player?

#

make a new set

lavish hemlock
#

This code is bad.

#

Not only is this slow, but it's hard to read and update in the future.

quaint mantle
#

use that

stone sinew
lavish hemlock
#

It's not very hard to change this to something that works better.

quaint mantle
#

????????????????

lean gull
#

i am nub at java ok

#

don't judge me

lavish hemlock
#

You need to create a new set

lean gull
#

morice if you're not gonna be helpful please stop being toxic

quaint mantle
#
private Set<Integer> set = Sets.newHashSet();
lean gull
#

scratch that, just stop being toxic all together

lavish hemlock
#

A set is a collection of values

#

Y'all just let me explain this concept to him. He won't understand your code lines.

#

Java has many different "collections"

  • List = Contains a list of values that can be added to and gotten from via add and get
  • Set = Contains a list of values that can be added to but not gotten from, only iterated, like with a for-each loop.
  • Map = Contains pairs of values, where you can get a value from another value and put new pairs in with put and get
lost matrix
# lean gull morice if you're not gonna be helpful please stop being toxic
  public boolean isValidSlot(int slotID) {
    if (slotID == 10 || slotID == 11 || slotID == 13) {
      return true;
    }
    return false;
  }

To

  private static final Set<Integer> VALID_SLOTS = new HashSet<>(Arrays.asList(10, 11, 12));
  
  public boolean isValidSlot(final int slotID) {
    return VALID_SLOTS.contains(slotID);
  }
lavish hemlock
#

Set is best for this since you won't need to get a specific number, you just need to see if the Set contains a value with the contains method.

lean gull
#

my smol brain can't handle this

#

i literally have a small headache rn

lavish hemlock
#

That's unfortunate

#

Do you know what a field is?

lean gull
#

a variable outside of a method i think

lavish hemlock
#

Yep, it's a variable belonging to a class.

#

You need to create a new field in your class where you check the slots.

#

And that field needs to be a Set

lean gull
#

ok, can you dumb down what a Set is?

quaint mantle
#

bruh

lean gull
#

...again...

lavish hemlock
#

I mean, it's kinda hard to

#

But I'll try

quaint mantle
#

its a collection of data

lavish hemlock
#

A Set is a collection of values where you can only add to it, not retrieve from it.

lean gull
#

but i need to get stuff from the collection

quaint mantle
#

yes correct

#

use set#contains

lavish hemlock
#

You actually don't.

lean gull
#

then how would i do that if i can't

quaint mantle
lavish hemlock
#

Your Set should contain all your slot numbers.

quaint mantle
#

i dont use sets very often

ivory sleet
#

I use them all the time

#

very yummy

lavish hemlock
#

And the fun thing about Set is that you can check if the Set contains a value.

lean gull
#

bro wtf

#

you literally just said you cannot retrieve from it

lavish hemlock
#

Conclure, I know.

quaint mantle
#

yeah honestly why arent we using lists

#

bruh

lavish hemlock
#

ffs y'all stop fucking interrupting me

solid cargo
#

too lazy to make it

lavish hemlock
#

And we aren't using List bc you don't need to retrieve the value.

solid cargo
#

can someone help me?

lean gull
lavish hemlock
#

Checking if Set contains a value is different from retrieving a value.

#

Since you can use mySet.contains(value)

quaint mantle
#

you can use List.contains as well

ivory sleet
lavish hemlock
#

Yeah but List is less performant

quaint mantle
#

bro

lean gull
#

what's wrong with my current one doe ):

quaint mantle
#

what

quaint mantle
lavish hemlock
#

Set uses hashes iirc

lean gull
#

you makin a variable for dis, i dunt

unreal quartz
#

the point is you do not need a list

lavish hemlock
#

List uses an array (if you're using ArrayList)

lean gull
#

call me crazy but less variables equals less lag

unreal quartz
ivory sleet
unreal quartz
lavish hemlock
#

THIS IS WHAT I MEAN BY STOP FUCKING INTERRUPTING ME

lean gull
#

what's rigid

ivory sleet
#

code smell basically

lavish hemlock
#

AAAAAAA

unreal quartz
ivory sleet
#

ur application is like a pussle entangled

unreal quartz
#

lose the "i am better than all of you shut up you can't help people" attitude

ivory sleet
minor garnet
#

can some1 help plz ? how it works
calculating the speed of a projectile falling on minecraft

unreal quartz
#

there is no reason to make this place more toxic than it already is

unreal quartz
minor garnet
quaint mantle
#

ok

#

so

#

you want to use vectors ideally

#

what kind of object is falling?

minor garnet
#

i need to do something similar to minecraft perspective camera

quaint mantle
#

snowballs

#

potion

#

etc

minor garnet
#

is not something necessarily an entity

quaint mantle
#

??

solid cargo
# unreal quartz what is the issue?

ah, so if the entity gets killed in under 60 secs, make it say just the seconds, if its killed in over 60 secs, make it say minutes AND seconds

minor garnet
#

suppose we have a cartesian graph

#

where are the x, and y axes of the player's camera

quaint mantle
#

mk

minor garnet
#

in this case, I'll apply a force at +5 on x

solid cargo
#

the just seconds part is already made

minor garnet
#

then have an imaginary ball or a square something to represent the point where it's going ''the entity''

unreal quartz
#

so, is there an actual problem or

quaint mantle
#

Position

solid cargo
minor garnet
#

and as if it were the player's minecraft perspective camera, I intend to create a code recreating this scene

quaint mantle
#

yes

#

use Position

minor garnet
ivory sleet
quaint mantle
#

?

solid cargo
#

is it a java thing or spigot thing?

minor garnet
#

i need to make a player's camera move slightly in the other direction like minecraft camera perspective 😌

unreal quartz
#

timeunit is java

solid cargo
#

aight

quaint mantle
minor garnet
#

f

quaint mantle
#

i mean i guess how i would do it

minor garnet
quaint mantle
#

why do you wanna change it in the first place

minor garnet
#

the player camera position ?

quaint mantle
#

yes

minor garnet
#

yes ?

quaint mantle
#

yes

#

why do you wanna change it

#

in the first place

#

what is the point of you doing it

minor garnet
#

for make a gun camera recoil / ads system

quaint mantle
#

gun recoile

#

wdym ads system

#

ok

#

so

#

imma be honest

#

if you mean like inverting the player camera

#

inverting it via a plugin, is not possible