#help-development

1 messages · Page 1859 of 1

young knoll
#

Also TnT triggers the EntityExplodeEvent

#

Not block explode

rough basin
#

The code in OnEnable() doesn't work the first time the server runs, but it works when I do /reload.

spiral light
#

do you use Bukkit.broadcast ?

blazing scarab
#

do not use reload confirm

eternal oxide
blazing scarab
#

null pointer exception

rough basin
#

aha

frosty tinsel
#

You might listen to interact event, check if player is holding an empty bucket and if he clicked water.

#

But there may be a better solution

rough basin
spiral light
#

or BucketFillItemEvent and get the item in the hand of the player

eternal oxide
#

it will be somewhere in the startup

rough basin
#

i think it's not

#

I restarted the server and checked, but nothing appears to be an error.

young knoll
#

Doesn’t an exception in onEnable disable the plugin anyway

#

Actually nvm, reload will try to enable it again anyway

lucid bane
#

PlayerBucketFillEvent doesnt give me an previous empty bucket's ItemStack data,
PlayerInteractEvent says RIGHT_CLICK_AIR when i click an water
@frosty tinsel

rough basin
#

Should I put a message in OnEnable()?

rough basin
#

If that line doesn't work, my plugin is meaningless.

lucid bane
#

yes

#

PlayerBucketEvent cancellable

frosty tinsel
# lucid bane yes

Then the envent is probably called beforehand, so if you check players current item in hand it should be the previous bucket

spiral light
#

yes

lucid bane
#

cancel -> check -> undo cancel?

frosty tinsel
#

just check

lucid bane
#

i cant understand that event called beforehand

frosty tinsel
#

The code inside your on.. method is called right before the thing actually happens

#

so if you check the player current item in hand, it should still be the empty bucket

lucid bane
#

oh

frosty tinsel
#

and once the method is done, the buvket is filled

lucid bane
#

ok i try

#

thsx

frosty tinsel
pseudo geyser
#

I tried this but its not working

public void onEntityExplode(EntityExplodeEvent event) {

    java.util.List<Block> blocksToUndo = new ArrayList<>();

    for (Block block : event.blockList()) {

        if (block.getType() == Material.CHEST) {
            blocksToUndo.add(block);
        }
    }
    event.blockList().removeAll(blocksToUndo);
}
lucid bane
#
 Unable to find handler list for event org.bukkit.event.player.PlayerEvent. Static getHandlerList method required!

suddenly? i didint have this error until use other LIsteners

pastel drift
young knoll
#

You can’t listen to PlayerEvent

#

It’s an abstract event

pseudo geyser
young knoll
#

The list is mutable

#

You should use an iterator

#

Rather than that second list

pastel drift
#

Oh it's mutable, my bad.

frosty tinsel
lucid bane
lucid bane
frosty tinsel
#

show your class

frosty tinsel
#

you cant listen to player event

lucid bane
#
public class BucketFillListener implements Listener {
    private Main plugin;
    
    public BucketFillListener(Main plugin) {
        this.plugin = plugin;
        plugin.getServer().getPluginManager().registerEvents(this, plugin);
    }
    
    @EventHandler
    public boolean onFill(PlayerBucketEvent e) {
        Bukkit.broadcastMessage("1"); //DEBUGING
        if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.BUCKET) {
            Bukkit.broadcastMessage("1"); //DEBUGING
        }    
        return false;
    }
}
young knoll
#

PlayerBucketEvent is also abstract

#

Listen to the fill or empty one

lucid bane
#

AHHHH
i have to use PlayerBucketFillEvent, not PlayerBucketEvent

#

right?

lean gull
#

anyone know how i can start with making custom world gen chunks?

#

like i'm making a custom survival server and i want each player to be in the same world 5k blocks apart, and each player will have like a 250x250 terrain block, that also has some custom stuff

stone sinew
#

I think there are some open source WorldGeneration plugins to.

lean gull
#

i don't want to make a void world, i want to make customized vanilla terrain chunks in a void world

spiral light
#

you cant customize vanilla to generate exact same chunks every x blocks

#

you will have to do it manually

lucid bane
#

@frosty tinsel how do i know a certain event is abstact or not?

lean gull
#

wdym?

stone sinew
lean gull
spiral light
#

use the worldcreator.setChunkGenerator and create your own ChunkGenerator

lean gull
#

and the terrain will be different for everyone, right?

lucid bane
#

IT WORKS THX u all

lean gull
#

where do i learn all of this

stone sinew
# lean gull where do i learn all of this
public class VoidChunkGenerator extends ChunkGenerator {

    @SuppressWarnings("deprecation")
    public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) {
        Environment env = world.getEnvironment();
        Biome b = (env == Environment.NORMAL) ? Biome.JUNGLE : (env == Environment.NETHER) ? Biome.NETHER_WASTES : Biome.THE_END;
        for(int c1 = 0; c1 <= 15; c1++) {
            for(int c3 = 0; c3 <= 15; c3++) {
                biome.setBiome(c1, c3, b);
            }
        }
        return createChunkData(world);
    }
}
```Simple void world generator. Build your own terrain generation methods from here.
frosty tinsel
#

Can event listener methods be private?

spiral light
#

never thought about this but i think so

frosty tinsel
#

k

#

Ill try

quaint mantle
frosty tinsel
#

huh?

#

ok

dusk flicker
#

its useless to have them private

frosty tinsel
#

no

dusk flicker
#

Provide a good reason for it then

#

I can't think of one

frosty tinsel
#

Its a design thing

#

If I want the events to only be called by Bukkit and not anyone else

#

(not counting reflection)

stone sinew
dusk flicker
#

do you want the actual event private or a listener?

#

How will a listener being private do anything

quaint mantle
#

Paper generates code at runtime to call event handler methods instead of using reflection, which is much faster. If you make them private they'd have to use reflection

quaint mantle
frosty tinsel
quaint mantle
stone sinew
quaint mantle
#

bla bla bla bla

frosty tinsel
#

He just gave an advice

stone sinew
frosty tinsel
split lichen
#

To steer the conversation away from paper vs spigot, especially in spigot's discord server, I have a question - is it possible, and if so, what is the optimal way of creating ambient lighting/particle effects at a biome, or at a region (using world guard)?

quaint mantle
#

how is it related to worldguard lol

#

I think you want to set the biome

split lichen
#

if instead of biome specific you created region specific lighting effects by hooking into wg api

frosty tinsel
split lichen
frosty tinsel
#
Minecraft Wiki

Light blocks (in Bedrock Edition) or lights (in Java Edition) are invisible blocks, primarily intended for map makers, that can produce any light level from 0 to 15. The light block is also the only light-emitting block capable of producing light level 8.

spiral light
#

wth .... Inventory has no getTitle ?

young knoll
#

It’s in InventoryView now

frosty tinsel
stone sinew
spiral light
#

and if i have only InventoryView it sucks ^^ xD

quaint mantle
#

View has, but you shouldnt use titles to compare inventories

rough basin
#

Why does this statement only run on reload() and usually doesn't work when activating the server?

frosty tinsel
#

It's new in 1.17/18

split lichen
#

can't seem to find any info regarding the subject anywhere

frosty tinsel
rough basin
#

onEnable()

frosty tinsel
rough basin
#

just /reload or /reload confirm

quaint mantle
#

Do not use reload.

frosty tinsel
stone sinew
frosty tinsel
rough basin
#

Why is /reload bad? They all tell me not to use it, but it doesn't tell me why :(

rough basin
frosty tinsel
#

plugins might break

#

because not actually everything is reloaded and such

young knoll
#

It’s fine in dev

#

If you know your plugin will handle it

frosty tinsel
dusk flicker
#

Never use it in production

torn shuttle
#

damn it why is it my sha1 calculation doesn't match up with online ones

quaint mantle
#

Even if you do reload in dev it can suck

dusk flicker
#

If your server can restart its self in like ~20 seconds just restart

frosty tinsel
quaint mantle
#

IllegalStateException: zip file closed 🙄

dusk flicker
#

Yeah if you are getting err's from your plugin reload then test again, reload breaks stuff a lot

frosty tinsel
torn shuttle
frosty tinsel
#

show your functiuon

torn shuttle
#
try (InputStream input = new FileInputStream(file)) {
            return DigestUtils.sha1Hex(input);
        } catch (Exception ex) {
            return null;
        }

not much to it, really

#

it give me a value but not something that matches

dusk flicker
#

you're taking it into account that its returning a hex string?

torn shuttle
#

hm no actually I switched it and didn't look into how that would impact it

#

I need to convert it from hex right

dusk flicker
#

Yes

torn shuttle
#

I had issues with that earlier

dusk flicker
#

Or you use one of the other sha1 methods, one returns a byte[]

torn shuttle
#

was giving me a no class found that was fun

#

yeah I might do that one

lean gull
torn shuttle
#

yeah I went down this road before, just need to find a good conversion to get it to become a string then

topaz cape
#

do anyone know by any chance how does a permissions system work on bungeecord
im pretty sure you just override the permissible field on spigot but i don't really know about bungeecord (I think I have seen people use an event?)

torn shuttle
#

wonder if the encoding will work with just new string

stone sinew
torn shuttle
#

lol I'm going to go with "no"

granite beacon
#

How can I turn something async into sync again without using the Bukkit.getScheduler().runTask() (I don't want to make the task number go up)

granite beacon
quaint mantle
#

Literally no way

granite beacon
#

Sadge, guess I'll just have to make a new gui so it can be sync

granite beacon
dusk flicker
#

if you get near that you're doing something wrong

quaint mantle
#

uhm depends

#

but yes

granite beacon
quaint mantle
#

Do not blindly fire tasks

granite beacon
#

Just curious

lean gull
quaint mantle
#

see deprecation note

lean gull
#

how do i see that

granite beacon
#

There should be a little comment (or just hover over the deprecated method in your IDE)

granite beacon
#

I think the max amount of tasks that a server can run before go boom is 2147483647 (as that's the max integer in java.)

young knoll
#

Probably the int max

granite beacon
#

Ya

young knoll
#

But I assume one time task IDs get reclaimed

#

At some point

granite beacon
#

I thought they just kept going up

young knoll
#

No idea

granite beacon
#

Since you should be able to re-reference a task later on with it's ID?

#

Oh well

young knoll
#

Task IDs are silly anyway

#

When you can get a task instance instead

#

Although those probably still have an ID

lean gull
lean gull
#

is there a non deprecated method for this though

quaint mantle
ivory sleet
stone sinew
#

You got bigger problems if your issue is the max number of taskids lol

ivory sleet
#

Indeed

spiral light
#

smallest/best primitive to safe itemstacks ? or best way like toBase64

analog prairie
#

why I can't use 1.18.1 jar to make plugin?

spiral light
#

if you run the server with it once it generates a "bunder"-dir
import everything out of it to code plugins

sonic osprey
#

How do I give users in ubuntu access to my server folder?
After running java -Xms16G -Xmx16G -jar server.jar nogui I get

java.nio.file.AccessDeniedException: /home/mcuser/worldmc/cache```
spiral light
#

sudo java...

ivory sleet
spiral light
#

persistentdatacontainer

ivory sleet
#

Why not just to bytes or sth

tardy delta
#

im saving it in base64 in a file rn

spiral light
#

yeah just wondering what would be better since to bytes for a diamond sword with nothing changed is litterly a lot if bytes

tardy delta
#

its pretty long so i wouldnt do it anymore

#

this is just four itemstacks lol

spiral light
#

hmm base64 was my way to go before too...

ivory sleet
tardy delta
#

Conclure is that your doggo on your pf?

ivory sleet
#

Ya

tardy delta
#

is it a him or a her?

ivory sleet
#

Him (:

tardy delta
#

he's cute 🥺

spiral light
#

is he fletching his tooths there ?

tardy delta
#

like rawr

ivory sleet
#

oh yeah he’s growling <:

tardy delta
#

😊

ivory sleet
#

🙂

tardy delta
#

actually can a boolean array be better than like 20 booleans as fields ina class?

blazing scarab
#

Using base64 in pdc is pointless. extra calculations and extra space

tardy delta
#

instead of returning the field i could just return arr[i]

ivory sleet
tardy delta
#

situation like this

ivory sleet
#

Hmm yeah maybe, or just use an Enum as flags for those bistates

spiral light
#

why set it with constructor ... you could check those stuff in methods directly

blazing scarab
#

I'd make a some sort of permission system here

tardy delta
#

mwoa a class where i have getters for each of these things goes brr but this also goes brr

lavish hemlock
blazing scarab
spiral light
# tardy delta situation like this

i believe its a scalling rank system ... you could easy check it with a simple id for each rank ... and then you only need to check canTalk = id > 2

ivory sleet
#

I mean I’d just have something like

enum {
TALK,
INVITE}

And then use an immutable enumset maybe

lavish hemlock
ivory sleet
#

Ofc it depends on how dynamically resizable the system should be

blazing scarab
#

i wanted to make it scalable, so addon developers can simply use builtin permission system

ivory sleet
#

Sounds fair enough (:

lavish hemlock
#

yeah but the other cool thing is that you can do reverse lookup

#

e.g. like enum field -> enum constant

#

with actual enums, you'd need to have redundancy in either of two ways:

#
  • using a map (which would require looping through each value)
  • using a long switch statement (which breaks on refactoring)
tardy delta
#

what if i would just make states like talk, setpassword and add booleans for each of the ranks 🤷‍♂️

ivory sleet
#

Enum::valueOf tho maow

lavish hemlock
ivory sleet
#

Sure it might throw

lavish hemlock
#

not the value of a constant

ivory sleet
#

that’s not what you want?

lavish hemlock
#

e.g. one of its fields

ivory sleet
#

Oh yeah

tardy delta
#

my thing was to have a default channelrank when you join a chatchannel

#

with flags saying what you can do

rough basin
#

Despite being in onEnable(), strangely it doesn't work the first time I open the server Bruh

quiet ice
#

it is the default anyways

#

what is possible is that the chunks are not fully loaded (I'd defer this task a tick after ChunkLoadEvent), but I do not know if that is the actual cause

#

By default only the spawn chunks are loaded afaik

#

And of course register your listener in your onLoad method and do the load: STARTUP and have your current code in case someone does the /reload confirm

rough basin
#

actually when i /reload confirm , it works well nah
As you said, it seems to happen because the server is not loaded the first time it is running.
well then should i run this after ChunkLoadedEvent only one time when server starts?

quiet ice
#

No, every time

#

The server will never have all chunks loaded at the same time

#

So instead of iterating over the world'chunks you just iterate over all the entities in the chunk that was loaded a tick after the chunk was loaded (as I do not know how it reacts when doing that within the ChunkLoadEvent directly)

rough basin
#

Is it correct to create a new BukkitRunnable and run it after few ticks to check after event?

quiet ice
#

Yes, though I'd prefer

        Bukkit.getScheduler().runTask(plugin, () -> {
            // Your code here
        });

since we are no longer living under the tyranny of Java 7

proven sierra
#

All well and good until you want to cancel it 😄

tardy delta
#

no

next stratus
#

Just use a lib to handle it, far easier lol.

quiet ice
#
        Bukkit.getScheduler().runTask(instance, task -> {
            task.cancel();
        });

eh?

tardy delta
#

lmao you're too fast

quiet ice
#

actually, that makes no sense

next stratus
#

how

#

that's so simple?

quiet ice
#
        BukkitTask task = Bukkit.getScheduler().runTask(plugin, () -> {
            // code
        });
        task.cancel();

this makes more sense

next stratus
#

how so

#

it looks pretty simple?

quiet ice
#

because you won't cancel the task while it is running, makes absolutely no sense at all

next stratus
#

?

tardy delta
#

cancel it when something is true

next stratus
#

you use task.cancel(); when you want to?

ivory sleet
#

It’s quite sad that the one that takes the consumer doesn’t return BukkitTask

tardy delta
#

so check while its running?

next stratus
#

you just cancel it when you wanna 🤷‍♂️

dry forum
#

is it possible to check if a players input for a particle exists? i know about Material.matchMaterial but i cant find anything similar for particles

next stratus
#

does the Xseries have it?

#

I think they got a particle thing

dry forum
#

huh

stone sinew
dry forum
#

alright thanks

quiet ice
#

You could use Enum#valueOf but a bit dangerous considering it will be gone one day

ivory sleet
#

Will it?

quiet ice
#

Not guaranteed, but I consider it to be inevitable

#

Just give or take a few years or decades

analog prairie
#

Where can I got the spigot api

ivory sleet
#

hmm yeah gotta go through deprecation first 🤡

quaint mantle
#

Why cant valueOf be just nullable 🙄

tardy delta
analog prairie
#

Which event should I use to monitor when the player destroys the block

spiral light
#

blockbreakevent

analog prairie
ivory sleet
wraith hare
#

hello I have probleme with mu /rtp code, the programe is all time null in the getSafeLocation, anyone can help me please ?
this is the code :

public class CommandRtp implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        
        if (sender instanceof Player) {
            
            Random random = new Random();
            Player p = (Player) sender;
            Location ppos = new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
            
            Location rtp = new Location(p.getWorld(), random.nextInt(10000), random.nextInt(200), random.nextInt(10000));
            
            if (getSafeLocation(rtp) != null) {
                
                p.sendMessage("§aLancement du teleportement aleatoire...");
                p.teleport(rtp);
                
            }
            
            else {
                
                rtp = new Location(p.getWorld(), random.nextInt(10000), random.nextInt(200), random.nextInt(10000));
                p.sendMessage("Bug, réessais");
                
            }
            
            
        }
        
        return false;
    }
    
    public Location getSafeLocation(Location location) {
        
        Block b = location.getWorld().getHighestBlockAt(location);
        
        if(!b.isEmpty() && !b.isLiquid()) {
            
                return b.getLocation();
        }
        
        return null;
    }

}```
quiet ice
#

because the chunk might not be loaded

#

idk

spiral light
frosty tinsel
#

Hi, does anyone know how would I find the time until my repeating Bukkit Task is run again?

spiral light
#

well you should know what time is set in for the BukkitTask

#

if it runs you set a variable to System.currentTimeMillies()

#

with that you can calc the time until it will run again

dusk flicker
#

yikes dude use a paste

#

?paste

undone axleBOT
frosty tinsel
wraith hare
#

how can I add an exeption for air ?

spiral light
frosty tinsel
spiral light
spiral light
wraith hare
spiral light
#

bukkit task^^

frosty tinsel
#
currentTask = new BukkitRunnable()
        {
            @Override
            public void run ()
            {
                decrease();
            }
        }.runTaskTimer(plugin, 0, unit.getTicks());
spiral light
#

unit.getTicks ?

frosty tinsel
#

imagine there's a 20

#

for example

spiral light
#

then it will run every 20 ticks O.o

wraith hare
spiral light
#

each second

spiral light
wraith hare
spiral light
#

or just remove the !

#

because you want an empty block arent you ?

frosty tinsel
#

with the BukkitTask object

spiral light
frosty tinsel
#

well I work with ticks here

wraith hare
frosty tinsel
#

If I would want it to be synced and like precise to the ticks

spiral light
#

if you have lastRun just do:

dif = System.timemillis - lastRun
now you have the dif in millis and calculate out of that the ticks

#

20 ticks = 1 s

#

1s = 1000 millies

frosty tinsel
#

Any way to get the time in ticks. For example ticks from the server start

spiral light
#

dk

spiral light
wraith hare
spiral light
#

so the block where the teleport should go should be empty ? ... and not not empty ?

frosty tinsel
wraith hare
#

like the /top

spiral light
spiral light
frosty tinsel
spiral light
#

you WANT an empty block and not an not empty block

#

the block cant be liquid i guess either

wraith hare
#

okay

spiral light
#

sounds more like xy problem

wraith hare
#

this not resolve the problem, if i am tp in a cliff i am in the ground

#

and i do that ```java
public Location getSafeLocation(Location location) {

    Block b = location.getWorld().getHighestBlockAt(location);
    
    if(!b.isEmpty() && !b.isLiquid()) {
        
        return null;
            
    }
    
    return b.getLocation();
}```
spiral light
#

you dont want to teleport the player if there is liquid or blocks right ?

wraith hare
#

no

#

i want to tp the player in liquid or on the ground for not take fall damage

#

aaah i have found my error

#

I have 200iq

#

if the payer tp I add an rresistance effect 1000 for 30 sec

tardy delta
#

does the translateAlternateColorCodes method only replaces & by § ?

quiet ice
#

And what if the ground is lava

tardy delta
spiral light
quiet ice
#

yea, lava is liquid

wraith hare
tardy delta
#

the ground is liquid

ivory sleet
#

yeah but its basically a glorified String::replace (not rly but sort of)

wraith hare
#

this is good ? ```java
if(b.isEmpty() && b.isLiquid() && !(b.getType() == Material.LAVA)) {

            return b.getLocation();
    }
    
    return null;
}```
quiet ice
#

it's just that the ampersand is most prevalent due to historical reasons

spiral light
#

highest non-empty (impassable) block... so it will be a solid block or maybe liquid.. you should test for the block above that

#

and check if the block itself is a solid block

quiet ice
#

there is no block above if it is the highest solid block

spiral light
#

i dont know about that "impassable" in the javadocs so i would test rather this

#

could be that liquids dont count and you can land on the ground of a ocean with that method

wraith hare
#

like this ? ```java
public Location getSafeLocation(Location location) {

    Block b = location.getWorld().getHighestBlockAt(location);
    
    if(!b.isEmpty() || !b.isLiquid() || (b.getType() == Material.LAVA)) {
        
            return null;
    }
    
    return b.getLocation();
}```
spiral light
#

-.-

wraith hare
#

uh okay

quaint mantle
#

Not using depenency injection

wraith hare
#

I don't understand and google translate is not very intellectual x)

rough basin
#

i use it so many but i dont trust it

quiet ice
#
Checks if this block is empty.
A block is considered empty when getType() returns Material.AIR.
spiral light
#
public Location getSafeLocation(Location location) {

        Block blockNotEmpty = location.getWorld().getHighestBlockAt(location);
            
        if(blockNotEmpty.getType().isSolid() && blockNotEmpty.getRelative(BlockFace.UP).isEmpty()){
            return blockNotEmpty.getLocation().add(0,1,0); // <-- Location to teleport player
        }
        
        return null;
    }

quiet ice
#

FreeSoccerHDX's code does not make sense

spiral light
quiet ice
#

The highest non-empty block will never have a non-empty block above it

#

You can also use public int getHighestBlockYAt(int x, int z, @NotNull HeightMap heightMap); to be extra sure

spiral light
quiet ice
#

As

   /**
     * The highest non-air block.
     */
    WORLD_SURFACE,
bitter fulcrum
#

So I'm writing a plugin that targets both Fabric and Spigot, and I'm wondering if vanilla minecraft classess are accessible in Spigot

ivory sleet
#

ye they are

spiral light
#

no

wraith hare
#

okay

ivory sleet
#

you got all the server nms classes at least if you add spigot (not spigot-api)

quiet ice
#

They will have different names

ivory sleet
#

idk if the client ones are added as well

bitter fulcrum
lavish hemlock
quiet ice
#

But they will be present mostly, although some might be changed

quaint mantle
#

On spigot? No

#

client classes i mean

lavish hemlock
#

Spigot has basically no access to client classes but Fabric has access to all classes.

bitter fulcrum
#

Yeah

spiral light
#

@quiet ice this code will not work above grass (!not blocks) or liquids !

#

it will return null

quiet ice
#

Fuck it, I will write a proof-of-concept plugin

spiral light
#

this works perfectly fine with everything except liquids ^^ probably the result that he wanted

wraith hare
#

is it good or did I make a mistake again? ```java
public class CommandRtp implements CommandExecutor {

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    
    if (sender instanceof Player) {
        
        Random random = new Random();
        Player p = (Player) sender;
        Location ppos = new Location(p.getWorld(), p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
        
        Location rtp = new Location(p.getWorld(), random.nextInt(10000), random.nextInt(200), random.nextInt(10000));
        
        if (getSafeLocation(rtp) == null) {
            
            p.sendMessage("§aLancement du teleportement aleatoire...");
            p.teleport(rtp);
            
        }
        
        else if (getSafeLocation(rtp) != null) {
            
            rtp = new Location(p.getWorld(), random.nextInt(10000), random.nextInt(200), random.nextInt(10000));
            p.sendMessage("Bug, réessais");
            
        }
        
        
    }
    
    return false;
}

public Location getSafeLocation(Location location) {
    
    Random random = new Random();

    Block blockNotEmpty = location.getWorld().getHighestBlockAt(location);
        
    if(blockNotEmpty.getType().isSolid() && blockNotEmpty.getRelative(BlockFace.UP).isEmpty()){
        return blockNotEmpty.getLocation().add(random.nextInt(10000),1,random.nextInt(10000)); // <-- Location to teleport player
    }
    
    return null;
}

}```

quiet ice
#

actually, I see

spiral light
#

why do you add smth random to it @wraith hare

wraith hare
#

uh this is a test i forgot to remove

spiral light
#

the add(rnd10000,1,rnd10000) just destroys the concept of checkig for a good block to teleport

rough basin
#

new SentryTask(Livingentity).runTaskTimer(Bukkit.getPluginManager().getPlugin("Sentry"), 0, 30);
Did I wrong?

#

it works only one time

spiral light
spiral light
spiral light
#

dont have a example but in your onEnable you can set a static of you plugin ...

#

create an public static getter for it and then use it

severe folio
#

do u mean NMS?

wraith hare
rough basin
#

terrible trauma

spiral light
wraith hare
#

1.12.2

spiral light
#

do you have isSolid ?

wraith hare
#

yes

spiral light
#

replace isPassable with !isSolid
should probably work too

wraith hare
#

okk

#

uh no I don't have isSolid

#

juste isEmpty

quiet ice
spiral light
#

upgrade to 1.18

quiet ice
#

Typical 1.8 user

wraith hare
#

uh

#

it's doesn't good

wraith hare
#

I stop I continue tomorrow it is a little complicated

spare prism
#

Why doesn't the itemStack.getEnchantments() method return a list that contains my unsafe enchantment?

spare prism
#

It has the enchantment

quaint mantle
#

custom enchants are generally unsupported

spare prism
#

how do I get it then

brave sparrow
#

Custom enchants and unsafe enchants are not the same thing

quaint mantle
#

ah

spare prism
brave sparrow
#

No

spare prism
#

it adds in-game, but I can't get it using this method

brave sparrow
#

Can we see the code

spare prism
#

yes

spare prism
brave sparrow
#

Oh so you are doing custom enchantments

spare prism
brave sparrow
#

I’m not sure if that method can return enchantments not part of normal Minecraft

#

That may be your issue

spare prism
brave sparrow
#

I don’t know

#

I’m not sure how the spigot internals handle that off the top of my head

#

I’ll take a look

#

Tentatively it seems like that method should work

quaint mantle
brave sparrow
#

@spare prism how many enchantments are returned in the map?

spare prism
#

in the fact there are two of them

brave sparrow
#

So none of your custom ones

spare prism
#

yeah

brave sparrow
#

When you log out are your custom ones still on the item?

spare prism
brave sparrow
#

Yes

spare prism
spare prism
#

it keeps

#

the enchantments

#

I see it in the nbt data

brave sparrow
#

Ok log back in

#

Still on the sword?

spare prism
#

yes

brave sparrow
#

¯_(ツ)_/¯

#

No clue then

quaint mantle
#

How do you implement getKey?

spare prism
quaint mantle
#

oh i see

#

You use NamespacedKey.minecraft

#

no clue then

tardy delta
#

does java only accepts ASCII characters as identifiers?

#

my ide says

quaint mantle
#

Huh? What identifiers

tardy delta
#

like parameter names, fields etc

quaint mantle
#

I dont think the entire ascii

#

english letters, numbers, _

quiet ice
#

In reality it supports almost every unicode char

bitter fulcrum
#

Is the JavaPlugin$onLoad method ran before the world is loaded?

tardy delta
#

i saw utf8 so i was confused

quiet ice
spare prism
#

@brave sparrow, @quaint mantle, the problem was that I put the wrong check when I registered the echantments. Now it works. Tysm for trying to help me

eternal oxide
#

By default onLoad executes before worlds are loaded, unless performing a reload

quiet ice
#

Ah yeah, Elgar is right I am blind

#

I'm not sure how I managed to mistake that as it loading after world load

[17:48:33 INFO]: [PlayerCurrency] Loading PlayerCurrency v0.0.1-SNAPSHOT
[17:48:33 INFO]: Server permissions file permissions.yml is empty, ignoring it
[17:48:33 INFO]: Preparing level "world"
[17:48:34 INFO]: Preparing start region for dimension minecraft:overworld
[17:48:35 INFO]: Time elapsed: 357 ms
[17:48:35 INFO]: Preparing start region for dimension minecraft:the_nether
[17:48:35 INFO]: Time elapsed: 169 ms
[17:48:35 INFO]: Preparing start region for dimension minecraft:the_end
[17:48:35 INFO]: Time elapsed: 144 ms
[17:48:35 INFO]: [PlayerCurrency] Enabling PlayerCurrency v0.0.1-SNAPSHOT

That being said, the load arg is a bit strange knowing that officially it is postworld by default

tardy delta
#

is there a set that doesnt allow nulls?

#

hashset allows one null

#

concerning users doing stupid things

quaint mantle
#

you shouldnt store nulls

tardy delta
#

well yea i know that

#

i didnt even know a hashset was storing a hashmap inside 👀

glossy marsh
#

Hello everyone! I've got a quick question

tardy delta
#

it seems like you're typing the bible though

severe folio
#

lmao

tardy delta
#

that isnt exactly what i expected from a quick question 😔

glossy marsh
#

I created a listener which sends a player the coordinates of the location where they died which gets executed when said player dies (on player death event). In the chat the player receives this message before before the server broadcasts the global death event. So the chat looks like this:

<Player> died from falling

Is there an easy way to make it display like this without scheduling a timer?

Psst, you died at [x,y,z]

So first the server message and then the personal message

glossy marsh
tardy delta
#

set the eventpriority to Monitor?

#

i think the server will still broadcast it after that

#

maybe worth trying

glossy marsh
#

I tried changing
@EventHandler to @EventHandler (priority = EventPriority.LOWEST) and @EventHandler (priority = EventPriority.HIGHEST) and neither of those made a difference

#

What does eventpriority Monitor do?

tardy delta
#

like the same to highest but it indicates that the listener shouldnt cancel the event

glossy marsh
low temple
#

@glossy marsh alternatively you can save the death message string with event.getDeathMessage() then set it to empty with event.setDeathMessage(“”)

quiet ice
#

The player is not yet dead at the PlayerDeathEvent, which is why it does not work

low temple
#

Then just reprint the message after ur cords

quiet ice
#

Perhaps the monitor priority does it, but I highly doubt it

eternal oxide
quiet ice
#

^ probably the best solution

glossy marsh
#

The Monitor priority didn't fix it

karmic grove
#

is there way to speed up crop growth but not everything random tick speed related

glossy marsh
# low temple Then just reprint the message after ur cords

I kinda like this solution as well. I was playing with the idea of showing the death message as usual for all the players but making a different death message for the player that died which is clickable and copies the coordinates to your clipboard

glossy marsh
glossy marsh
eternal oxide
#

runTask simply runs code in the next tick.

#

?pdc

low temple
#

this will print the message after and should print it to all of the players

glossy marsh
glossy marsh
#

I'm going to read into both of these 😄

glossy marsh
#

You all have been of great help, thanks a lot! Is there any way in which I can support this community? It's really great how quickly and well you guys help me

low temple
tardy delta
#

i had it with the join event

#

null might be better

low temple
#

Yeah maybe, if "" doesnt work try null

hexed hatch
upper niche
#

I'm trying to create a written book, but the addPage() method doesn't seem to work for the book's BookMeta.
No matter what I put into the String argument, when I open the book it just shows "* Invalid book tag *"
Am I doing something wrong?

low temple
upper niche
#

here's my entire code for it

ItemStack smelterBook = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) smelterBook.getItemMeta();
meta.setTitle("A Guide to Smelters");
meta.addPage("test1","test2");
smelterBook.setItemMeta(meta);
lucid bane
#

a common question, is there a way to change max stack size of vanilla itemstack?

upper niche
upper niche
#

yep that seems to have worked

#

thanks

glossy marsh
tame shoal
#

For anyone wondering! I found a way for to classes to communicate efficiently

#

Makes it easy to organise code

torn shuttle
#

I'm really tired but I want to get this done before I head out, can someone tell me if getting a CME:null makes any sense on this line?

for (ObjectiveDestinations iteratedObjectiveDestinations : objectiveDestinations)
#

can CMEs even fire when you just call for an iteration

fleet imp
#

I'm trying to make a command that takes a string, but every space (even if theres quotes) is considered a different arg. How do I either take a string inistead of a list, or join the args as a string (keep in mind theres no set amount of words/args per cmd)

low temple
fleet imp
low temple
# fleet imp no

then you can take the args array and loop through it and create a string builder

upper niche
tame shoal
visual tide
tame shoal
#

Xd

fleet imp
#

@tame shoal kinda. @low temple @upper niche thx

upper niche
#

who need stringbuilder when you have += 😎

tame shoal
tame shoal
#

Alr anything else?

fleet imp
#

no

tame shoal
#

kk

fleet imp
#

it would be /cmd {the rest of this is one string}

tame shoal
#

yea

eternal oxide
#

String.join(" ", args) or something close

low temple
tame shoal
#

for (String args : in args) {
if (arg.equalsignorecase("thing")) {
// idk
} else {
//something else idk
}

#

POV: Discord is your IDE

#

And you make the classes as channels

low temple
#

lmfao

tame shoal
#

XD

frosty tinsel
tame shoal
#

POV: yOU CAN'T CODE IN JAVA

frosty tinsel
low temple
tame shoal
#

ahha yes

#

I know what that is

#

but there's no tab

#

atleast on web version

frosty tinsel
#

hm

#

on desktop there is

tame shoal
#

what's the minecraft id for "Air"

frosty tinsel
tame shoal
#

Novas in the njmber

severe folio
#

minecraft:air or 0 if you;re using numerical ids

tame shoal
#

No as in*

#

Ty

woeful crescent
#

Anyone know how often the player's right click action is repeated when holding down the mouse button

fleet imp
#

how do i add an element to a list

woeful crescent
woeful crescent
low temple
fleet imp
low temple
#

like if they hold right click on a static block like stone it might only fire once

woeful crescent
low temple
#

but if its a block like a chest or door itll fire as fast as they door id opening/closing

frosty tinsel
fleet imp
woeful crescent
#

But like

frosty tinsel
woeful crescent
buoyant viper
#

i think no matter what its #, it's mainly for documentation tho

woeful crescent
#

. ==> static, # ==> instance

#

ok

frosty tinsel
woeful crescent
#

i thinlk

#

I'm probably wrong tho xD

eternal oxide
#

You are incorrect 🙂

frosty tinsel
frosty tinsel
eternal oxide
#

is documentation

buoyant viper
#

aha, knew it

eternal oxide
#

it doesn;t really matter which you use

#

in here we generally use # unless writing actual code

frosty tinsel
dull whale
#

anybody know 1.7-1.12 fawe maven rep/dep?
Somehow I couldnt find it

lost matrix
#

I've also learned that '.' is used for static and '#' is used for instance context.

#

I see that the inet partly disagrees...

eternal oxide
#

There doesn't seem to be a consensus. But discussions here in the past have generally come down to "it doesn't matter" and "# is documentation".

glossy scroll
#

i was about to say

#

it really doesnt matter

#

originates from url addresses i think, hence documentation

tribal lichen
#

Heya all, question, I made my first plugin to mute the chat and it works flawlessly on my private server but when I put it on my public server it decides to just not work at all the command doesn't show up or anything...

glossy scroll
#

have you checked your log?

lost matrix
tribal lichen
lost matrix
#

Then its not in the plugins folder

spiral light
#

did you add it after starting the server ? then use reload first ...

lost matrix
#

Ew

#

Restart pls

cosmic arrow
#

in bungeecord, is there an event or way to execute code when a server is about to stop? i'm trying to setup a fallback server that players get sent to when the server they're in stops or restarts. i tried to find a way to do it without a plugin but i can't find a way

tribal lichen
#

It's there and I turned the server off added it and then started it after adding it

glossy scroll
#

it has different perms

#

server cannot access that file

tardy delta
#

"root root"

tribal lichen
#

Ah

#

yes

#

thank you

lost matrix
glossy scroll
#

plot twist he just made a user called root

tribal lichen
blazing scarab
#

Thats pterodactyl isnt it

tribal lichen
#

How'd you know? XD

blazing scarab
#

Oh w8

#

Nvm

#

well, my message doesnt make to much sense

vapid needle
#

I made a parrot rideable but how can I make it controllable?

glossy scroll
#

not sure if its possible

#

i have some ideas

vapid needle
#

Because when I search on google I always find about custom entity but mine is the normal parrot so can I do it

cosmic arrow
glossy scroll
#

without a plugin?

#

so are you coding something or not?

vapid needle
glossy scroll
#

to vizored

cosmic arrow
vapid needle
#

oh ok

glossy scroll
#

im digging through code to see if i can help you

glossy scroll
cosmic arrow
glossy scroll
#

ok well

#

this isnt the place for your question either

cosmic arrow
glossy scroll
# vapid needle oh ok

so far the only way to do it is to set a temptation item on the entity by accessing its pathfinder

#

or just make a custom entity that overrides the move method

#

the second is gonna be a lot more painful than the first

#

both require NMS

vapid needle
#

So the easier one is the first one right?

glossy scroll
#

yes

vapid needle
#

Ok I will try that

glossy scroll
#

but that means the player has to have an item in hand

vapid needle
#

ok

glossy scroll
#

this.goalSelector.addGoal(4, new PathfinderGoalTempt(this, 1.2D, RecipeItemStack.of(Items.CARROT_ON_A_STICK), false)); thats what i found for a pig

vapid needle
#

So I can choose any item in the hand and he will just follow it right?

glossy scroll
#

youll have to test it yourself, this isnt something ive done before

#

but that is my assumption

vapid needle
#

Ok

#

thanks

glossy scroll
#

wait

#

im sorry

#

i just realized

#

you definately need custom entity

vapid needle
#

oh ok

#

I will try to figure it out

#

thanks for the help anyway

glossy scroll
#

what mc version are you using btw

#

i might see if i can PR something that allows for this change in spigot

vapid needle
#

1.14.4 atm

glossy scroll
#

eh well my change wont help you then

vapid needle
#

You could change it if it was a newer version?

glossy scroll
#

i can only patch latest versions of spigot

sleek pond
#

Is there a way to shade protocol lib into your plugin?

glossy scroll
#

why would you want to do that?

desert loom
glossy scroll
#

its the acutal movement method in the entity

desert loom
#

ah nvm then.

vapid needle
#

Creating a custom entity and making it controllable

tender shard
#

yo bitcheeees, I'm back

#

throw your spigot questions at me now

proud basin
#

how do I code in spigot

tender shard
#

just do java stuff, gg ez

proud basin
#

why do java

tender shard
#

yeah, why smoke tobacco if you can use crack instead, right?

proud basin
#

Why not scratch

unreal quartz
tender shard
severe folio
#

fr?

#

bruh

#

rip ig

tender shard
#

yeah id even know why

severe folio
#

have you appealed it

tender shard
#

yes

#

yesterday

unreal quartz
tender shard
#

my account was banned for "security reasons"

young knoll
#

Happens when your account logs in from weird places

tender shard
#

but I didn't

#

also wtf is a werid place? 😄

proud basin
#

yea

young knoll
#

Like

proud basin
#

what is a weird place

young knoll
#

The United States and then Australia right after

blazing scarab
#

Germany

proud basin
#

what if they moved

young knoll
#

Hence why I said right after

#

It also generally takes more than one

tender shard
#

Me = germany, not a weird place lol

blazing scarab
karmic grove
#

is there a way to speed up plant growth not all random tick speed

tender shard
karmic grove
#

._.

tender shard
#

all crops blockstates are instanceof ageable

young knoll
#

Sometimes I wish we had a random tick event

tender shard
#

myPotato = (Ageable) block.getState() or sth like that

tender shard
young knoll
#

For stuff like this

#

And for custom blocks I want to tick

karmic grove
#

wait

#

so its not possible

#

to grow certain crops faster

young knoll
#

Like he said, do it manually

steady herald
#

Running into an issue as to why my commands are not executing

public class RemoveRing implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
        System.out.print("Here");
        if (sender.isOp()) {
            System.out.print("Here2");
            if (command.getName().equalsIgnoreCase("removering")) {
                System.out.print("Here3");
                if (args.length == 2) {
                    Player admin = (Player) sender;
                    Player target = Bukkit.getPlayer(args[0]);

                    admin.sendMessage("Here");
                    String oldArray[] = {"dwarvenRing", "Narya", "Nenya", "Vilya", "nazgulRing", "thePrecious", "theOneRing", "witchKingsRing"};
                    String translateTable[] = {"Dwarven Ring", "Narya", "Nenya", "Vilya", "Nazgul Ring", "The Precious", "The One Ring", "WitchKings Ring"};
                    String ringName = translateTable[Arrays.asList(oldArray).indexOf(args[1])];
                    admin.sendMessage("ThisPoint");
                    ItemStack itemToRemove = null;
                    List<ItemStack> itemList = Arrays.asList(target.getInventory().getContents());
                    for (ItemStack item : itemList) {
                        if (item.hasItemMeta() & item.getItemMeta().getLore().contains(ChatColor.WHITE + ringName)) {
                            itemToRemove = item;
                            break;
                        }
                    }
                    if (itemToRemove != null) {
                        target.getInventory().remove(itemToRemove);
                        target.setMaxHealth(20);

                    }
                }
            }
        }
        return true;
    }
}

This is my executor Class

My plugin.yml command register line:

  removeRing:
    description: test
    usage: /<Command> <Target> <ringType>
#
package mythicmidgard.feroxidus.mythicutilities;

import mythicmidgard.feroxidus.mythicutilities.commands.adminCommands.RingCommands.GiveRing;
import mythicmidgard.feroxidus.mythicutilities.commands.adminCommands.RingCommands.RemoveRing;
import mythicmidgard.feroxidus.mythicutilities.commands.adminCommands.loreCommands.*;
import mythicmidgard.feroxidus.mythicutilities.customEnchants.ringEnchants.OneRingUse;
import mythicmidgard.feroxidus.mythicutilities.customEnchants.ringEnchants.RingEffects;
import mythicmidgard.feroxidus.mythicutilities.customEnchants.ringEnchants.SoulLock;
import org.bukkit.plugin.java.JavaPlugin;

public class MythicUtilities extends JavaPlugin {
    public static MythicUtilities plugin;

    @Override
    public void onEnable() {
        //Commands
        getCommand("getMat").setExecutor(new GetMat());
        getCommand("getList").setExecutor(new GetList());
        getCommand("addEnchant").setExecutor(new AddLoreEnchantment());
        getCommand("addLore").setExecutor(new AddLoreInfo());
        getCommand("setName").setExecutor(new ChangeDisplayName());
        getCommand("removeLore").setExecutor(new RemoveLore());
        getCommand("giveRing").setExecutor(new GiveRing());
        getCommand("removeRing").setExecutor(new RemoveRing());


        //Load Enchants
        getServer().getPluginManager().registerEvents(new SoulLock(), this);
        getServer().getPluginManager().registerEvents(new RingEffects(this), this);
        getServer().getPluginManager().registerEvents(new OneRingUse(), this);
    }
}

Main Class

#

The issue is, whenever I fire a command

#

it never reaches the executor, and just prompts me with the Usage of the command

#

I know that it is not reaching the executor as it never prints in console

#

@ me

little trail
#

Is there any way to stop an event listener from, listening

young knoll
#

Explain?

little trail
#

so where you use PluginManager.registerEvents to register event listeners, how would I deregister them

eternal oxide
steady herald
#

I can send the whole yml I just send a small thing...

#
name: MythicUtilities
version: '${project.version}'
main: mythicmidgard.feroxidus.mythicutilities.MythicUtilities

commands:
  getMat:
    description: Retrieves items Material Enum (For Development)
    usage: /<Command>
  addLore:
    description: Adds lore to an item
    usage: /<Command> <Lore> <ChatColor>
  setName:
    description: Changes the displayName and color of an ItemStack
    usage: /<Command> <Name> <ChatColor>
  getList:
    description: Returns varied listTypes, (listTypes found with listType "listList")
    usage: /<Command> <listType>
  removeLore:
    description: Removes a line in an items lore with line number
    usage: /<Command> <Line>
  giveRing:
    description: Gives a ring of power to specified player
    usage: /<Command> <Target> <ringType>
  removeRing:
    description: Removes a ring of power from specified player
    usage: /<Command> <Target> <ringType>
#

Entire yml

eternal oxide
steady herald
#

reloading causes no errors, shall I restart server entirely?

eternal oxide
#

yes, clean startup

steady herald
#

k

#

an OnEnable error I see

#

For some reason it was warning me that there was missing imports wierd

#

ty Elgar

hoary remnant
#

Hey when I try to use gson for serialization of objects I get the java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: error what exactly can I do about this?

little trail
frigid rock
#

guys, so i'm making a "rank shop" gui, and for example a "diamond rank" will expire after 7 days. how can i do that with bukkitscheduler?
i tried to watch videos or read docs but i cant get that in my mind
like the idea would be this: when i buy it to run the "timer", and on server stop to store the time left in a config. then when server starts it should get the updated time left. but idk how to program that

honest sentinel
#

Hey, I'm trying to make a countdown that starts at 300 seconds if there aren't enough players in the game, and if there are enough, it goes down to 60 players and if players leave and there arent enough players again, it goes back to the original 300 seconds, and so on. How would I go on about creating this?

#

I do know how to create a countdown, just not quite sure how to make it do all that

shadow owl
severe folio
#

there's probably a better way of doing it, but thats off the top of my head

frigid rock
#

thank you so much ^^

eternal oxide
severe folio
#

^ theres that too

frigid rock
left swift
#

How can I do so that if I run, for example, 3 tasks (runTaskLater) that are to be executed, for example, in 5 seconds, and if the task is called again during this time, the previous ones will be canceled, and the one that was called last, will be done

quaint mantle
#

What are you trying to do

left swift
#

for example, I type a command, and a message will be sent in 5 seconds. But if I type this command quickly several times, it will send several messages. I would like to do so that if there is already a task in the queue and it is called again, the one in the queue will be canceled and the "newest" one will be executed.

#

and then it will only be done once, not a few times

honest sentinel
terse ore
#

How can I get highest block in x, y coords?

#

I have x and y coordinates and I would like to get highest y coord

left swift
little trail
#

okay so i want to run a method after x amount of seconds, it also needs to be able to access fields in my plugin class too

left swift
little trail
#

and how would i make a task exactly

#

all the ones ive tried cant access the fields in my plugin class

terse ore
#

instead in the middle of 4?

#

I tried adding 0 .5 to x znd z

#

but doesn't work

young knoll
#

It does

terse ore
#
        Player player = ((Player) sender).getPlayer();

        Random random = new Random();

        World world = player.getWorld();

        int x = random.nextInt(7500);
        int z = random.nextInt(7500);
        int y = world.getHighestBlockYAt(x, z);

        x += 0.5;
        z += 0.5;

        Location randomTP = new Location(player.getWorld(), x, y, z);

        player.teleport(randomTP);

        player.sendMessage(color.translate("&aHas sido teletransportado a: " + x + ", " + y + ", " + x));
spiral light
#

what does chat msg say ?

#

oh

#

yes adding double to int ^^

#

you cant add 0.5 to an int ^^

sage patio
#

the problem is chat message?

young knoll
#

No

#

The problem is adding a double to an int

#

Use location#add Instead

#

It will also keep your output as whole numbers, which I assume you want

sage patio
spiral light
#

he isnt the one who needs help ^^

young knoll
#

I mean you can

#

Or just use Location#add like I said

honest sentinel
#

Hey, I'm trying to make a countdown that starts at 300 seconds if there aren't enough players in the game, and if there are enough, it goes down to 60 players, and if players leave and there aren't enough players again, it goes back to the original 300 seconds, and so on. How would I go on about creating this?
I do know how to create a countdown, just not quite sure how to make it do all that. Till now I got this: https://paste.md-5.net/evunupuned.java, https://paste.md-5.net/etasexiqic.java - But when I tested it out, it didn't work out as I wanted it to. It doesn't go down to 60 seconds when there are enough players, and it does not go back to the original time if there aren't enough anymore.

terse ore
sage patio
spiral light
#

@terse ore the reason for you problem is litterly 3 times in the chat now

eternal oxide
#

Location.add(0.5,0,0.5)

terse ore
#

ohh

#

its tru

#

I should make it float?

sage patio
#

yea its nice too

young knoll
#

Screams internally

sage patio
terse ore
#

wdym by that

#

what does that do?

tame shoal
#

Is there any way that I could detect flight cheats accuratly? I don't want spoon feed code i just need help with a method that I could do this. just explain mostly xd

terse ore
#

p.getAllogFlight(true/false);

terse ore
#

Are you looking this

#

or a hack client?

tame shoal
#

You do know... that it won't work JUST like that

terse ore
#
player.getAllowFlight()```
tame shoal
#

Flying as in the server allows them to fly

#

e.g game mode creative

spiral light
#

if you want to detect if a player is flying then use this method ...

tame shoal
#

not as in cheating

tame shoal
#

I'm not that dumb

#

I need a method of detecting flight hacks

#

I know how to detect KA

#

but not flight......

honest sentinel
tame shoal
#

And every time just do time = time -1

honest sentinel
#

I know all that

tame shoal
#

then set the chat thing as time

honest sentinel
#

That I know

tame shoal
#

Then that's all you need...?

honest sentinel
#

it just doesn't work if you look at the two pastes that I linked

#

It doesn't go down to 60 seconds when there are enough players, and it does not go back to the original time if there aren't enough anymore.

#

that's the issue

tame shoal
#

can you post more code...

#

Or is that it

honest sentinel
#

that is it

tame shoal
#

Alr

#

Every second, check the amount of players

#

and make a different public void

#

and if the players are less, run one of them

#

and if the players are more

#

run the other 1

honest sentinel
tame shoal
#

It's not every second

#

What I would do (incredibly inneficiently)

#

Is that it countdowns a second

sullen marlin
#

.runTaskTimer(Game.getInstance(), 0, 0); that shouldnt even work tbh

tame shoal
#

and takes away a second from a defined int

#

1

#

untill that int becomes 0

#

so 60, 59, 58... 0(STOP)

#

and for every time it does that

#

it checks the players

wet breach
tame shoal
#

As i said

#

inneficient

#

but imo easiest for me to do lol

sage patio
wet breach
# tame shoal inneficient

as long as you recognized it isn't efficient because there is events you can listen to that would make it better lol

tame shoal
#

Xd ik

honest sentinel
#

I tried adding java if (!(Bukkit.getOnlinePlayers().size() >= EnoughPlayersCheck.minimumPlayers)) { new Thread(new EnoughPlayersCheck(stateUpdater, chatUtil)).start(); cancel(); } to the countdown file but then it just spams the original time and doesnt go down

wet breach
#

need to add a method to reduce the time

#

loops don't automatically do that on their own 🙂

left swift
#

How can I do so that if I run, for example, 3 tasks (runTaskLater) that are to be executed, for example, in 5 seconds, and if the task is called again during this time, the previous ones will be canceled, and the one that was called last, will be done

hoary remnant
#

Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @20ef37c3 does anyone know what this means..? I have been looking for ages but I can't really find an answer 😦

sullen marlin
#

you're likely passing garbage into gson

#

but without the full error we really cant help you

#

gson is not magic, it can't just turn everything you give it into json

hoary remnant
#

I'll give the full error 🙂

quiet ice
#

It basically means you are doing naughty things with reflections

hoary remnant
quiet ice
#

Basically GSON cannot serialise a java.lang.ref.Reference object

sullen marlin
#

probably trying to throw a Location into gson without writing a serializer

#

Locations contain a World, how can gson write an entire world to json?

#

you should just use yaml, spigot contains extensive APIs for handling yaml, and inbuilt types like Location

hoary remnant
#

Aha, okay did not know that 🙂

quaint mantle
#

Hey so i'm a bit new to creating plugins and need to recompile a plugin i had someone make for me. They created it and since its creation some external endpoints it calls to have changed and I need to recompile. Can someone help me with this?

hoary remnant
#

Ahn yes it works! @sullen marlin Thank you!

#

Just broke the Location down to it's x, y, z coordinates and its world name 🙂

eternal oxide
#

You could always use the inbuild Location#serialize()

wide solstice
sullen marlin
#

snapshots

wide solstice
sullen marlin
#

/public/ is a relic from when we mirrored maven central

#

we don't anymore, but you should use /snapshots/ in your own project

sullen marlin
# quaint mantle bump

that plugin has no build system so you need to compile it the same way is if you were making a plugin from scratch

#

any tutorial on creating a plugin will help you with this

quaint mantle
sullen marlin
#

I don't have a tutorial handy, someone else might, but you will find thousands on google

quaint mantle
#

Ok thanks will just look thru them

sullen marlin
#

either specifically for your IDE, or maven/gradle

quaint mantle
#

👍

#

Normal Visual Studio will work, correct?

sullen marlin
#

no, visual studio is not a java IDE

quaint mantle
#

Ah

sullen marlin
#

Netbeans, Eclipse, IntelliJ are Java IDEs; Maven and Gradle are Java build systems

#

you can probably find tutorials for any one of those 5

quaint mantle
#

Perfect let me get looking.

wet breach
#

I wouldn't consider it a proper IDE for Java like some other ones that are more tailored for it

#

but you can still use it and compile etc

quaint mantle
#

Yea, Im just gonna download IntelliJ

sullen marlin
#

presumably you mean visual studio code; and that's like saying notepad supports java

#

it still needs a build system to build java

quaint mantle
#

Nah I mean physical Visual Studio.

#

Think this vid will be good or should I find a more recent one? https://www.youtube.com/watch?v=FnqZJjgGGmo

In this episode, I show you how to export your plugin's code to a jar file in the server plugins folder with a few buttons clicks. No longer will you have to use Maven and then move the files manually. #Spigot #MinecraftPluginDevelopment

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin int...

▶ Play video
wet breach
#

I don't use VS for java because that is just a way too bulky/bloated IDE for such things and we have better IDE's specifically geared to Java

#

VS isn't specifically geared for Java lol

dusk flicker
#

Spigot has some actual tutorials rather than videos

quaint mantle
dusk flicker
quaint mantle
#

Ty let me try this.

dusk flicker
quaint mantle
#

ty

main dew
#

anyone know open source plugin use AspectJ?

#

I try make Load-Time Weaving in AspectJ but ...

sullen marlin
#

not gonna be fun

main dew
#

yea ;/

sullen marlin
#

I mean if you just add it as an agent its probably ok?

#

for public plugin though, no one wants that

main dew
#

I am honestly a bit of a beginner in AspectJ

#

overall I was looking for a way to turn off the falling gravel and sand

#

but I couldn't find a good solution other than editing the engine and AspectJ

quaint mantle
#

I am making a plugin that makes some sort of a gun I got stuck when I was trying to get an arrow to launch out of the player I know how to launch the arrow its just that the vector I made is throwing an error or intelliJ is throwing an error ```java
Vector v = e.getPlayer().getLocation().getDirection();

#

wait

#

isn't there a method to make a location to a vector