#help-development

1 messages · Page 247 of 1

gleaming grove
#

Do you know whether I can check if Player object is still active in Bukkit?

wet breach
#

ideally you would be listening for quitevent

gleaming grove
#

ye that's an option

wet breach
#

lol

#

will have to wait till later when I am in a better position for math formulas and also to search back in the history

#

to refresh my memory in regards what it was I had given

#

oh right, exponential growth

tardy delta
#

i shouldnt have thrown my math book from prev year away

#

hmm if i put classes in the src/test/java package, those arent included when building the jar right?

#

also is a txt file supposed to be in the src/test/java folder?

urban swift
wet breach
tardy delta
#

im trying to use a file with test cases, where should i put that? in the test folder too?

sacred mountain
#

just copy the formula

#

into ur code

wet breach
#

it is the most ideal spot since it is for testing only

remote swallow
#

whats the formula meant to be

wet breach
#

they have a cost for upgrades that increases the more it is used

remote swallow
#

currentCost + baseCost x amount?

wet breach
#

but they need to know how much to subtract from the player or what is the most amount of upgrades the player can afford

remote swallow
#

ah

wet breach
# remote swallow ah

I gave the formula some time ago and I think they are having a hard time implementing it?

remote swallow
#

what formula did you give

#

yeah ive got no idea how you would impl that

#

math is confusing

#

just thought, if the price goes up by a set amount each time for the total cost of like 20 would be, might be wrong dont quote me on this

(baseCost^20) + (baseCost x upFactor)^20

#

the ^20 would be amount being bought

#

but then you have the issue of how many do they own

undone axleBOT
tardy delta
#

like this?

wet breach
#

well if you are only stuck on that part

#

then its easy

#

shouldn't need a loop?

#

from just skimming don't see why you couldn't

#

Anyways, if you already have it figured out how much it is going to cost for the amount

#

then you just need to get the players money amount they do have

#

and its just a simple minus equation and seeing if goes below 0 and how much below 0

#

how far it goes below 0, would tell you how much they could afford

#

easier way however is to incorporate into your function

haughty idol
#

PlayerInteractEvent is really broken in adventure mode, what should i do?

wet breach
#

the amount they have, and as you calculate seeing if it goes over

#

then its just a minus equation then right?

#

if you know how much they can afford

#

just take that amount away from them XD

#

ok, but in order to know they can afford 30 upgrades

#

you would have to have calculated the cost

#

not sure why you are tossing away the cost to not then use it to minus from their bank?

#

well base cost is the cost of an upgrade without any increases

#

not sure what cost factor would be other then the amount of upgrades

undone axleBOT
remote swallow
wet breach
gleaming grove
tardy delta
#

that looks like cursed js

fresh timber
#

in a BlockDamageAbortEvent, will it call the event if they leave server or if they finish breaking the block?

tender shard
fresh timber
#

xD okay

tender shard
#

all I know is that InventoryCloseEvent gets called when someone leaves the server while having the inv open

#

so I guess the BlockDamageAbortEvent gets called too

fresh timber
#

ah ok

eternal oxide
#

depends on how it's being broken

#

interact event or BlockForm/spread

tender shard
#

isnt it PlayerInteractEvent?

#

yes it is

#

listen to PlayerInteractEvent, then check if the action == Action.PHYSICAL

#

e.g. this is how I cancel this in RePlant

#

well no, you should also check whether the "clicked block" is farmland

#

that should work

hybrid spoke
#

is there an intellij minecraft font

tall dragon
#

you can probably import it

tender shard
#

@gilded knot if you want to replace existing commands, you have to get the command map via reflection from the SimplePluginManager

gilded knot
#

aight

tender shard
#

here's how I usually do it

gilded knot
#

As you can see, I've already done it for bungeecord

#

seems like spigot is a tiny bit different

#

but sweet

tender shard
#

the map will have two entries, one is e.g. "op" and the other one will be "minecraft:op" as key

gilded knot
#

aight

tender shard
#

or, in your case, ofc "stop" and "minecraft:stop"

#

but @gilded knot you can also listen to PlayerCommandPreProcessEvent

gilded knot
#

mhm

tender shard
#

then check if the message starts with "stop"

#

then just cancel it

#

that's probably easier

gilded knot
#

Alright

#

I'll let you know how it goes

tender shard
#

okidoki

serene sigil
#

is there any way to open a writable book interface?

#

i have nms

gilded knot
tardy delta
#

not sure if message contains the slash

gilded knot
#

I'll test it now

sonic goblet
#

I don’t think it does

tardy delta
#

is that default font?

gilded knot
#

also I use macOS

tardy delta
#

huh

hybrid spoke
gilded knot
#

its normal for me, I like it lol

tardy delta
#

man has a darker background

#

discord removed my darker build override and this man has a goddamn darker background lol

gilded knot
#

F

#

I mean

#

I don't use it but

#

You could look into betterdiscord

#

they have themes, you should be able to add a simple "darker" theme

serene sigil
gilded knot
#

Use it at your own risk tho

tardy delta
#

too lazy for that

naive bolt
#

yk in hypixel how they have book popups

#

how can i do that

remote swallow
#

player.openBook

gilded knot
#

It works but only for players
I need it to disable stop command for the console

remote swallow
#

hmmm i wonder why PlayerCommandPreProcessEvent only works for players

gilded knot
#
op Ryzanite
[22:12:29 INFO]: Made Ryzanite a server operator
[22:12:31 INFO]: Ryzanite issued server command: /stop
[22:12:31 INFO]: Stop command detected, cancelling event
[22:12:34 INFO]: <Ryzanite> woo
[22:12:35 INFO]: Ryzanite issued server command: /stop
[22:12:35 INFO]: Stop command detected, cancelling event
stop
[22:12:37 INFO]: Stopping the server
[22:12:37 INFO]: Stopping server
[22:12:37 INFO]: [SDisable] Disablin
gilded knot
remote swallow
#

give me one moment and ill give you an answer

gilded knot
#

aight

remote swallow
#

ServerCommandEvent

sharp kayak
#

In the EntityResurrectEvent, how do i check if a totem is being used by the player?

gilded knot
#

uh

#

In your event object

#

You should be able to get a bunch of functions

#

I'm not so sure

#

I'd imagine you could do event.getPlayer() and check if its not null

gilded knot
#

thanks

sharp kayak
crimson scarab
#

what is the best way to make my arrows get better homing
could i implement some basic path finding, how would i do that?

gilded knot
#

I'd imagine you'd use a different event

sharp kayak
gilded knot
#

Check the cancelled state of EntityResurrectEvent in the MONITOR priority.

#

So if the event is not cancelled in the MONITOR priority, the entity is being resurrected by a totem.

sharp kayak
#

hmm k ill try that

gilded knot
sharp kayak
gilded knot
gilded knot
sharp kayak
#

how do u do that?

#

wb checking for a totem?

crimson scarab
#

to go around obstacles and such

gilded knot
#

Then in that instance, I have no idea

#

soz

sharp kayak
#

tried most of the ways provided by the event but it just provides null on player death or use of totem\

remote swallow
#

looking at the jd, you have a getHand() method which tells you the hand of totem

#

im pretty sure this will only get called if a totem is triggered

#

v

sharp kayak
remote swallow
sharp kayak
#

yep

remote swallow
#

event would be called then

sharp kayak
#
Caused by: java.lang.NoSuchMethodError: 'org.bukkit.inventory.EquipmentSlot org.bukkit.event.entity.EntityResurrectEvent.getHand()'
#

returned null

chrome beacon
#

Looks like the method doesn't exist in your version

#

Time to update

sharp kayak
chrome beacon
#

Server

sharp kayak
#

hmm k

humble tulip
#

What version of spigot is your server?

sharp kayak
#

1.19

#

🙂

humble tulip
serene sigil
#

why doesnt this work?

sharp kayak
serene sigil
#

it gives me an exeption

humble tulip
#

What exception

serene sigil
humble tulip
#

Lmao

#

In your console

serene sigil
#

lol

#

oh shit

#

it says invalid page num

#

but its not invalid

humble tulip
#

-_-

chrome beacon
#

Check console

humble tulip
#

Pages start at 0 not 1

serene sigil
#

oh

#

lol

#

but docs said it starts from 1

humble tulip
#

Waiy lemme check

#

I'm not sure

serene sigil
#

nope

#

still eosnt work

humble tulip
#

Ik java indexes starts at 0 so it's common practice to start indexes at 0

serene sigil
#

ye ik

#

but irl they start at 1

#

its so confusing sometimes

modest current
#

How do I get the items meta to constatly update

#

Yeah, but lets say Im trying to constantly get the location of a player

#

with a compass

#

I tried while loops

remote swallow
#

?scheduler

tall dragon
#

?scheduling

undone axleBOT
tall dragon
#

:d

remote swallow
#

i normally get that one right

modest current
#

to constatly add the location, but it only gets the location of the player when I run the command

remote swallow
#

update compass location on player move event

#

if your tracking a player

modest current
#

I will try the player move event

#

It works

#

Thanks Guys

tall dragon
#

@modest current might be benefitial to check if the player has actually moved to another block for this

#

cuz that event gets called very, very often

#

even for mouse movement

modest current
#

thats a good advice

#

to reduce lag right

tall dragon
#

yes

sharp kayak
#

Whats the difference between saveConfig() and saveDefaultConfig()?

tall dragon
#

saveConfig(). saves the config, saveDefaultConfig() should take the default config from your jar and save it

remote swallow
#

^^

modest current
#

Does it create that much lag?

remote swallow
#

which

tall dragon
#

saveDefaultConfig is only rlly used on startup in most cases so

#

im guessing you mean saveConfig()?

tall dragon
#

so it gets worse and worse

#

so i would just keep to good practise and implement a simple check

sharp kayak
modest current
#

How would I actually check if he moved a full block

remote swallow
#

saveConfig() should be after any settings in the config

tall dragon
#

the event provides a from location and a "to" location

#

simply check if x or y or z is not equal

remote swallow
#

saveDefaultConfig() should just be on the default method

#

and use reloadConfig for reloading the config

sharp kayak
remote swallow
#

if you save it when you set anything, no

sharp kayak
#

ok

slow oyster
#

Anyone know if it's possible to make an itemframe ignore interaction events. I.e allow the player to break the block behind it ignoring the itemframe hitbox

tall dragon
#

that wont ignore the hitbox tho

#

probably just hit through it

slow oyster
#

Yeah I'm cancelling the event which just means it does nothing now.

#

Hmm maybe, but that would mean the block would break instantly

#

Since itemframes break after a single click

tall dragon
#

afraid what u want is not possible

#

but i dont know everything of course

slow oyster
#

Yeah I think it's probably not possible from the client side

#

I thought I'd use ItemFrames to display items in front of a chest since it looks much nicer than using ArmourStands

mystic mason
remote swallow
#

1.8 isnt supported

tall dragon
#

lol they just disapear without block update tho?

#

haha thats kinda weird

mystic mason
tall dragon
#

what the error according to intellij

#

😄

#

whats the code now haha

ivory sleet
#

double cast

#

(Class<IData<?>>)(Type)IData.class

gleaming grove
#

How can I include an dependecy inside artifact with Maven?

#

can you give me some shade example?

remote swallow
#
<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.4.1</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <relocations>
                <relocation>
                  <pattern>org.codehaus.plexus.util</pattern>
                  <shadedPattern>org.shaded.plexus.util</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
#

whats the sourcee

mighty pier
#

what does nothing x everything = to?

humble tulip
#

also some people offer premium support to buyers

humble tulip
#
public class TestClass<E> {
    
    public TestClass(String name){
        Class<E> eClass = E.getClass();
    }
    
}
#

why isnt something like this possible?

#

you might say because E doesnt have to be declared when creating an instance, then it should default to object

modest current
#

How do I make items drop right below the player (Im trying to simulate poop)?

humble tulip
#

depends on what you're doing

remote swallow
humble tulip
#

but you can create a data class that holds an entire row

#

when you get the data frm the database

#

oh well it depends on what youre storing in the db

modest current
humble tulip
#

it would also be easier yes

brave sparrow
modest current
#

public class CommandManager implements CommandExecutor{

@Override
public boolean onCommand(UUID sender, Command command, String label, String[] args) {
    Player player = (Player) sender;
    if (sender instanceof Player && args.length == 1){
        Player chest = Bukkit.getPlayer(args[1]);
        Location chest_location = chest.getLocation();
        chest.sleep(chest_location, false);

        player.teleport(chest_location);
        player.getWorld().dropItemNaturally(player.getLocation(), Material.COCOA_BEANS);
        return true;
    }
    return false;
}

}

jagged monolith
modest current
#

this is what I have

brave sparrow
wet breach
#

it really depends on the data you are needing really. In general most data in a db row isn't going to consume all that much data to be held in memory, but like lets say the row contains a BLOB, might not be wise to store that BLOB in memory as it could be quite large. So that would be an example of when it might not be best to cache it.

modest current
#

oh ok

#

For some reason my (Player) sender; part is red outlined

#

wdym?

remote swallow
#

thats not the right format for the command either

humble tulip
modest current
#

yeah it isnt

brave sparrow
modest current
#

if I replace Player with UUID then .teleport() and .getWorld() get red outlined

gleaming grove
#

How can I exclude directory from maven shade, this approach is not working

modest current
#

Yes I did that

remote swallow
#

?paste the method and ill fix it

undone axleBOT
wary topaz
jagged monolith
crude estuary
#

💀

remote swallow
#

main class called main, making files(yaml configs) on other methods call them on onEnable, class names not following naming conventions relating back to main

crude estuary
#

Coding in Moo Language is Included in that

jagged monolith
#

An ugly mess, that's what that is.

remote swallow
#

instead of checking if its what you want, check if it isnt and if it isnt return

jagged monolith
#

Check the tools class 😛

wet breach
#

optionally you could also do ===

#

if you want both .equals and == together 😉

remote swallow
#

so instead of doing

public boolean onCommand(command) { 
  if (args.legnth == 1 {
      my code
  }
}

DO 

public boolean onCommand(command) { 
  if (args.legnth != 1 {
      return false;
  }
  my code
}
crude estuary
#

Someone just made a Fork out of it

#

xD

remote swallow
#

WHAT THE FUCK

wet breach
#

=== checks the equality of the object and its contents at the same time

remote swallow
#

my eyes

wet breach
#

probably, but it won't work for some things though lol

remote swallow
#

they hurt

crude estuary
#

C++ Java

wet breach
#

not sure what type rank is

#

I wonder if you stuffed d into an object it might work, but yeah for string literals it doesn't really work

crude estuary
#

Wait, that's not a Major Update, is it?

remote swallow
#

the version number hurts my eyes

wet breach
#

whose code are we roasting right now?

remote swallow
#

3 is the best, 4 is a meh but 5 just smooths my brain

river oracle
#

Thays too easy kinda low

remote swallow
#

ye

wet breach
#

thought you guys were just randomly picking on someone for their code lmao

crude estuary
#

Dude, he Fixed Plugin not Working 3h Ago

#

at least he's Active

remote swallow
#

doesit have an update checker

wet breach
#

also glad this isn't like a random code roast on someone either

remote swallow
#

my fucking god

#

the version number isnt even in pom

#

<version>1.0-SNAPSHOT</version>

dusk flicker
#

what is that versioning standard

crude estuary
#

Well, it's not even Version 1

remote swallow
jagged monolith
#

The pom looks like a copy paste pom

crude estuary
#

it's 0.0.3

dusk flicker
#

0.0.3.4.6 wth

remote swallow
#

1.8.8 api PepeCryHands

dusk flicker
#

main package is 'BetterServer'

remote swallow
#

no wonder cartography tables, smithing tables and that dont work

#

anyone got a lighter with them, we could keep warm off of this

dusk flicker
#

oh god he uses that replace thing everywhere

wet breach
dusk flicker
#

This might be a nitpick on my part, but instead of stuff like if (player.hasPermission("betterserver.permissions.back")) { for permissions I generally try to describe it a bit more, like pluginname.commands.back etc, would still totally work but yk

wet breach
#

I wonder if it still has an ambiguous description

#

?jd-s TranslateAlternateColors

undone axleBOT
dusk flicker
#

sadly bot is stupid

worldly ice
#

public fields 😟

remote swallow
#

i would change the permissions to betterserver.command.commandname

remote swallow
jagged monolith
modest current
#

public class CommandManager implements CommandExecutor{

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    Player player = (Player) sender;
    if (sender.isOp()){
        if (sender instanceof Player && args.length == 1){
            Player chest = Bukkit.getPlayer(args[1]);
            Location chest_location = chest.getLocation();
            chest.sleep(chest_location, true);

            player.teleport(chest_location);
            player.getWorld().dropItemNaturally(chest.getLocation(), new ItemStack(Material.COCOA_BEANS));
            return true;
        } else if (sender instanceof Player && (args.length == 0 || args.length > 1)){
            sender.sendMessage("You must be a player to execute this command!");
            return false;
        }
    } else {
        sender.sendMessage("You must be an operator to execute this command!");
        return false;
    }
    return true;
}

}

#

for some reason

dusk flicker
#

dear god

#

?paste

undone axleBOT
modest current
#

it says it had some internal erros

dusk flicker
#

please

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
modest current
#

sorry

jagged monolith
#

Either paste it, or atleast use codeblocks

modest current
dusk flicker
#

also a note on the above 'review', permission capitalization is not the same compared to commands and the events

wet breach
#

lay them down?

desert loom
modest current
crude estuary
#

-_-

dusk flicker
#

look

#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
dusk flicker
#

was sent right above

#

also am I insane or is Discord's font changed

remote swallow
#

it has changed

#

its sans gg now

dusk flicker
#

okay i'm not insane ty

#

yea

modest current
#

Alright

#

sorry, I learned how to do codeblocks

#

for some reason my keyboard doesnt have that symbol

dusk flicker
#

should be under the escape key

modest current
#

Ohh thanks!

#

HAhahahaha!

#
public class CommandManager implements CommandExecutor{

    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        Player player = (Player) sender;
        if (sender.isOp()){
            if (sender instanceof Player && args.length == 1){
                Player chest = Bukkit.getPlayer(args[0]);
                Location chest_location = chest.getLocation();
                chest.sleep(chest_location, true);
    
                player.teleport(chest_location);
                player.getWorld().dropItemNaturally(chest.getLocation(), new ItemStack(Material.COCOA_BEANS));
                return true;
            } else if (sender instanceof Player && (args.length == 0 || args.length > 1)){
                sender.sendMessage("You must be a player to execute this command!");
                return false;
            }
        } else {
            sender.sendMessage("You must be an operator to execute this command!");
            return false;
        }
        return true;
    }

    
}``` For some reason now the player wont be forced to lay down. Does anybody know why?
#

ops sorry

dusk flicker
#

you can edit the above message, don't need to resend it for the update to apply

#

The current version works fine, just adding java after the 3 ` formats it with the Java syntax

remote swallow
#

after the ` not on the line below

#

would look like

modest current
jagged monolith
#

Got to start somewhere

modest current
#
else if (!(args.length == 1)){
                sender.sendMessage("You must be a player to execute this command!");
                return false;
            }
#

like this?

wary topaz
#

...

#

?learnjava

undone axleBOT
modest current
#

Alright

wary topaz
#

way to hard to read

jagged monolith
#

!= 1 is cleaner and easier to read.

modest current
#

Understood

#

I still need help trying to make the player lay on the ground. Im trying to make it force sleep, but it ends up doing absolutely nothing.

wary topaz
#

lol

#

is there a way to add a countdown to a command (messages) without freezing the plugin ?

remote swallow
#

?scheduling

undone axleBOT
modest current
#

I dont know how a scheduler would help me.

humble tulip
#

A scheduler runs things in the future

modest current
#

oh ok

#

sorry

humble tulip
#

you can scedule a task to run every second to countdown

wary topaz
#

added a scheduler thanks

humble tulip
#

who?

#

i wanna see

wary topaz
#

na I get it lol, the reason it was broken is I didnt check if the homes.yml file existed until someone pointed it out

jagged monolith
#

I haven't worked on my plugins in ages haha.

summer scroll
#

Hey, so I'm trying to create a land claiming system, where when player place a block it will automatically claim a 10x10 square area, what would be the best way to approach this?

#

Maybe I can create a bounding box but I'm struggling to get both corner of the area.

jagged monolith
#

A 10x10 area using the placed block as a center or will the place block be a corner?

sharp flare
#

anybody here know the reason why bstats is down, maybe offtopic

summer scroll
#

The place block is the center.

summer scroll
humble tulip
#

just subtract 5 from the x and z

#

and add 4 to the x and z

#

and you have your 2 corners

#

@summer scroll

summer scroll
#

Alright, imma try that.

humble tulip
humble tulip
#

the guis

#

ah ok

#

ty

summer scroll
#

Yeah it's from resource pack too.

humble tulip
#

resource pack and texture pack is the same right?

summer scroll
#

It's the same

wary topaz
remote swallow
#

thats not how a scheduler works

wary topaz
#

wdym

summer scroll
remote swallow
#

it wont care if the scheduler is complete before moving on, it just runs the method and done

river oracle
#

Atleast basics

wary topaz
#

..

remote swallow
#

you wan those 3 statements in different schedulers

#

changing the delay each time

wary topaz
#

oh okay

wary topaz
river oracle
#

Mad cap

#

If u got 3 years experience this isn't your area

wary topaz
#

i startde spigot mc like a year ago

#

started

river oracle
#

Then you should beable to apply basic scheduling basic on simple documentation

#

You should also beable to do your learning from mostly online quick overviews

wary topaz
#

so i'm not allowed to ask questions?

#

i just want the quick route

river oracle
#

You can but your code logic exposes your inexperience

#

I simply reccomend you learned how java works and how to code

wary topaz
#

so youre saying i should relearn java?

river oracle
#

You should learn how threading and task scheduling works if you already have 3 years of experience should only take a few minutes for the basic idea

wary topaz
#

..

river oracle
#

You should be used to the basic patterning of programming concepts tbh 3 years os quite a while. You have much more experience than me

wary topaz
#

okay fine you're right ill consider reading the documentation more often

river oracle
#

You should jsut read docs it's easier from a dev perspective I almost always read docs when it comes to learning basic concepts now

humble tulip
#

remember, the block itself is 1

#

if you add 5 on both sides, you get 11x11

#

for even numbers, you do num/2 and (num/2)-1

#

for odd numbers do (num-1)/2

#

and thats both ur values

#

@summer scroll

summer scroll
#

Alright, thanks a lot.

iron glade
#

is there a way to prevent a player from jumping?

#

if possible without potion effects

humble tulip
#

of an entity

haughty idol
#

Why doesn't PlayerInteractEvent work when i left click blocks in adventure mode?

humble tulip
#

?paste your code

undone axleBOT
haughty idol
remote swallow
#

dont think it registers for players in adventure mode

blazing basin
#

yo.. so some of my plugins are messing up with bedrock plugins any way to get that fixed?

#

also ill pay if anyone helps me im a bot at this server stuff XD

haughty idol
sand pine
#

hi

#

i want to petrify a spectator, in 1.19

#

but there is no event like PlayerStopSpectate to use .setCancelled

quaint mantle
#

What does petrify mean

sand pine
#

disable move x, y, z, pitch, yaw

#

it occurred to me that if the spectator is spectating something inmovile like a boat, i can do this

#

but the problem is that the spectator can stop spectate the boat

quaint mantle
#

are hex codes allowed in the ProxyPingEvent version setName?

wary topaz
remote swallow
#

its down

jagged monolith
#

Yeah, it's down.

quaint mantle
buoyant viper
#

is there a way to make chat preview validation.... quicker?

#

not an XY problem really, just wondering since it seems to be relatively slow and ends up still having messages be marked as not secure

#

"not an XY problem" i say as i state my problem

distant ridge
#

anyone know why intellij can't find some of the bukkit imports?

#

it worked until i uninstalled / reinstalled intellij

kindred valley
#

Yeah

#

I have the same problem on Listener

jagged monolith
summer scroll
#

Also try to invalidate caches.

dawn dawn
#

how can i detect when player click button in demo screen?

solemn meteor
#

How do I detect if a mob spawns when a chunk is loaded? I did this but those that spawns when a chunk is loaded isn't being detected, any fix?

public void onEntitySpawn(CreatureSpawnEvent event)
smoky oak
serene sigil
solemn meteor
#

Sorry I'm new to this

smoky oak
#

why cant you just despawn them

solemn meteor
#

Ykw I'll just despawn them, makes my life simpler

#

Thanks btw!

smoky oak
#

the simplest, stupidest solution is usually the easiest

neat harbor
#

Hi, so I want to change my config.yml a bit this is what it looks like right now (logFreezes: true logReFreezes: true GUIItem: ==: org.bukkit.inventory.ItemStack type: PAPER GUIItemName: You have been frozen by staff, please look at your discord! ), Currently GUIItem is just an item stack, but I want to change it so that it is just a list thingy like what it looks like now (So it is more readable), but I also want it so that it loops through the different items in the list for different items to show in my GUI, how would I do this? (If this makes no sense I will try explain it more)

#

Ideally I would like it to look like this ```logFreezes: true
logReFreezes: true
GUIItems:
item1:
type: PAPER
amount: 1
name: You have been frozen by staff, please look at your discord
(More items here)
item2:
type: FISHING_ROD
amount: 2
name: You have been frozen for {reason}

tardy delta
#

cant you override the serialize method?

neat harbor
#

I want to make a list I don't want to serialise an ItemStack into it anymore

tardy delta
#

just write the serialisation stuff yourself?

neat harbor
#

But how do I write that kind of list thing

#

That is what I don't know lmao

tardy delta
#
config.set("gui-items.item1.type", "PAPER")```
#

etc

neat harbor
#

Thank you

serene sigil
#

why doesnt this work?

quaint mantle
#

hey, what happens when i uncancel an previously canceled event in the same code block? will the event do, what it normally does so it just continues or is the event canceled once it got canceled?

tardy delta
#

its uncancelled

#

so the normal things will happen

quaint mantle
#

so when i cancel the ExplosionPrime event and then i wait for an confirmation of the player in chat, will the event then just continue and the explosian still happens?

dusk flicker
#

?tas

undone axleBOT
serene sigil
keen basin
#

Does anyone know how I can hide the player name tag ?

serene sigil
keen basin
dusk flicker
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

serene sigil
#

?

keen basin
#

There are no errors. I think the error is from the API

tender shard
#

just add all players to the same team, then set the option NAME_TAG_VISIBILITY to ALWAYS or however it's called

unreal willow
#

Pls update spigot for minecraft 1.19.3

vivid skiff
#

How can i create a scheduler based on Real time like executing a command tells how much time is left, and it doesn' t stop on the plugin reload

dusk flicker
unreal willow
#

Why :v

dusk flicker
#

it's not released

hazy parrot
unreal willow
#

Why

dusk flicker
#

ask mojang, we dont control when they release 1.19.3

hazy parrot
tender shard
#

just upgrade to 1.8.8

serene sigil
#

Caused by: java.lang.IllegalArgumentException: Invalid page number 1/0
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMetaBook.setPage(CraftMetaBook.java:424) ~[paper-1.19.jar:git-Paper-81]
at com.zushee.zmp.commands.Profile.onCommand(Profile.java:62) ~[ZMP.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
... 17 more

unreal willow
serene sigil
#

it just doesnt make sense

unreal willow
#

Not 1.19.2

#

Update 1.19.3

iron palm
hazy parrot
#

It wouldn't even compile if it accepts only integer

iron palm
hazy parrot
#

pages - A list of strings, each being a page

iron palm
#

well in that case there's nothing to discuss

#

im sorry

hazy parrot
serene sigil
#

Caused by: java.lang.IllegalArgumentException: Invalid page number 1/0
at org.bukkit.craftbukkit.v1_19_R1.inventory.CraftMetaBook.setPage(CraftMetaBook.java:424) ~[paper-1.19.jar:git-Paper-81]
at com.zushee.zmp.commands.Profile.onCommand(Profile.java:62) ~[ZMP.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
... 17 more

serene sigil
tender shard
# unreal willow

lmao do you actually download your server software from this shitty illegal website?

#

why don't you just compile a trusted version yourself lol

#

that's like buying your groceries from some weird drug addict at the train station

wet breach
#

because kids love downloading viruses

tender shard
#

yeah I see lol

wet breach
#

apparently buildtools is just too difficult for them

tender shard
#

nowhere

#

you cannot legally download it

#

you have to read this and build it yourself

#

?bt

undone axleBOT
iron palm
#

?paste

undone axleBOT
iron palm
#

ah nvm i think i found the problem

tender shard
#

what the hell

#

how the fuck can my plugin contain EVERYTHING except for the plugin.yml file lmao

onyx fjord
#

are java streams fast?

#

(faster than loops?)

tender shard
#

depends

onyx fjord
#

on what

tender shard
#

a normal loop is ofc a bit faster

#

however if you want to filter things etc, then streams already optimize do lazy evaluation and stuff or however it's called

onyx fjord
#

what i wanna do is iterate thru a list until certain element is found

tardy delta
tender shard
#

so if this is a general question, the answer is "it depends on whether you just wanna loop over everything, or if you want to do sorting / filtering / transforming / whatever too"

onyx fjord
#

nope i just wanna find one item and stop

tardy delta
#

loops compile to an iterator

tender shard
onyx fjord
#

nothing

#

i just wanna get one match

tender shard
#

Stream#anyMatch

onyx fjord
#

yup thats what im using

tender shard
#

but why don't you just check whether List#contains(yourElement)

onyx fjord
#

i need it to startwith

tender shard
#

ah ok

#

then anyMatch is your best option

onyx fjord
#

👍

#

i mean at worst scenario this list will be maybe 500 elements?

tender shard
#

(a loop would still be a bit faster though)

tender shard
onyx fjord
#

how do i benchmark it

tender shard
#

there are libraries for that, or you simply get the current time before running your loop, then get the current time again after doing it, then print out the difference

#

when I worry about performance, I usually do a for(int i = 0; i <= 1000) (I do the same thing 1000 times) and if it still doesn't cause lag, then you are totally fine lol

onyx fjord
#

i want fancy stuff hehe

tender shard
#

streams are fancy

onyx fjord
#

fancy benchmark i mean

#

more verbose than just time passed

tender shard
#

then check out JMH

#

that's what I usually use

tardy delta
#

still wondering how to use it for my parser

tender shard
#

what, jmh?

tardy delta
#

ye, wrote a benchmark but dont what im doing

tender shard
#

usually you simply write a test method, and annotate that with @Benchmark

tardy delta
#

dont ask me wth im doing

tender shard
#

looks good I guess

#

however no

#

random.nextInt takes quite long

#

you should generate the random numbers in a @Setup method

#

and store them in some array

#

otherwise you also measure how long nextInt takes each time

tardy delta
#

hmm

#

i wrote a file full of expressions yesterday, ig i can use that in the setup

tender shard
#

I'd just create a new int[100] in setup()

#

and then in your for loop, just do firstOperand = myArray[i] etc

smoky oak
#

is it possible to check blocks without loading the chunk in?

wet breach
#

a region file holds 1024 chunks, so if you mess it up thats 1k chunks corrupted/gone lol

#

hence why it is generally recommended not to do it

ornate mantle
#

wheres the spigot server implementation

tardy delta
#

craftbukkit

#

?stash

undone axleBOT
ornate mantle
#

ty

onyx fjord
#

0.0442 milisecs too slow

#

with 2000 entries 2 milisecs

tardy delta
#

did a benchmark?

tender shard
#

show your code pls

#

it should be much much faster

tardy delta
#

even my parser is faster

tender shard
#

I love PluginUtils.whenInstalled

olive lance
dusk flicker
#

oh hell no

tardy delta
#

a tower of cables

maiden flax
tender shard
#

is there any easier way of storing a package name inside the source code than to use a char[]? :/

#

if it's a normal string, then maven-shade will relocate it so it becomes useless. maybe there's some annotation to tell maven to stop this?

maiden flax
#

1.19.2

#

1.18 for java

maiden flax
#

Thanks

ionic dagger
#

if PlayerDeathEvent() would allow me to setDeathMessage(), but not let me check for specific entities as would PlayerDamageByEntityEvent, which doesn't let me setDeathMessage(), how would I go at setting a death message based off of specific entities?

since i'm not trying to check if its just been damaged, im trying to check if its killed the player

tender shard
#

I don't think so

#

this one

#

but note, it also gets called for dragon eggs

#

so you gotta check if the "from" block is water before you do anything

#

okay but it also gets called for lava

#

and raspberry juice, in case this will ever get added lol

#

I just made that up because I'm bored lol

serene sigil
tender shard
#

you have to start with 0

#

the first page is 0

#

you cannot add page 1 if you don't have page 0 first

serene sigil
tender shard
#

hmmm

#

are you creating a new book from scratch?

#

If so, try to use setPages("my first page", "my second page", "etc")

serene sigil
#

alr this is my whole code:

#

its a command

ionic dagger
#

pretty colors

tender shard
#

hm yeah that should work. just try to use setPages(String...)

wet breach
#

String... is an array

#

if you weren't aware

dusk flicker
#

also, if you haven't tried restarting and make sure its not reload fucking something up id do that

serene sigil
#

alr

#

btw this is the exception

tender shard
serene sigil
#

?paste

undone axleBOT
tender shard
#

you can also just toss in just one string

serene sigil
tender shard
serene sigil
#

no, the profile should only be one page

tender shard
#

please, as I said, try to use setPages

serene sigil
#

alr

tender shard
#

myBookMeta.setPages("my only first page")

serene sigil
tender shard
#

yeah, try that pls

#

and maybe show the contents of the profile string

serene sigil
#

bruh that works

tender shard
#

oh ok goood

serene sigil
#

goofy ahh spigot

tender shard
#

I think setPage only works to replace alrd existing pages

#

otherwise you could have used addPage

wet breach
serene sigil
ornate mantle
#

any way to detect when player closes sign?

tender shard
tender shard
serene sigil
#

alr yall tysm for helping FINALLY!

subtle folio
#

What event do I cancel to stop concrete powder turning into concrete?

subtle folio
tender shard
#

yep @subtle folio

subtle folio
#

bett

#

thanks

tender shard
#

np

ionic dagger
#

?

subtle folio
ionic dagger
#

either way i still wouldnt be able to .setDeathMessage

subtle folio
#

Why can't you use both events?

#

and you could just make your own death message..?

ionic dagger
#

oh shit

#

wait

#

like pass in both events as parameters?

subtle folio
#

no..

ionic dagger
#

idk wym then!

subtle folio
#
@EventHandler
    public void playerDamage(EntityDamageByEntityEvent e) {
        //send custom death message
    }
    
    @EventHandler
    public void onDeath(PlayerDeathEvent e) {
        
    }```
#

what's stopping you from doing either of these?

ionic dagger
#

i have both i just dont know how to use them together to send a death message

subtle folio
#

if all you're gonna do is send a death message, make a custom one in PlayerDamange

#

Bukkit.broadcastMessage();

ionic dagger
#

would it show the same way as a death message would?

#

if it was j a normal one

#

and what about the message that would send on top of the message id add? how would i cancel that one

#

.setDeathMessage(null)

#

in the onDeath

#

like that

#

oh cool

#

thank you guys!

tender shard
#

I love how copilot sometimes suggests invalid code lol

round finch
#

AFillyawoah that's cool

#

Null = no message

tender shard
#

but it cannot reach the last return statement

#

does anyone already know whether 1.19.3 has big NMS changes?

tardy delta
#

return switch

errant rampart
#

I am having an issue where whenever I add the 1.19 or 1.18 spigot api as a dependency, my project fails to build saying it cannot access my main package

#

anyone got any ideas why?

chrome beacon
#

Send the full error

#

?paste

undone axleBOT
chrome beacon
#

Also how did you add the dependency

small current
#

how can i check if a player can see a chunk

errant rampart
chrome beacon
#

Are you using Intellij

errant rampart
#

yes

errant rampart
halcyon rock
#

Any buddy Know how to create plugin

chrome beacon
halcyon rock
#

Yes

#

@chrome beacon

#

@errant rampart

#

@errant rampart

errant rampart
#

don't think this is the place to ask for a tutorial mate

halcyon rock
#

Plesss create plugin Naruto

errant rampart
#

'-'

chrome beacon
#

I'm guessing you don't know Java

tardy delta
#

🤨

chrome beacon
#

Just judging by your behaviour

small current
#

Lets create plugin naruto

halcyon rock
halcyon rock
small current
#

this seems odd

#

asking developers to create a random plugin

#

is naruto that fortnite thing

#

?

halcyon rock
#

No

chrome beacon
small current
#

what is going on

#

now he is reaction spamming my message

#

🤨

onyx fjord
#

@tender shard optimized a lot and now its 0.2milisecs per 10k entries

halcyon rock
small current
#

go download this

halcyon rock
#

Ok

#

@small current

small current
#

oooh its a request

#

lol

halcyon rock
#

Thanks

onyx fjord
small current
#

yeah the link won't help you

#

no one codes a naruto plugin

#

go download mods

halcyon rock
tardy delta
small current
#

how can i check if a player can see a chunk

onyx fjord
#

i would be only worried about maybe 2 milis per 10k entries?

#

but no server will ever have 10k random teleporters lmao

tardy delta
#

lol

errant rampart
#

getting this on a completely clean project, for some reason I cannot build with 1.18 or 1.19 spigot api versions, but 1.17 works fine?

tardy delta
#

is that an external library?

#

ig not

errant rampart
#

no, its the only package in my project

tardy delta
#

isnt it saying to look into Manhunt.java?

errant rampart
#

its saying the error is the first line, which is

package dev.sirarchibald.manhunt;
#

but I don't see how the spigot version is affecting it

#

the error only appears when I am using 1.18+

halcyon rock
#

666

onyx fjord
#

what

tender shard
#

also wtf is "plugin naruto" lol

tender shard
#

on the right side, click the uppermost entry, then ?paste the full log

midnight shore
#

Hi, anyone has a good packet tutorial?

onyx fjord
#

for what? nms, plib, packetevents?

midnight shore
#

nms

dusk flicker
#

ha

#

good luck

onyx fjord
midnight shore
#

thank you

onyx fjord
#

but its for 1.12?

#

i think

#

i would strongly advise against nms

midnight shore
#

doesn't really matter as i just wanna understand the bases

midnight shore
tardy delta
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

midnight shore
tardy delta
#

someone should try jordan osterbergs scoreboard framework for me

midnight shore
#

yes thats good too

river oracle
#

FastBoard doesn't deel with teams if thats what your talking about

#

its only packet scoreboards reccomended you just store them with a Map<UUID, FastBoard>

#

thats just dumb FastBoard is super nice

#

your loss

#

if you want to make your own just make a packet Scoreboard like fastboard

#

which would require NMS so pick your poison

#

I usually resort to APIs as that part of the API is nasty 🤷🏽‍♂️ not sure a great one for tab, but for your scoreboard FastBoard is super light and nice to use

dusk flicker
#

then use TAB, it does everything

#

lol

onyx fjord
#

even async wont save 10kx10k particle box 😦

dusk flicker
#

I saw your message

#

iirc it got removed

#

i forget why

slim kernel
#

what is the best way to save dates to json files? How can I convert them from string to date then add 7days and convert it to a string again for example

rough drift
#

can you compare BanEntry with ==

hazy parrot
rough drift
slim kernel
wet breach
#

there is 86,400,000ms in a day

#

times that by 7, add it to your ms that you saved

tardy delta
#

store the ms and construct it back using new Date(ms)

wet breach
#

you could do the above as well

#

convert it back to a date and then add 7 days

tardy delta
#

you can get the ms from a date using ::asEpochMillis iirc

slim kernel
worldly ingot
#

I'd recommend using the java.time API instead of Date

tardy delta
#

^^

worldly ingot
#

LocalDateTime is probably what you want, which actually boils down to epoch seconds, not millis. Though that should be fine for your use case

LocalDateTime now = LocalDateTime.now();
long seconds = now.toEpochSeconds(); // You can serialize this into JSON

LocalDateTime then = LocalDateTime.ofEpochSecond(seconds, 0, ZoneOffset.systemDefault());
LocalDateTime thenPlusSevenDays = then.plusDays(7); // Add 7 days```
#

(I'm using ZoneOffset#systemDefault(), but if you plan on storing data across systems, you should really specify ZoneOffset.ofHours(0) to get GMT)

worldly ingot
#

There is technically String serialization which is a little bit smarter and does include the time zone, and again, if you're serializing across a network, probably ideal to use that instead

tardy delta
#

would Instant work for that too?

worldly ingot
#

It could but Instant is generally better used for times less than a day

slim kernel
worldly ingot
#

Oh you probably need a time zone

worldly ingot
#

I think ZoneOffset.ofHours(0) is probably better just in all situations in case the system time changes

tender shard
#

I never understand whether 0 am is midnight or midday

worldly ingot
#

Doesn't matter. It's the offset relative to GMT

#

e.g. EST is usually GMT-5, so ofHours(-5) would be EST

tender shard
#

oh I was talking about real life

worldly ingot
#

Or I guess UTC. GMT doesn't exist anymore lol

tender shard
#

e.g. sometimes you see in american TV that something gets aired at "12 am"

#

is that midnight or midday?

worldly ingot
#

Oh, yeah, I usually have to sit for a think about that too lol

tender shard
#

haha

#

I think different countries even do it differently

#

very annoying

worldly ingot
#

24 hour time fixes it because it's either 0:00 or 12:00, but am/pm fucks with your brain a bit

tender shard
#

exactlyyy

#

I mean we also say "5 o clock" although it's actually 17:00 but usually someone knows what you mean

#

e.g. noone would meet in a restaurant at 05:00 (am)

olive lance
#

do your wall clocks have 24 hours ?

worldly ingot
#

Guaranteed those exist, but I think all wall clocks have 12 hour time on it with 24 hour time below them

#

Like this

gray merlin
#

Right, are there any issues with storing ungodly amounts of data in PDC? Just realised that the method I'm doing things as is won't work, so i'm exploring new solutions, and i'd like to know the downsides of storing base64 encoded strings into a string pdc.

tender shard
#

watches also only have 12 hours here

worldly ingot
gray merlin
#

Nope, I'll be storing it inside an entity, and the string can get big, but won't necessarily

tender shard
#

a few megabytes?

#

a few gigabytes?

tender shard
#

and also, WHOSE pdc?

#

on a player, it should be fine for whatever amount you store. on a chunk, not so much

gray merlin
#

Theorically infinitely sized... realistically it won't ever surpass even 1.5mb

worldly ingot
#

It would take a lot of data to reach that point because vanilla stores all discovered recipes on the player's NBT and it's fine if all recipes are discovered

gray merlin
#

An entity's PDC, specifically a boat's

tender shard
#

I have checked it once, using 1gb of data

gray merlin
tender shard
#

it was slow on shutdown, but otherwise it worked totally fine

#

1.5mb is nothing, don't worry about it

gray merlin
#

Oh my sweet christ, I see, I massively underestimated the capabilities of PDC

#

Thanks!

tender shard
#

np

#

pdc is life

#

pdc is love

#

if lynxplay'd be gay, I'd make out with him for inventing it

midnight shore
#

Hi, how can i create an entity and then only show it to certain players? I know how to do the packet part but i don't know how to make the entity part, can someone help me?

round finch
#

How old is pdc?

eternal night
#

1.14

#

1.13 had CustomItemTagContainers on items

#

pretty much same concept, just different name

round finch
#

Not that old woah

#

I see early beta didn't have that option

tender shard
#

for entities and itemstacks

#

1.16.3 for chunks

#

and 1.18.1 (not exactly sure) for worlds

tall dragon
#

i need some advice ragarding data saving.

im making a "minigame" and for that im planning on having userdata saved on mongodb. but this minigame has multiple game servers. and if the player switches from server i need to make sure his "old" server saves the data before the new server attempts to load it. my first idea is to just have a boolean saved in mongodb acting as "lock" is this a good idea. or is there a much better approach to this

wet breach
#

intercept the change server, make it wait an arbitrary time, then make them switch

tall dragon
#

thats possible?

wet breach
#

from bungee yes

#

but you don't need the bungee server to know anything, just that it should make them wait however long before switching the server

#

which should give your db enough time to save

#

you could do it from the mc server side, since switching servers is done with a command

tall dragon
#

true

wet breach
#

hopefully that makes it easier then what you were planning 😛

tall dragon
#

well tbh i think i might still need to implement a lock

#

unless i have a callback to know when its done saving

#

and then make the change

tall dragon
#

and how would i use redis for this

wet breach
#

basically redis just holds the data in memory

#

if nothing accesses for a period of time, redis can commit it back to the DB

humble tulip
#

Let redis have up to date data while the player is online

tall dragon
#

do the servers modify data directly on redis?

wet breach
#

you can if you want to

humble tulip
#

So you have data in mongo

#

Player joins, you check redis for data

tall dragon
#

right

humble tulip
#

If it doesn't have it, get from mongo

#

And cache on redis

#

Keep redis data up to date

tall dragon
#

but like whenever something about the player is changed i would directly commit that to redis?

humble tulip
#

Make sure redis data is time stamped

wet breach
#

another alternative is just to let your servers talk to each other

humble tulip
wet breach
#

I wasn't referring to bungee

tall dragon
#

how would you implement that alternative

wet breach
#

not sure why everyone likes using pluginmessage channel, personally I dislike it. You can just make your plugins talk to each other...

humble tulip
#

You can create a bungee plugin that talks to the servers and relays info

#

Or even sockets

tall dragon
#

cant i just use redis pub/sub?

wet breach
#

certainly

humble tulip
wet breach
#

just was giving alternatives if you didn't want redis

#

not everyone is a fan of setting up another piece of software lol

tall dragon
#

well i alrdy have a good system for redis pub/sub so

humble tulip
#

Is this for anni?

tall dragon
#

but i dont rlly know how i would properly make the communications

#

yea it is