#help-development

1 messages · Page 1818 of 1

young knoll
#

Show us that class

#

Is your API version set

smoky oak
#

1.18

red sedge
#

which one should i use?

            instance.getLogger().log(
                    Level.INFO,
                    "Successfully loaded the items file!"
            );

or

            instance.getLogger().log(Level.INFO, "Successfully loaded the items file!");```
#

i feel like the first one is more readable but idk

spare marsh
#

Yo this is a weird question but I have to ask it. In memory and CPU wise, is it better to save an array of XYZ cords to check if a block being broken is in those cords, or is it better to put like a starting point and ending point on the cube then calculating if the broken block’XYZ is inside the cube?

mellow gulch
#

depends on how big the area is

spare marsh
#

Let’s say a 25 radius

quaint mantle
#

Is it possible to make a mob that will be in private where spawn of mobs will be prohibited?

spare marsh
#

So would be like 52x350x52

#

51*

crisp arch
#

i want to heal the player, but show the damage animation, if i did p.damage(-1f); will that do what i need?

mellow gulch
#

i'd say to use a mathematical representation and write some collision check code to see if the block is within the shape

crisp arch
#

actually wait ill just tryitandsee

#

lool

red sedge
#

or send a damage packet

crisp arch
mellow gulch
#

aabb/cylinder/sphere vs point collision check

crisp arch
spare marsh
#

But how would you calculate if it is inside?

mellow gulch
zealous osprey
#

Question, could you provide me with like a few samples of results and the used parameters, since it could be that the I messed up the order of operations somewhere ?

quaint mantle
#

Is it possible to make a mob that will be in private where spawn of mobs will be prohibited?

spare marsh
#

I get you Damn that’s smart

crisp arch
mellow gulch
dry forum
#

anyone?

red sedge
crisp arch
#

your plugin doesnt have permission to access a folder

dry forum
#

how/why though

crisp arch
dry forum
#

its not a private folder

crisp arch
smoky oak
#
[20:08:17] [Server thread/WARN]: at io.github.moterius.ofmagic.data.PlayerData.getItemCount(PlayerData.java:75)
[20:08:17] [Server thread/WARN]: at io.github.moterius.ofmagic.commands.CmdDbgGetPersistent.onCommand(CmdDbgGetPersistent.java:22)```
```java
//PlayerData:75
return items.getOrDefault(m.toString().toLowerCase(Locale.ENGLISH),0);
//GetPersistent:22
sender.sendMessage(data.getItemCount(Material.getMaterial(args[0]))+"");

HOWEVER
This works:

items.put(m.toString().toLowerCase(Locale.ENGLISH),count);
//
data.setItemCount(Material.getMaterial(args[0]),Integer.parseInt(args[1]));

That's practically the same code?!

quiet ice
#

the generics are the issue. It tries to register an listener for Event but you cannot listen for Event

undone axleBOT
glossy scroll
#

and ill see what needs to be changed

vale ember
glossy scroll
#

because im not entirely sure what youre asking

red sedge
quiet ice
#

?jd

glossy scroll
#

once again, swap the values of your Y and Z vectors

#

right now your vectors are in a Z-up orientation

#

minecraft is Y-up

zealous osprey
#

god damn, Im way to in the mindset of geogebra

smoky oak
#

Why does the upper line of code work but the lower one result in a null from the getMaterial()

data.setItemCount(Material.getMaterial(args[0]),Integer.parseInt(args[1]));
sender.sendMessage(data.getItemCount(Material.getMaterial(args[0]))+"");
#

anyone?

zealous osprey
quiet ice
#

Could I get more context there?

smoky oak
#

im trying to run a command with one of the arguments being a material in string form

quiet ice
#

And you are sure that the Material#getMaterial is the issue and not something else?

smoky oak
#

must be because what im getting is this

#

(two different commands)

#

and the FIRST TWO lines of BOTH commands is this:

quiet ice
#

What is the NPE?

smoky oak
#
Material m = Material.getMaterial(args[0]);
Utils.msg(sender, m.toString());```
quiet ice
#

and it crashes at Utils.msg(sender, m.toString());?

glossy scroll
#

@zealous osprey use this instead

smoky oak
#

basically

#

the 'caused by' reads

#
[20:22:34] [Server thread/INFO]: Moterius issued server command: /dbgset ENDER_PEARL 6
[20:22:36] [Server thread/INFO]: Moterius issued server command: /dbgget ENDER_PERAL
[20:22:36] [Server thread/ERROR]: null
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.Material.toString()" because "m" is null
at io.github.moterius.ofmagic.commands.CmdDbgGetPersistent.onCommand(CmdDbgGetPersistent.java:18) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.18.1-R0.1-SNAPSHOT.jar:?]```
#

but as i said before both commands start with the same two lines of code

#

which both contain Material.getMaterial(args[0])

stone sinew
#

Show the code.

quiet ice
#

What happens if you use matchMaterial instead?

#

getMaterial is basically Enum#valueOf from what I garner, which may not be intended

smoky oak
#

ah i see

#

as for yapper

#

This part is the same in both commands and crashes for ONE at that first line

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Material m = Material.matchMaterial(args[0]);
        Utils.msg(sender, m.toString());
stone sinew
#

Then yeah what geol said try matchMaterial

zealous osprey
# glossy scroll

Firstly, you are a blessing for sitting trough with me to the bitter end.
Secondly, there seems to be a "-" somewhere, since now the circles appear in the right direction, but if I look down they point upwards

glossy scroll
#

ok then

#

lets see

quiet ice
zealous osprey
#

must be in the y

smoky oak
#

screw me

glossy scroll
#

can you tell me what your pitch is when looking up/down?

smoky oak
#

thanks

glossy scroll
#

if its negative or positive

#

i just need that clarification

smoky oak
#

negative is up

fading lake
#

straight forward is 0

smoky oak
#

correction

#

up

glossy scroll
#

thought so

zealous osprey
#

positive

#

looking down provides a positive number

ember estuary
#

why does this throw java.lang.IllegalArgumentException: unknown world ?

dense geyser
#

are you sure its that

ember estuary
#

it says its the line with the if

#

line 23

quiet ice
#

what is the config?

#

(i. e. the contents?)

ember estuary
#

an empty file

quiet ice
#

And in the default config?

ember estuary
#

that is the default config

quiet ice
#

It is trying to deserialize a location, it shouldn't do that with an empty one

#

Might be a paper bug though, so go bother them

ember estuary
#

oh wait, then it wasnt emptry xD

#

nah, im not using paper for my plugin

#

just serverside

eternal needle
#

hi i want to do somthing whit hashmap whit my plugin but i don't now how i can get a inventory back if i do the same command

quiet ice
#

Yes, but if the server is doing things it shouldn't do then it is a bug within the server

ember estuary
#

ok, so i cant call getConfig in onload?

#

if it contains locations

quiet ice
#

I don't know how exactly it behaves but likely

ember estuary
#

alright, will put that in onEnable then

glossy scroll
#

@zealous osprey ok try making the y component of the n vector positive

quiet ice
#

Alternatively add load: POSTWORLD

glossy scroll
#

so it would be sin(phi) and not -sin(phi)

ember estuary
#

add that where

quiet ice
#

plugin.yml

ember estuary
#

ah

#

i see

#

ty

quiet ice
#

it'll delay the onLoad call until after the worlds are loaded (I think)

dense geyser
#

Listening for the PacketStatusInPing packet

quiet ice
#

the issue is that this is the default according to the spigot wiki

zealous osprey
ember estuary
#

oh

#

hmm

#

xD

#

well, ill just put it in onenable and see if that fixes it

glossy scroll
#

@zealous osprey can you describe

#

is the circle the correct orientation when u look down

zealous osprey
#

It kind of flattens into a elipse instead of a circle

zealous osprey
glossy scroll
#

send code again for me pl

zealous osprey
#

?paste

undone axleBOT
zealous osprey
glossy scroll
#

ok

zealous osprey
#

@glossy scroll
This is what I mean, it sometimes is weird

glossy scroll
#

try making the x component of the n vector negative

zealous osprey
glossy scroll
#

set your yaw to 0 for me

#

when you turn left is your yaw positive or negative

zealous osprey
glossy scroll
#

aha

#

is the circle correct when your yaw is 0?

drowsy bramble
#

p.sendMessage(textComponents.<String>toArray(new BaseComponent[0])); the (new BaseComponent[0]) needs array initalization

olive lance
#

i havent updated my plugin since 1.16 someone is saying they can open chests and doors now where they shouldnt be able to did something change?

drowsy bramble
#

and i dont know how to do that

#

im setting up a plugin someone else made and implementing it into my own plugin

zealous osprey
#

if yaw is 0, then yes, except if the pitch is 45

glossy scroll
#

ok try

zealous osprey
#

It is noteworthy that it jumps from +0 -> -0 & +180 -> -180

eternal needle
glossy scroll
#

does pitch or yaw go to 360?

#

does pitch or yaw go to 180?

drowsy bramble
zealous osprey
glossy scroll
#

yes

#

which one

#

both?

zealous osprey
#

pitch goes from 180 to -180 and yaw goes from 90 to -90

eternal needle
glossy scroll
#

oh

#

that is odd

#

grr

drowsy bramble
#

wdym?

#

maven or such?

zealous osprey
#

I can turn it into 0 -> 360 & 0 -> 180

olive lance
#

someone wanna be a real one and send api

glossy scroll
glossy scroll
#

can you try to use the latest one i came up with?

glossy scroll
drowsy bramble
#

i assume thats what u mean

eternal needle
drowsy bramble
#

intellij

eternal needle
#

yes

zealous osprey
# glossy scroll .

A 45 pitch creates this weird elipse.
First image is with the pitch 45, second is the shape

glossy scroll
#

can you tell i hate the minecraft coordinate system yet

smoky oak
#

is this the correct way to iterate over the main inventory + offhand?

for(int i = 9; i<46; i++){
  inv.getItem(i);
}```
zealous osprey
#

The moment we began

glossy scroll
#

notch probably never took a calculus course in his life i stg

smoky oak
#

inv being player.getInventory()

drowsy bramble
eternal needle
drowsy bramble
#

ah

#

p.sendMessage(textComponents.<String>toArray(new BaseComponent[0])); the (new BaseComponent[0]) needs array initalization. anyone know how to do this?

atomic shard
#

Has anyone worked with text-based tables?
I used | %-18s | %-3s | %-10s | %-10s | %-12s |%n from printf, works fine in console but not in minecraft because the font is not monospaced...

glossy scroll
#

@zealous osprey

#

ok

#

i think

#

i mayve

#

finally

eternal needle
#
public static HashMap<Player, Inventory> playersInStaffMode = new HashMap<>();

Do some one now how i can make this to open a new inv and when i do the command again it gives me the old inv back?

glossy scroll
#

hopefully we haven't tried this already?

ember estuary
#

does unregistering a listener stop any schedulers inside it?

zealous osprey
#

Isnt right either sadly

glossy scroll
#

give code

#

?paste

undone axleBOT
misty current
#

what are you tryna do

#

circle?

#

i gotchu covered

zealous osprey
misty current
#
    public static Vector getSphericalVector(double radius, double yaw, double pitch){

        double yawCos = Math.cos(Math.toRadians(yaw));
        double yawSin = Math.sin(Math.toRadians(yaw));

        double pitchCos = Math.cos(Math.toRadians(pitch));
        double pitchSin = Math.sin(Math.toRadians(pitch));

        double x = yawCos * pitchCos * radius;
        double y = pitchSin * radius;
        double z = yawSin * pitchCos * radius;

        return new Vector(x, y, z);
    }
glossy scroll
#

don't add the +180 and -90

#

get rid of those

glossy scroll
#

we want a circle around a given normal vector

zealous osprey
#

Oh shit, forgot that I had that, was playing around with some stuff

misty current
#

what do you want to do?

#

create particle circles?

zealous osprey
glossy scroll
#

conorsmine that is not enough info

#

what happens when ur move ur head

#

how does the circle move

zealous osprey
#

It seems to work fine again when yaw is 0, but rotating in pitch, it roates the wrong way

glossy scroll
#

does it rotate ok with yaw

zealous osprey
#

it roates exactly oposite of yaw, so when I look up, the direction of the circle is also showing upward

drowsy bramble
#

how do i initalize an array?

zealous osprey
#

Ima make a gif, gimme sec

glossy scroll
#

sorry i think i need a video or to come on the server lmfao

glossy scroll
#

so pitch rotation correct

#

wait

#

no

#

yaw rotation correct

#

pitch rotation incorrect

zealous osprey
#

wait, what ?

glossy scroll
#

left/right is correct

#

up/down wrong

zealous osprey
#

oh yeah, pitch not yaw

glossy scroll
#

ok

#

@zealous osprey try to make y component positive and not negative?

#

i think thats all that you need to do ?

olive lance
#

Do I need to update JDK for the new spigot api version?

opal juniper
#

depends

zealous osprey
glossy scroll
#

:)

#

ok

#

that was

#

a long

#

process

#

but im glad we got it working

zealous osprey
#

?paste

undone axleBOT
glossy scroll
#

and i take it you can displace the circle wherever you want right

#

and then of course the radius is controlled by that r variable

zealous osprey
haughty minnow
#

Is there a way to Inherit a command using vanilla jar with injection

crisp arch
#

does anyone have a tutorial for InventoryMenus? Im reading on Bukkit.createInventory, but the forums say InventoryHolder is a misuse of the api, and will be deprecated. Is there a "correct" way to do this?

zealous osprey
glossy scroll
#

yay

crisp arch
glossy scroll
crisp arch
zealous osprey
crisp arch
#

its fine, just remember to create a thread next time

spare marsh
#

Hi is there a way to iterate through player's permissions

#

Wait nvm that was a dumb question I was thinking something else...

drowsy bramble
#

can someone help

#

maybe toArray isnt the right process or whatever to use but ye

glossy scroll
#

you cannot convert BaseComponent[] to String[] like that

#

well actually

#

its a bit more specific than that

#

you put in a <String> type generic

#

so the method is going to be looking for a String[]

#

you provided a BaseComponent[]

#

you cannot do that

#

its like putting in an integer for a string parameter

#

@drowsy bramble

drowsy bramble
glossy scroll
#

what?

drowsy bramble
#

What would i replace that text with?

#

cause i lost the inital statement for it

olive lance
#

Whats the command to build the API in buildtools

glossy scroll
#

?bt

undone axleBOT
olive lance
#

that just gave me the server jar

glossy scroll
#

so what do you want?

#

do you want the jd or the source?

#

not quite sure what you mean

olive lance
#

hold on i think i see

atomic shard
#

Has anyone found a way to print tables, or stretch string lenths? Console works fine with printf but ingame i cant find a way as its not a monospace font

crisp arch
left swift
#

Hi, I register my custom type of entity. I init the datawatchers (the same wchch has EntityArmorStand), and when i try to spawn an entity i have en exception ->

Caused by: java.lang.IllegalArgumentException: Duplicate id value for 15!
        at net.minecraft.network.syncher.SynchedEntityData.define(SynchedEntityData.java:90) ~[app:?]
        at pl.tuso.xentitydev.entities.type.EntityDev.initDatawatcher(EntityDev.java:99) ~[xEntityDev-2021-12-11 20.48.jar:?]
        at net.minecraft.world.entity.Entity.<init>(Entity.java:508) ~[patched_1.17.1.jar:git-Paper-386]
        at net.minecraft.world.entity.LivingEntity.<init>(LivingEntity.java:281) ~[app:?]
        at net.minecraft.world.entity.Mob.<init>(Mob.java:131) ~[app:?]
        at net.minecraft.world.entity.PathfinderMob.<init>(PathfinderMob.java:19) ~[app:?]
        at pl.tuso.xentitydev.entities.type.EntityDev.<init>(EntityDev.java:65) ~[xEntityDev-2021-12-11 20.48.jar:?]
        at pl.tuso.xentitydev.entities.Snail.<init>(Snail.java:24) ~[xEntityDev-2021-12-11 20.48.jar:?]
        at pl.tuso.xentitydev.events.DevCommand.onCommand(DevCommand.java:25) ~[xEntityDev-2021-12-11 20.48.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[patched_1.17.1.jar:git-Paper-386]
        ... 21 more```does anyone have any idea?
Code -> https://github.com/TheTuso/xEntityDev/blob/main/src/main/java/pl/tuso/xentitydev/entities/type/EntityDev.java
fierce jolt
#

Sup, so someone create a PR that mentions I should relocate HikariCP. Is this a common thing?

lavish hemlock
#

yes

#

you should do that

fierce jolt
#

What issues could it cause?

#

Like from what I hear now it's conflicting with one plugin

#

not sure why

spare prism
#

Is there a way to change entity's walking speed without using attributes?

#

Like it is in the player interface

quaint mantle
arctic moth
#

how do u use slowness arrows in launchprojectile

#

or any other kiind of effect arrow

#

wdym

#

doesnt it take a class tho

#

for launchprojectile

#

lol

#

i thought with launchprojectile it was smth like launchProjectile(Arrow.class)

young knoll
#

LaunchProjectile returns an object

#

Of the supplied classes type

ember estuary
#

Can i make a countdown on a scoreboard without a scheduler?

#

is there any native method for it

young knoll
#

No

ember estuary
#

ok, ty

quaint mantle
#

Whats wrong with scheduler tho

copper scaffold
#

I need some help i coded a tabcompleter for a command and it doesn't show up the list i added it only shows the remove what can i do?

@Override
    public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
        Player p = (Player) sender;
        if(args.length == 1){
            List<String> value = new ArrayList<>();
            for(String va : FileConfig.getConfiguration().getStringList("server." + p.getName().toLowerCase() + ".homes")){
                value.add(va);
            }
            value.add("remove");
            return value;
        }
        if(args.length == 2){
            List<String> value = new ArrayList<>();
            value.addAll(FileConfig.getConfiguration().getStringList("server." + p.getName().toLowerCase() + ".homes"));
        return value;
        }
        return null;
    }
drowsy sapphire
#

Do I need to do getConfig().options().copyDefaults(true);?

livid tundra
#

how do I add text under the name of a player

mortal hare
#

does player entity support on hover display names in notchian client?

mortal hare
livid tundra
#

what does that mean still

mortal hare
#

whenever i set hide custom name byte field inside Metadata packet

#

my NPC nametag doesnt react to it

#

its possible to hide the nametag via teams

#

but is it possible to make it appear only on hover of the mouse

mortal hare
#

both methods work quite well

#

tracking movement of the player requires more work to do, but it allows more customizability where you new line could appear

livid tundra
#

ummm

#

sounds too complicated

mortal hare
#

and it is

#

its not one liner

livid tundra
#

how do I make a bossbar display?

mortal hare
livid tundra
#

thanks!

livid tundra
#

thanks!

mortal hare
#

then add the player via Bossbar.addPlayer()

#

in order to show it

#

what does thang mean

#

im not native speaker sorry

arctic moth
#

im confused on how to use launchprojectile with an effect arrow

#

it takes a class

#

like Arrow.class

#

so idk how to make it work

mortal hare
#

i guess specify the class name of your arrow type

#

SpectralArrow.class

#

etc

#

i've never used it

#

but maybe its like that

arctic moth
#

i dont think that works

#

trying to use slowness arrow

mortal hare
#

it should

#

you provide Class name of the projectile

arctic moth
#

wahts the class name of slowness arrow

mortal hare
#

slowness arrow class doesnt exist

#

since slowness is only an effect

arctic moth
#

then how would i make it an arrow with slowness

#

wait could i like get the projectile and then set the effect after it launches

mortal hare
#
Arrow arrow = entity.launchProjectile(Arrow.class);
arrow.addCustomEffect(PotionEffect.SLOWNESS, false);

try this ^

#

its almost the same as spawning the entity inside the world

#

you spawn the entity first, then you add the metadata

arctic moth
#

thx

mortal hare
#

np

arctic moth
#

potioneffect.slowness isnt a thing

ember estuary
#

is a 1-tick repeating scheduler (that updates a scoreboard and some values in a hashmap) bad for performance? or not really a problem?

vapid flower
#

java: cannot find symbol symbol: method getClickedInventory() location: variable event of type org.bukkit.event.inventory.InventoryClickEvent
How do i fix this?

vapid flower
#
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
    public void onInventoryClick(InventoryClickEvent event) {
        if (event.getClickedInventory() == null || !(event.getWhoClicked() instanceof Player)) {
            return;
        }

        Player player = (Player) event.getWhoClicked();
        Inventory inventory = player.getOpenInventory().getTopInventory();```
#

But it has to do with maven or smth

#

Cuz I am trying to get it working again, but it errors out with the maven error

#

And I don't know why

quaint mantle
#

i would ask for like "is it imported" "is it a dependency" but just seems like filler

main nymph
#

how i can make mapvote

quaint mantle
# vapid flower

well i was hoping you wouldnt select the text i was looking for

vapid flower
quaint mantle
#

send your pom

quasi patrol
#

How would I make it not give a player a fish when they catch a fish? Cancelling does that the event, but it also keeps the hook in the water without retracting it.

vapid flower
quaint mantle
quasi patrol
#

There is a remove() though so let me try that. .-.

quaint mantle
#

thats what i meant, sorry

#

why the extra blank lines 😢

quasi patrol
quaint mantle
#

oh wait

#

setHookedEntity(null)

vapid flower
mortal hare
#

my code works

#

but i dont know how it works

#

i literally somehow hided the player's nametag

#

without team

#

NVM

#

my client went out of sync because i reloaded the plugin

#

i need to censor this until md5 sees what im doing with packets

olive lance
#

how do i create a thread

#

in discord

quaint mantle
#

oh

olive lance
#

lol

quaint mantle
#

top right

#

the # button

olive lance
#

ty

smoky oak
#

can i iterate somehow over all existing chunks of a world, even if they're unloaded?

olive lance
#

config not loading default values or any values

smoky oak
#

ah nevermind I can just do a crude patch

#

ie spawn in a 8200 block of bedrock when a chunk loads

#

dont ask

olive lance
#

i couldnt think of a good title for my thread but its a weird issue

burnt wedge
#

what would be an efficient way for making a EntityMoveEvent

young knoll
#

Step 1. Don't

burnt wedge
#

what if I have to tho

young knoll
#

If you have to track every entity movement you need to rethink your design

onyx fjord
#

That's bad to say the least

#

@young knoll entitytickevenr

#

Shall run 20 times per second per entity

onyx fjord
#

Yes

ocean spruce
#

Question how does MerchantRecipe work? is that "recipe"/trade then have a chance of appearing on a villager? does it need to be assigned/set to a villager ?

wide coyote
#

man.. this code wont add money

#

?learnjava

undone axleBOT
wide coyote
#

@quaint mantle

ocean spruce
hasty prawn
#

You have to set the new amount back into the map.

ocean spruce
#

if you are new to java ^ those links will help 100%, as for an economy system your doing alright, but if you want your plugin to work with other plugins and shops I suggest using vaults api a lot of other plugins use this and / or work with it https://github.com/MilkBowl/VaultAPI

#

they have a create example for implanting vault ^

#

and vault will handle some nitty gritty things for you like saving player balances and such

#

@quaint mantle have a good night

copper scaffold
#

https://pastebin.com/7r2qed1T
I need help here. Its a /home command with a 10 sec delay of waiting. the problem is when more Players use the command only the first player is going to teleport to his home but the second doesn't work...

spare marsh
copper scaffold
#

okay but how can i detekt if a player doesn't moved in that 10 seconds?

spare marsh
#

For that you would need some sort of a map

#

A list would do it too.

copper scaffold
#

i have a set<UUID>

spare marsh
#

You can try a map of Player and BukkitTask

#

for example

#

Map<Player, BukkitTask>

#

You could initialize that map somewhere so you can have access to it on the command class

#

Then when the command is ran, put in the player into the key, and the BukkitRunnable into the Value

#

You could use the PlayerMoveEvent event to detect if a player moves and if he does while he is waiting to teleport, just get the task and cancel it.

#

from the map value

copper scaffold
#

okay wait... i don't really get it how to make this right now...

quaint mantle
#

Hey my main class name is Main.java and it's in the package "fr.jayrex.economybridge" and in the plugin.yml it added "main: fr.jayrex.economybridge.EcoBridge" but i get the error "org.bukkit.plugin.InvalidPluginException: Cannot find main class `fr.jayrex.economybridge.Main'" when i launch my server.

ocean spruce
#

is your main class set in your plugin.yml?

quaint mantle
ocean spruce
#

np

quaint mantle
#

but i don't understand why it's giving me that error

ocean spruce
#

what does the command look like?

waxen plinth
#

You would need to parse it as an int

#

Or double I guess

ocean spruce
waxen plinth
#

Though as soon as you feel a bit comfortable with implementing commands through the standard plugin.yml and executor method, I would abandon it

dense compass
#

I'm removing durability from the tool in a players main hand but when at 0 durability (or below) it goes into negative durability instead of breaking, how would I go about breaking the players tool in main hand (with animation of tool break, not just removing)?

olive lance
#

In PlayerInteractEvent e.getMaterial().equals(Material.AIR) returns true no matter what i click

#

why

#

oh

#

nvm i think i know why

eternal oxide
#

use == to compare Enums

olive lance
#

oh is that it? i was thinking that was checking for item in hand

#

it is actually

#

item in hand

eternal oxide
#

Yes, however still compare with == ```

getMaterial
@NotNull
public Material getMaterial()
Convenience method. Returns the material of the item represented by this event

Returns:
Material the material of the item used

#

you want getClickedBlock()

#

The reason being, There can only ever be one instance of an Enum. You are instance checking using ==.

#

.equals is to compare objects

#

like, does this apple equal this other apple

proud basin
#

how can I update log4j to a newer version in my project

eternal oxide
#

If you are actually using it as a dependency, update your depends

#

To prevent the library being exploited, it's urgently recommended that Log4j versions are upgraded to log4j-2.15.0-rc1.

#

If you are unable to update In order to mitigate vulnerabilities, users should switch log4j2.formatMsgNoLookups to true by adding:"‐Dlog4j2.formatMsgNoLookups=True" to the JVM command for starting the application.

woeful crescent
#

very strange error with mongodb: it can't find an entry that was literally just set and can be found in the database

proud basin
#

Would I require a web socket to load text over a players head using the same type of client?

eternal oxide
#

Your question is too random to answer

spare marsh
proud basin
spare marsh
#

You’re talking about plug-ins here or mods?

proud basin
#

mods

spare marsh
# proud basin yes

I believe that with a plug-in, you can manage the packets that are sent to a player and just show a different version of the floating text to the target client perhaps? I am not really sure

#

Mods? Oh that’s a whole different thing haha

#

Depends where the text is coming from

noble lantern
#

Is there any events for listening when Inventory#addItem is called?

eternal oxide
#

if the item is added via a plugin, then no

unique shuttle
#

PacketPlayOutEntityDestroy no work with Item dropped. any idea why?

mystic sky
granite beacon
#

I've ran into a bit of a quirk and I was just curious if there's any workaround. If you fill a dispenser with indispensable items it will still make a click sound and show the shooting particles. Is there any way to test for this event? BlockDispenseEvent doesn't actually fire since nothing is being dispensed. Fixed with: BlockFailedDispenseEvent from paper

livid tundra
#

how do I get the boss bars that are displayed on a player's screen?

livid tundra
#

to make some of them stop displaying

mystic sky
#

https://www.youtube.com/watch?v=9apL86E05Bc
I hope this help u, best than reading.

mystic sky
livid tundra
#

I'm displaying the health of mobs, and when the player hits a new mob, I want the bossbar to stop displaying

mystic sky
#

Then access to it, and avoid the log.

livid tundra
#

?

mystic sky
#

U can use #removeAll() if u want.

livid tundra
#

I don't want the boss bars of other players to dissapear

#

also, I'm looking at the getbossbars method, and why does it say " (dot) not created using createBossBar(String, BarColor, BarStyle, BarFlag...)" ?

#

full text is
Gets an unmodifiable iterator through all persistent bossbars.
(dot) not bound to a Boss
(dot) not created using createBossBar(String, BarColor, BarStyle, BarFlag...)
e.g. bossbars created using the bossbar command

mystic sky
cedar oyster
#

what about the setVisible method? you might be able to do "bossbar.setVisible(False)"

unique shuttle
quaint mantle
#

what kind of databases do you guys use on your plugins? I'm hoping I can have a database simple as SQLITE to store some infos

proud basin
#

mysql, mongodb

proud basin
quaint mantle
#

they're rather complicated if compared to sqlite

proud basin
#

🤷‍♂️ I don't see how they are complicated

quaint mantle
#

having to setup a dbserver prior to usage of the plugin

proud basin
#

then use json

#

or .db

quaint mantle
#

That's where Sqlite comes along...

#

Was just hoping to know

#

fi there were any other alternatives

proud basin
#

.txt

quaint mantle
proud basin
#

is this a public plugin you're releasing?

quaint mantle
#

yes

#

well

#

not really releasing

#

it's just a small plugin for me and my friends

proud basin
#

ah ok

quaint mantle
#

basically a sign that is a portal

#

2 signs connect to each other and make a portal

#

Btw

#

on java is there any recommended orm or something like that?

#

to use databases such as mysql, sqlite

#

and others

noble lantern
#

Kind of a long stretch:

But is there a way to set the burn length of lets say a stick or something?

waxen plinth
#

In a furnace?

noble lantern
#

Yes, i think i found it FurnaceBurnEvent

wide lily
#

is there a way to remove a certain amount of something from someone's inventory

#

im currently using this

#

e.getPlayer().getInventory().remove(new ItemStack(Material.DIAMOND,2));

#

but it's not removing anything

wide lily
#

never mind i figured it out

late yew
#

I get this java.lang.NullPointerException: Cannot invoke "net.dv8tion.jda.api.JDA.addEventListener(Object[])" because "this.jda" is null
Here's my code

public class Bot extends ListenerAdapter implements CommandExecutor, Listener {
    private Discord plugin;
    public HashMap<UUID,String> uuidCodeMap;
    public HashMap<UUID,String> uuidIdMap;
    public List<UUID> verifiedMembers;
    public Guild guild;
    public JDA jda;
    public Bot(Discord main) {
        this.plugin = main;
        startBot();
        uuidCodeMap = new HashMap<>();
        uuidIdMap = new HashMap<>();
        verifiedMembers = new ArrayList<>();
        jda.addEventListener(this);
        plugin.getServer().getPluginManager().registerEvents(this,plugin);
        plugin.getCommand("verify").setExecutor(this);
        Bukkit.getScheduler().runTaskLater(plugin,()->guild = jda.getGuilds().get(0),20L);
    }```
#

Can anyone help me?

wicked lake
#

jda isn't being initialized, you can't addEventListener to a null object

late yew
wicked lake
#

You need to initialize jda as a new JDA object, then it'll work just fine

late yew
#

How tho?

wicked lake
#

I've never worked with that library but chances are java JDA jda = new JDA(); with some kind of arguments in the (), if needed

compact cape
#

Can I schedule a sync task for main thread from an async task??

wicked lake
#

Well - I should really be asking what you need it for

compact cape
#

I have currently doing a check in main thread for a listener which might schedule a sync task, But I noticed it causes some spike lags so I decided to do the check async

wicked lake
#

BukkitScheduler should work fine, then

compact cape
#

So if I call BukkitScheduler to create the task inside the async task it would be fine?

wicked lake
#

Should be, I've never personally created a task within a task but I don't see why it wouldn't work

wicked lake
wicked lake
#

Okay then yeah just initialize it

pliant tundra
#

im working on a plugin in kotlin, and it doesnt load the plugin when i start my dev server
can someone tell me if anything is wrong w/ my pom.xml (part 2 below)```xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.narutopig</groupId>
<artifactId>BoRS</artifactId>
<version>1.0.0</version>

<properties>
    <kotlin.version>1.6.10-RC</kotlin.version>
</properties>

<repositories>
    <repository>
        <id>spigot-repo</id>
        <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>${kotlin.version}</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-test-junit</artifactId>
        <version>${kotlin.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.spigotmc</groupId>
        <artifactId>spigot-api</artifactId>
        <version>1.18-R0.1-SNAPSHOT</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <sourceDirectory>src/main/kotlin</sourceDirectory>
    <resources>
        <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>false</filtering>
            <includes>
                <include>plugin.yml</include>
            </includes>
        </resource>
    </resources>```
#
<plugins>
            <plugin>
                <artifactId>kotlin-maven-plugin</artifactId>
                <groupId>org.jetbrains.kotlin</groupId>
                <version>${kotlin.version}</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <goals> <goal>compile</goal> </goals>
                        <configuration>
                            <sourceDirs>
                                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
                            </sourceDirs>
                        </configuration>
                    </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <executions>
                <execution>
                    <id>default-compile</id>
                    <phase>none</phase>
                </execution>
                <execution>
                    <id>default-testCompile</id>
                    <phase>none</phase>
                </execution>
                <execution>
                    <id>java-compile</id>
                    <phase>compile</phase>
                    <goals> <goal>compile</goal> </goals>
                </execution>
                <execution>
                    <id>java-test-compile</id>
                    <phase>test-compile</phase>
                    <goals> <goal>testCompile</goal> </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            ```
#
<groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</project>
quaint mantle
late yew
wicked lake
#

From the official documentation

JDA jda = JDABuilder.createLight("BOT_TOKEN_HERE", EnumSet.noneOf(GatewayIntent.class)) // slash commands don't need any intents
                .addEventListeners(new SlashBotExample())
                .build();```
late yew
#
public class Bot extends ListenerAdapter implements CommandExecutor, Listener {
    private Discord plugin;
    public HashMap<UUID,String> uuidCodeMap;
    public HashMap<UUID,String> uuidIdMap;
    public List<UUID> verifiedMembers;
    public Guild guild;
    JDA jda;
    public Bot(Discord main) {
        this.plugin = main;
        startBot();
        uuidCodeMap = new HashMap<>();
        uuidIdMap = new HashMap<>();
        verifiedMembers = new ArrayList<>();
        jda.addEventListener(this);
        plugin.getServer().getPluginManager().registerEvents(this,plugin);
        plugin.getCommand("verify").setExecutor(this);
        Bukkit.getScheduler().runTaskLater(plugin,()->guild = jda.getGuilds().get(0),20L);
    }
    private void startBot() {
        try {
            JDA jda = JDABuilder.createDefault("x")
                .build();
        } catch (LoginException e) {
            e.printStackTrace();
        }
    }``` That's what I use
drowsy helm
#

startBot should be giving you an error

#

jda has already been defined

late yew
drowsy helm
#

sorry wait no that will actually define it locally iirc

#

you dont have to define the variable type in startBot, its already defined

wicked lake
#

He closed it off before writing startBot(), it's not in scope ye

late yew
wicked lake
#

Also not calling it anywhere

drowsy helm
#

he is

#

under this.plugin = main;

wicked lake
#

oo

#

Missed that

drowsy helm
late yew
drowsy helm
#

System.out.println(jda);

#

if thats null it means jda itself is returning a null

#

if not it means you're messing up somewhere

late yew
#

It's not even printing JDA, tried with System.out.println(jda); and Bukkit.getServer().getConsoleSender().sendMessage(jda); but doesn't seem to print

#

nvm I had to reload the server 😄

wicked lake
#
public class Bot extends ListenerAdapter implements CommandExecutor, Listener {
    private Discord plugin;
    public HashMap<UUID,String> uuidCodeMap;
    public HashMap<UUID,String> uuidIdMap;
    public List<UUID> verifiedMembers;
    public Guild guild;
    JDA jda;
    public Bot(Discord main) {
        this.plugin = main;
        this.jda = startBot();
        uuidCodeMap = new HashMap<>();
        uuidIdMap = new HashMap<>();
        verifiedMembers = new ArrayList<>();
        jda.addEventListener(this);
        plugin.getServer().getPluginManager().registerEvents(this,plugin);
        plugin.getCommand("verify").setExecutor(this);
        Bukkit.getScheduler().runTaskLater(plugin,()->guild = jda.getGuilds().get(0),20L);
    }
    private JDA startBot() {
        try {
            JDA jda = JDABuilder.createDefault("x")
                .build();
            return jda;
        } catch (LoginException e) {
            e.printStackTrace();
            return null;
        }
    }```
#

Should work with that

late yew
#

Well I reloaded my server and it actually did fix that prolly cause of public JDA jda; i had before

wicked lake
#

Interesting

#

No idea why haha

late yew
#

I'm using PlugmanX prolly of disable/enable

quaint mantle
#

dont use plugman

#

restart your server

small talon
#

Can't really think of a better place to ask, I'm trying to make a gradle task that automatically replaces my existing plugin with a newly built one, this is what I've got: groovy tasks.register('dobuild') { dependsOn 'build' doLast { java.nio.file.Files.copy(java.nio.file.Paths.get("C:\\Users\\admin\\Dev\\MC\\IsleOfReyven\\lib\\build\\libs\\lib.jar"), java.nio.file.Paths.get("C:\\Users\\admin\\Dev\\MC\\TestServer\\plugins"), java.nio.file.StandardCopyOption.REPLACE_EXISTING) } } But this tells me: java.nio.file.DirectoryNotEmptyException: C:\Users\admin\Dev\MC\TestServer\plugins

eternal night
#

The copy call doesn't take a directory as output

#

You'll have to specify the actual file name

small talon
#

Oh, that makes sense, one moment

#

Ah that's bothersome then, nio might actually be trying to delete the file to copy the new one in with the REPLACE_EXISTING option

#

oh too bad

eternal night
#

Isn't that the point or replace existing ? Delete old and throw in new

wicked lake
#

If you need to keep older versions of the mod for whatever reason, version control is easy

late yew
#

How can I find a string in my yml file?

grim ice
#

FileConfiguration.getString(path)

late yew
noble lantern
#

You iterate through ConfigurationSections

#

and check the key (Its a string)

quaint mantle
#

getKeys(boolean deep: i prefer false)

noble lantern
#

^

quaint mantle
#

that deep means if you turn on, it will search through other entries in the entries

noble lantern
#

i always iterate like this

#

ignore that warning if its null the users an idiot

noble lantern
#

You still need to relatively know what will be where though

quaint mantle
#

like this

hello:
  hello1:
    messages:
      1: "odl"
  hello2:
    messages:
      1: "odl"```
if you use `getKeys(false)` at the path `hello` you will get `hello1` and `hello2` while if you use `true` then it will get the `messages` and `1`
noble lantern
#

oh thats what true does

#

always wondered but i didnt want to go through the hassle of trying

quaint mantle
#

wait lemme check again i have bukkit codes here

noble lantern
#

I just know when i was learning spigot i was told to use false in many different articles so i was like i guess i do false

#

3-4 years later still doing the same thing xD

late yew
#

I'm actually having something like this

Data:
  Yeagorn: 'string'
#

And I want to get the string assigned to the username

noble lantern
#

and iterate through it with getKeys(false)

#

the String is going to be the next field down eg Yeagorn

small talon
late yew
#

Not the username

#

eg. Yeagorn: "test" to get the test

#

not the username

#

tried with getKeys(true) still returns the username

noble lantern
#

You need to use sec.getString(thatKey);

#

Like so

late yew
#

yeah I see

noble lantern
#

the key will be the username, and you use the key to get the String value

#

Just make sure you use the key with the ConfigurationSection your already iterating over or youll be big confused xD

lunar schooner
#

Hey folks, I'm looking for the obfuscated name of n.m.s.level.EntityPlayer#updateAbilities() (It's pre 1.17 name), what is it's name in 1.18+? I found w() however this doesnt seem to give the same result. XP levels on the client aren't updated 😅

noble lantern
#

idk much about NMS but cant you edit abilities with the base API?

#

i remember something about removing/adding/editing certain player abilities i did this to remove the attack cooldown players had, this was back in like 1.13ish

lunar schooner
#

I'm currently manually removing the player from the world on the client and adding them back (i.e fake respawning, to reload their skin), so I'm not sure if thatll work

noble lantern
#

ohh i see, in that case i wouldnt know im sorry

lunar schooner
#

Could totally try this though: player.setExp(player.getExp()); 🤔 I'd imagine that that updates the XP on the client too

quaint mantle
#

How do I find out the coordinates of the snow that the snowman has set?

noble lantern
lunar schooner
#

ah, Ill want setTotalExperience then

noble lantern
lunar schooner
#

close enough 😂

lunar schooner
quaint mantle
lunar schooner
#

So you need to respawn the player, but only on their client

noble lantern
quaint mantle
lunar schooner
#

Yep

noble lantern
#

and one second later check the block above is snow or not

quaint mantle
noble lantern
#

Okay then do this

#

create a timer and check the snowmans location ever x ticks

#

if location is same return

#

if different dont return and store the block

lunar schooner
#

Curious, the remapped-mojang and runtime spigot jars do not contain the same classes 🤔

#

e.g most of the n.m.network.protocol.game. classes are different

quaint mantle
noble lantern
#

thats a lot of code

#

You just need a Runnable and the snowmans UUID

quaint mantle
#

If the snowman does not go exactly in blocks, he puts 4 blocks of snow at once

noble lantern
#

So you just speed up the timer checking where the snowman but dont go crazy with how fast you check

#

like 2 times a second is probably the fastest check you need

#

I dont see snowmans moving that fast to travel more than one block in 10 ticks

lunar schooner
#

I need to get a player's float experienceProgress, anyone got a clue what method would supply that?

#

Actually, that is getExp(), nevermind 😂

quaint mantle
#

s

bitter sentinel
#

can someone tell me how to make spawners spawn items like diamonds and i want to know how to make it so i can customize the Spawn Delay and Spawn Count. Thanks!

cerulean valley
#

is there an event that is called when trees are generated during terrain generation?

noble lantern
noble lantern
#

Eg check if its wood/leaves and cancel it somehow

#

im on fire tnight ngl

smoky oak
#

how much would filling the upper half of the nether with bedrocck increase the storage volume on the drive?

noble lantern
#

not much

bitter sentinel
smoky oak
#

java

noble lantern
#

it depends on how many chunks are in the actual world

#

not really how many blocks per chunk

#

Unless your storing data

#

like chests, nbt datas etc

#

Because technically AIR blocks get stored

bitter sentinel
noble lantern
cerulean valley
#

which event would that be? and, i'm not sure if doing it by block would work, but maybe there is a hacky way to find out which blocks are generated together

smoky oak
#

ah no im not. But that reminds me of something.
If i set the persistentDataContainer of a shulker box item, place it, mine it, and then access the pdc, is it still there?

noble lantern
bitter sentinel
noble lantern
#

Because it gets converted to a block

#

i think?

#

might be worth testing

#

But i think it gets counted as a block once placed

smoky oak
#

imma do that when i have time but thaks

noble lantern
bitter sentinel
#

WHERE DO I PUT THAT

#

its a command?

noble lantern
#

In your event listener

smoky oak
#

look up a basic plugin tutorial

noble lantern
#

Its an Event hance the ending word Event

bitter sentinel
#

what is event lister

lavish hemlock
#

I think you're in the wrong channel, Omaster.

noble lantern
#

Possibly

bitter sentinel
#

wdym

noble lantern
#

If your looking for a plugin

bitter sentinel
#

noon

#

look

noble lantern
#

Look up a Generators plugin

lavish hemlock
#

you're*

noble lantern
cerulean valley
#

XD

noble lantern
#

typo was intentional

bitter sentinel
#

ik there is a command

#

/setblock yxz ....

noble lantern
#

Nope no command to do that maybe with Command Blocks though?

noble lantern
#

items are entities

#

so you need to spawn items into the world

#

while also canceling the mob spawned from x spawner

bitter sentinel
#

how can i do this

cerulean valley
#

oof

noble lantern
#

You would need to know how to make a basic spigot plugin first before doing this

bitter sentinel
#

where and how do i start

noble lantern
#

?learnjava

undone axleBOT
noble lantern
cerulean valley
#

you could also search on youtube how to make spigot plugins, some people i know learned it that way

vale ember
#

what's the correct way of logging fatal errors causing plugin to disable?

noble lantern
#

SEVERE

#

that one

vale ember
#

will it mark it as error and print it red?

noble lantern
#

log(Level.SEVERE, "error message");

#

Yessir

#

also throwing a stacktrace helps

vale ember
#

in my case that's not stacktrace

noble lantern
#

ah kk

vale ember
#

it's invalid config file

noble lantern
#

ahh okay, then yeah log with SEVERE and then disablePlugin(this)

vale ember
#

oh, it's correct but should i color it red?

noble lantern
#

IIRC SEVERE is defaulted red

#

i could be wrong

#

i never used it though

vale ember
#

i run it in intellij's terminal and it's white

eternal oxide
#

Colouring logs is fairly pointless

#

all it does is make teh file harder to read

vale ember
#

not file, console

noble lantern
#

but

#

doesnt that strip colors?

eternal oxide
#

Thats only useful if someone happens to be looking at the console at teh time

noble lantern
#

sec i have my latest.log ill check

#

nah colors are stripped

eternal oxide
#

Handy, I guess its sysout that doesn;t strip

noble lantern
#

Yeah i guess thats why bukkit gives the error now when using sysout and not bukkit logger

eternal oxide
#

I know I've seen many unreadable logs due to color codes

noble lantern
noble lantern
#

ahh

#

sometimes is confusing between the two xD

cerulean valley
#

(meanwhile me, specifically writing colored log files^^)

noble lantern
#

Im using spigot api though for this plugin

#

i just realized something

#

my api has depending on Paper, and the plugin im making right now is using spigot-api

#

how is this running LMAO

eternal oxide
#

if you only use spigot methods you are fine

noble lantern
#

im using some of the adventure api though

cerulean valley
#

i want to switch to json logs at some point though, and color them through a command that reads them

noble lantern
#

maybe maven compiles that automatically

eternal oxide
#

that should be blowing up if you put it on a spigot server

noble lantern
#

lemme check

#

nope, i should change that though

cerulean valley
#

they do require a bit more than just a grep, but with how often i search through them for specific fields it'd be easier at least for me to have them in a more structured file format

#

"Bukkit got a hugely expanded world generation API in 2021" does anyone know what this person was referring to?

deft loom
#

Greetings, I'm making a table that displays litebans bans mysql table using php. But the problem is, litebans saves uuids in format 53909932-f794-33c0-9329-948045a4c1ce but not in the default minecraft uuid wich i can convert to nicknames. Is there any way to make litebans work with nicknames? Or is there any security reason why i can't do so? Thanks for helping me. (Note: I don't wanna use the default litebans banlist system)

noble lantern
#

it likely resolves to some kind of LiteBansPlayer which you contains the Player instance

#

just a guess though

#

but worth looking into LiteBans API but it may be tricky to transfer to php

cerulean valley
#

if the uuid format is the only problem, the conversion should be trivial

lunar schooner
#

so you'll need to convert it to a v4 UUID

cerulean valley
deft loom
lunar schooner
#

You can probably do it yourself, just need to do some Googling on how UUID v3 differs from v4

#

The UUID class might even do it already

cerulean valley
#

yes, but they are talking about what this plugin adds that bukkit doesn't already provide

#

and mention that bukkits API got expanded in that regard this year

lunar schooner
#
String yourUuid = "...";
UUID uuidV3 = UUID.nameUUIDFromBytes(yourUuid.getBytes());
String v4Uuid = uuidV3.toString();
``` You can try this, if itll work I have no clue.
deft loom
red sedge
#

does anyone know how to get the world guard region that the player is in

#

as a list ig

tacit drift
#

I used a worldguard api wrapper

red sedge
#

hm?

tacit drift
drowsy ledge
#

Hi everyone, I have a question, I have a survival server with spigot and is premium, I want to turn online mode off, but if I do that, I think I'll lose all players inventories, stats and advancements. How I can do it?

tacit drift
lunar schooner
#

I have some code on that that might help

eternal oxide
drowsy ledge
lunar schooner
#
        String offlinePlayerNewName = UUID.nameUUIDFromBytes(("OfflinePlayer:" + newPlayerName).getBytes(StandardCharsets.UTF_8)).toString();

Thisll generate an offline mode UUID for a player, you can then map the online-mode UUID to a nickname, and then map that nickname to the Offline UUID, then remap all data files to the new UUID

noble lantern
#

Didnt know you can get null as an ItemStack when iterating like this...

#

tf?..

lunar schooner
#

It's probably null when the slot is empty

#

I'm guessing^

noble lantern
#

Yeah but like why would it even like give me the null/none existant item stack xD

#

Oh i bet i need to call getContents instead

lunar schooner
#

That is up to you to decide 🙂

eternal oxide
lunar schooner
#

I cant write the entire plugin for you, you'll have to do that yourself

drowsy ledge
eternal oxide
#

Then what you are attempting to do is nigh impossible

lunar schooner
#

I disagree with that

#

itll take some effort, but certainly possible

#

I've written a plugin that remaps Offline -> Offline so that players on an offline mode server can change their nickname, certainly it is possible for online -> offline too.

drowsy ledge
#

I have not that many of players in my server, I can manually change the uuid from the /playerdata

eternal oxide
#

He needs to check each player online to get their current UUID, then calculate their offline UUID, find the relevant file in EACH world folder and copy the existing file to the new name, if it exists

lunar schooner
#

Itll certainly take some effort and knowledge 🙂

drowsy ledge
#

I can make the players join the game and copy their uuid

drowsy ledge
noble lantern
eternal oxide
#

The simplest way, loop all files in the playerdata folder of each world. Use the UUID in the file name, get the player name (while the server is still in online mode) then save it under the offline generated UUID

lunar schooner
noble lantern
bitter sentinel
#

is there a plugin that allows me to spawn items using a spawner and i can chnage the delay and the spawn amount?

eternal oxide
#

you would have to either null check or a line to remove nulls, null check is simpler

drowsy ledge
noble lantern
grave mason
#

Is there already a way for nms with 1.17 and 1.18 ?

bitter sentinel
noble lantern
#

theres lots

bitter sentinel
#

no actually

#

there is none

#

not for 1.17

noble lantern
#

This is a channel for talking about code so your better off talking the server section about this

smoky oak
#

does chunk load or chunk generate happen first?

noble lantern
#

well no

#

load happens after

#

but in some cases generate wont fire (Eg if chunks already generated)

#

in generation, it generates and then loads IIRC

smoky oak
#

thats fine i need a function to run on already generated chunks

noble lantern
#

Yep chunk load is the one you want

bitter sentinel
#

can some1 make me a plugin

quaint mantle
#

no sorry

#

?services

undone axleBOT
faint gale
#

bro, give me plugin shop support 1.17.1

quaint mantle
#

no bro

#

please keep an eye on what channel you are talking

faint gale
#

okay, sorry

lunar schooner
eternal oxide
# drowsy ledge Is just a survival world with only 3 worlds (overworld, nether, end)

Untested but this should get you started (if it doesn't work)```java
public void convertToOffline() {

    File worldFolder = Bukkit.getWorldContainer();

    for (World world: Bukkit.getWorlds()) {
        File data = new File(worldFolder, world.getName() + File.separatorChar + "playerdata");

        for(File file: data.listFiles()) {
            String baseUid = FilenameUtils.getBaseName(file.getName());
            String ext = FilenameUtils.getExtension(file.getName());

            Player player = Bukkit.getPlayer(UUID.fromString(baseUid));
            if (player.getName() != null) {

                try {
                    FileUtils.copyFile(file, new File(data, UUID.nameUUIDFromBytes(("OfflinePlayer:" + player.getName()).getBytes(StandardCharsets.UTF_8)).toString() + "." + ext));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}```
drowsy ledge
eternal oxide
#

It means if it doesn;t work, its very very close. so fix it if it doesn;t work

#

call that method once with the server set to online

drowsy ledge
eternal oxide
#

you will be able to see if it works. It will double up all your player files

vale ember
#

how can i terminate plugin in method body so, that i don't even need return statment?

drowsy ledge
eternal oxide
#

Thats Apache commons

#

is shaded into spogot

#

so either add it as a provided dependency to your pom or change to depend on spigot instead of spigot-api

drowsy ledge
#

...

viral temple
#
Attempting to build Minecraft with details: VersionInfo(minecraftVersion=1.8, accessTransforms=bukkit-1.8.at, classMappings=bukkit-1.8-cl.csrg, memberMappings=bukkit-1.8-members.csrg, packageMappings=package.srg, minecraftHash=null, classMapCommand=null, memberMapCommand=null, finalMapCommand=null, decompileCommand=null, serverUrl=null, mappingsUrl=null, spigotVersion=null, toolsVersion=0)
Error: Exception in thread "main" java.io.FileNotFoundException: work/minecraft_server.1.8.jar (No such file or directory)
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:228)
    at java.util.zip.ZipFile.<init>(ZipFile.java:157)
    at java.util.jar.JarFile.<init>(JarFile.java:171)
    at java.util.jar.JarFile.<init>(JarFile.java:135)
    at org.spigotmc.builder.Builder.main(Builder.java:411)
    at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)```
#

???

smoky oak
#

did you set 1.8 instead of 1.18 in your dependencies?

viral temple
#

i'm compiling every version from 1.8 to 1.18

#

but for some reason 1.8 and 1.8.3 fails

#

with that exception

drowsy ledge
viral temple
#

ending with Could not find artifact org.bukkit:craftbukkit:jar:1.8-R0.1-SNAPSHOT

#

if someone knows why, please let me know

eternal oxide
viral temple
eternal oxide
#

so?

quaint mantle
#

spigot doesnt have nms...?

#

wow

eternal oxide
#

Depend on spigot not spigot-api

quaint mantle
#

that is the first time i see people say that

viral temple
# eternal oxide Depend on spigot not spigot-api
            <groupId>org.bukkit</groupId>
            <artifactId>bukkit</artifactId>
            <version>1.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.bukkit</groupId>
            <artifactId>craftbukkit</artifactId>
            <version>1.8-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>```
eternal oxide
#

delete both

quaint mantle
#

uhhh

#

what is that

#

...?

eternal oxide
#

depend on spigot no spigot-api, not Bukkit, not CraftBukkit

quaint mantle
#

i mean if you dont want api from spigot, just use spigot-api

#

or if you want to use both nms and api then use spigot

#

it has nms + spigot-api

viral temple
#

i found only in 1.13+ they come together

eternal oxide
#

Bukkit and CraftBukkit have always been in spigot

orchid cove
#
public class Main extends JavaPlugin implements Listener {
    public void onEnable(){
        getServer().getConsoleSender().sendMessage("get distance>> was enable");
        getServer().getPluginManager().registerEvents(this, this);
    }
    public void onDisable() {
        getServer().getConsoleSender().sendMessage("get distance>> was disable");
        
    }

    @SuppressWarnings("deprecation")
    @EventHandler
    public void onInteract(PlayerInteractEvent event){
        Player p = event.getPlayer();
        Action action = event.getAction();
        Location pos1 = null;
        Location pos2 = null;

        
        if (p.getItemInHand().getType() == Material.STICK) {
            if(action.equals(Action.LEFT_CLICK_BLOCK)) {
                pos1 = p.getLocation();
                p.sendMessage(pos1.getBlockX() + " " + pos1.getBlockY() + " " + pos1.getBlockZ());

            }
            if(action.equals(Action.RIGHT_CLICK_BLOCK)) {
                pos2 = p.getLocation();
                p.sendMessage(pos2.getBlockX() + " " + pos2.getBlockY() + " " + pos2.getBlockZ() + "second pos");
                double a = pos1.distance(pos2);
                int b = (int) Math.round(a);
                p.sendRawMessage("" + b);
                
   
            }}
        }
orchid cove
#

it send an error

vale ember
#

what error?

eternal oxide
#

pos1 will be null when you right click to set pos2

#

move your Location variables outside the event to make them fields

smoky oak
#

wth is that code

eternal oxide
#

Good names 🙂

noble lantern
viral temple
noble lantern
#

i know the issue now that i look over it again

noble lantern
eternal oxide
noble lantern
#

the naming is kinda bad for this API, but no end user will ever see it so meh

#

it shall stay for now

viral temple
#

I'll try without arguments

eternal oxide
#

no one ever needs a CB jar these days.

noble lantern
#

^

#

im like 99% sure all of use use that intellij plugin

eternal oxide
#

You peasants do

noble lantern
#

im a peasent if it means i dont have to write my own pom files

viral temple
#

or whatever its called?

noble lantern
viral temple
eternal oxide
#

I use Eclipse. I like to know what I'm doing

viral temple
#

i don't use it

drowsy ledge
smoky oak
#

i use intellij i dont need to save

noble lantern
eternal oxide
#

I'd only recommend it to a very advanced dev who's got tired of writing the same files over and over

noble lantern
#

looks at my 30 repos on my github

Yeah.. same file 😅

viral temple
#

i use intellij because I like to be more in control with how I do things

noble lantern
#

i just like it so i can save time

smoky oak
#

tbh i use intellij because it's simpler to manage stuff

noble lantern
#

im able to whipe out things so fast with the tab completions and things like the minecraft plugin development thingy

#

I can write in Eclipse but its gonna take me longer and i dont see a reason to put a bottleneck on myself

#

I could even write in notepad++, any dev should be able to relatively do that if you learned java

viral temple
#

also, isn't IntelliJ written in C++ while Eclipse is written in Java ?

noble lantern
#

But... lets not do notepad++ plugins pls

noble lantern
#

But C++ is generally better

viral temple
smoky oak
#

but its java

#

so its better too

noble lantern
#

for like larger projects, as you can index files faster

heady pumice
#

IntelliJ is written in java

noble lantern
smoky oak
#

eh true

quaint mantle
#

bois

smoky oak
#

the virtual machine is an advantage too

#

USUALLY

quaint mantle
#

i used bash script

#

imagine not using bash script

viral temple
#

also kotlin

smoky oak
#

i just copy paste a preset folder to make a new plugin in intellij

#

does that even work in eclipse?

#

dont thnk so

quaint mantle
#

i even made a whole repo just for decompiling minecraft 1.16.5 and applying patches to it

viral temple
grim ice
quaint mantle
#

(i will not say that most of the codes in bash script i stole were from Paper and Tuinity)

grim ice
#

it's really simple it won't benefit you that much will it?

smoky oak
#

copy paste the file

eternal oxide
noble lantern
#

It reinforces knowledge

#

Doing the same thing over and over until you get it, like riding a bike

grim ice
#

if you don't know how to make a simple project with maven you probably should learn java

#

which is the mistake i did