#help-development

1 messages · Page 2170 of 1

sterile token
#

It protect by a radius given

#

So that why i dont use chunks¨*

#

lmao i dont know why they are so painfull

quiet ice
#

You should ignore the performance aspects of getClaim for the meantime, it is rather easy to refractor it later on

#

(Especially given that ABI is likely to stay preserved in that case)

tardy delta
sterile token
#
public class ClaimListener implements Listener {

  @EventHandler
  public void onBreak(BlockBreakEvent event) {
    Player player = event.getPlayer();
    Block block = event.getBlock();
    Claim claim = this.plugin.getClaims().getClaim(block.getLocation());
    if (claim == null) return;
    if (claim.getOwner().equals(player.getUniqueId())) return;
    player.sendMessage("§cYou cannot build on §f" + claim.getUuid() + " §c claim");
    event.setCancelled(true);
  }

}```
#

Up to there all okay no problems, the problems come when i need to add more checks

quiet ice
#

You can just add the checks in your claim class if you want

sterile token
#

Claim class is an object

#

Which is mean only to keep data of each claim (getters in fact)

quiet ice
#

So something like

Claim claim = xyz();
if (claim != null && !claim.canBreak(player) {
    player.sendMessage("§cYou cannot build on §f" + claim.getUuid() /* Why UUID ???? */ + " §c claim");
    event.setCancelled(true);
}
tardy delta
#

i thought that this.getConfig().options().copyDefaults(true) replaces values that are not set in the config with config values from the file within the jar?

quiet ice
#

no it does not

tardy delta
quiet ice
sterile token
#

Hmn

tardy delta
quiet ice
#

?jd-s -.-

undone axleBOT
quiet ice
#

It basically copies all values from the "default" configuration (which you set via above method) into the configuration you called the method on

tardy delta
#

i just want to return the default translations from within the jar's file when stuff isnt set in the actual language file

quiet ice
#

Then you specify the config file within the jar as the default config

tardy delta
#

arent they doing the same?

quiet ice
#

Wha?

tardy delta
#

by setting copydefaults wont it get defaults from the jar's file?

quiet ice
#

Do you think bukkit randomly chooses some random resource within your jar so that resource can be the default config?

#

Of course it does not

tardy delta
#

ah wait i have to call both these methods

#

i guess i understand

quaint mantle
#

Creating a random dice roller generate a random number

reef mantle
#

What is the recommended alternative to Bukkit.getOfflinePlayer(String name)?

#

Use case: get offline player from string in a command

exotic jetty
#
        item.setType(Material.FLOWER_BANNER_PATTERN);
        meta.setDisplayName(ChatColor.RESET + "Pattern");
        List<String> loreList = new ArrayList<>();
        if(pattern == null){
            loreList.add(ChatColor.GRAY + "current Patter = none");
        }else {
            loreList.add(ChatColor.GRAY + "current Patter = " + pattern);
        }
        meta.setLore(loreList);
        item.setItemMeta(meta);
        inventory.setItem(10 , item);  

hello! Im trying to make a system where a player can make there own banner. Im using the banner pattern as itemstack but minecraft already put lore on it. how do i remove this?

item.getItemMeta().getLore() doesnt work

dusk flicker
#

by alternative do you mean one thats not deprecated?

quaint mantle
ivory sleet
#

getOfflinePlayer is deprecated because names are no longer unique past a single session thus it may end up having to make a web request to mojang to get the current uuid of a player by their name

tardy delta
#

i've been looking but i didnt find any code that does a web request to mojangs servers

reef mantle
#

So I currently have a janky method fetchUUID that makes a request to https://api.mojang.com/users/profiles/minecraft/<username> and uses Gson to get the player ID. But I'd prefer to not write my own APIs for that if there's a built in. And I know that getOfflinePlayer is just doing this under the hood

dusk flicker
#

just run it in a thread is the only real thing you can do as far as I know

#

just so it doesnt take over the main thread, but last I checked that was a few updates ago not sure if it still does the same read below

ivory sleet
dusk flicker
#

damn really

reef mantle
#

This method may not return objects for offline players
Does it always return a player if they've played before?

dusk flicker
#

For my application though, I use a redis server that stores the players name and UUID, allowing me to query that to get a name from a uuid or vise versa, and just update on a player connection.

ivory sleet
#

And if they’re online

reef mantle
#

Only online? Will it always be null for offline players?

ivory sleet
#

Yes

reef mantle
#

My use case is specifically getting offline players who have played before

ivory sleet
#

then getOfflinePlayer(String name) should be fine?

dusk flicker
#

a Player object requires the actual player to be online, so getPlayer would require the user to be online

reef mantle
eternal oxide
#

never

dusk flicker
#

I doubt it will be removed

#

md likes backwards compatibility, its also in no way marked for removal

crisp steeple
#

probably won’t ever get removed

#

kind of wish an async version was made though

crisp steeple
exotic jetty
#

thanks!

exotic jetty
#

on what line

crisp steeple
#

meta.addItemFlags

exotic jetty
#

ty!

ivory sleet
#

@tardy delta it’s still blocking

#

Checked stash

exotic jetty
#

the text is still there

crisp steeple
#

what is the text?

exotic jetty
#

the client side text

crisp steeple
#

i’m not sure if you can remove the pattern text on a banner then

exotic jetty
#

D:

exotic jetty
#

its hide dye

crisp steeple
#

neat

exotic jetty
#

no it isnt

#

bruh

#

my code rn lol :

tem.setType(Material.FLOWER_BANNER_PATTERN);
        meta.setDisplayName(ChatColor.RESET + "Pattern");
        meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
        meta.addItemFlags(ItemFlag.HIDE_UNBREAKABLE);
        meta.addItemFlags(ItemFlag.HIDE_DYE);
        meta.addItemFlags(ItemFlag.HIDE_DESTROYS);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        meta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
        List<String> loreList = new ArrayList<>();
hardy trail
#

I'm trying to build my plugin with Java 18 & Spigot 1.18 and I get this error

Unsupported class file major version 62

Anyone know how to fix? Internet isn't helping much, and I've really only made 1.8 plugins with Java 8 before this

worldly ingot
#

;p

sterile token
#

Anyone else cannot update github coplilot plugin on intellij?

#

Fu** github copilot

ivory sleet
#

I’d guess and say that your code somehow adds back the already checked blocks

#

Meant the list

#

But yeah debug it using a debugger would probably be the best way to find the culprit

eternal oxide
#

Your getConnectedblocks(Block block, Set<Block> results, List<Block> todo) also adds the origin block into the todo list as you fetch all 6 BlockFaces

sterile token
#

Hey please send a the email symbol

eternal oxide
#

@kind patrol ^

sterile token
#

My keyboard its not writting it idk why]

crisp steeple
#

like @?

sterile token
#

I dont know why i cannot write it

#

Im pressing AltGr + 2

eternal oxide
#

you have to keep a Set of all processed blocks

#

don;t add any which you have already tested

#

its just a couple of methods, but it can be confusing recursively checking

#

you just need two methods, one is a simple one. Pass it a Block and it returns a list of all Block in the cardinal directions.#

#

then in your main method java Set<Block> tested = new HashSet<Block>(); List<Block> toTest = new ArrayList<Block>();

#

so you call this method passing yoru origin Block

#
toTest.add(origin);

while (!toTest.isEmpty()) {
    Block test = toTest.get(0);
    toTest.remove(0);
    tested.add(test);
    for (Block block : getCardinalBlocks(test)) {
        if (!toTest.contains(block) && !tested.contains(block)) {
            toTest.add(block);
        }
    }
return tested;```Probably something close.
quaint mantle
#
if(data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER) == 0) return;

When I try to compare it to 0, it doesn't work, any ideas why ?

sterile token
worldly ingot
#

I'd have even accepted "at", but "email symbol"!?!?

eternal oxide
#

um, ampersand is &

ivory sleet
worldly ingot
#

FUCK

eternal oxide
#

😄

ivory sleet
#

Lol

sterile token
worldly ingot
#

Maybe it is just called "at sign"

#

lol

eternal oxide
#

I know it as at

worldly ingot
#

"email symbol" is still weird though aPES_Laugh

eternal oxide
#

it is

sterile token
#

I dont know why doesnt work AltGr + 2

#

My keyboard its weird

eternal oxide
#

I have no num pad so I can;t test

sterile token
#

he?

#

Doesnt your keyboard have numbers?

#

Mines doesnt have num pad but it has numbers 🤔

eternal oxide
#

yes just no numpad so can;t use teh ALT numpad to get wierd characters

sterile token
#

ByteArray can be serialized a strings?

eternal oxide
#

eg ALT+064 is @

sterile token
#

what its 064?

eternal oxide
#

numberpad

#

hold alt and press 064

sterile token
#

i dont have the number 064

#

i have number from 0 to 9

eternal oxide
#

oh my, thats what I was saying

sterile token
#

it didnt work

eternal oxide
#

Yes, it only works with a numpad. I don;t have one.Neither do you

sterile token
#

i have

eternal oxide
#

If you have, hold down ALT, then press 064, then let go of ALT

sterile token
#

but hold all them at the same time?

eternal oxide
#

An @ will appear in whatever text entry box you have active

sterile token
#

?paste

undone axleBOT
daring lark
#

how could i get item name? getDisplayName doesn't work.

crisp steeple
#

recursion might be better for this

eternal oxide
#

b1 has to not be in toTest and not in tested

#

Your code will also not include the origin block

#

no, you are adding all those around it

#

oh you are already adding it to tested

#

but b1 has to not be in either

#

if its already been tested we need to ignore it, and if its already in toTest we also need to ignore it

warm saddle
#

Im using a Bukkit Runnable to make a countdown from 6 to 0. However it goes 5, 3, 1 for some reason and then it wont stop when it gets to 0 and it'll keep counting down. Here is the runnable:

      
        final int[] startTimer = {6};
        joinedPlayers.forEach((String playerName) -> {
            Player p = Bukkit.getPlayerExact(playerName);
            new BukkitRunnable() {
                @Override
                public void run() {
                    startTimer[0] = startTimer[0] - 1;
                    p.sendMessage(prefix + ChatColor.WHITE + "Game starts in: " + startTimer[0]);
                    if(startTimer[0] == 0) {
                        this.cancel();
                    }
                }
            }.runTaskTimer(main, 0, 20);

            p.sendMessage(prefix + "RUN!");
eternal oxide
#

You are using a global startTimer but running a forloop over each player. You are reducing it for each player, not once for all

warm saddle
#

ahh

#

so how do i make it send a message to each player in the array with the same number

crisp steeple
#

move the order of the runnable and foreach

eternal oxide
#

you put the forEach inside the runnable

#

other than that I see nothign wrong in yoru code

flat leaf
#

anyone know what PlayerInteractManager is called in the Mojang mappings?

#

it's a class

eternal night
#

that would be ServerPlayerGameMode

flat leaf
#

aha that seems right

#

thanks

eternal night
#

@flat leaf

flat leaf
#

aha

#

thank you very much

daring lark
#

how could i create enchant form string?

harsh totem
#

it costs money ;-;

dusk flicker
#

"it's open source"

harsh totem
eternal oxide
#

any blocks around the toCheck Block are added to the toCheck Set so they will be processed when it loops around

maiden vapor
chrome beacon
#

Since it's open source

eternal oxide
#

I notice you don;t check up nor down

#

all these blocks are on a flat plane?

dusk flicker
glossy scroll
#

I seem to have an issue where the bukkit scheduler isn't working in a linux environment

#

works in a different linux environment

#

actually im mistaken

#

seems to not work at all!

#

currently gona investigate

sacred mountain
#

most migrated to mc market i think though

chrome beacon
#

And what does this have to do with anything?

sacred mountain
#

nothing lmao

#

just saying you cant just compile opensource sometimes

#

since they require data from a server

eternal oxide
#

?paste both methods, so I can easily read them

undone axleBOT
eternal oxide
#

a CCM

chrome beacon
sacred mountain
eternal oxide
#

If you notice mine, I don;t loop the toTest

#

I only loop the blocks returned by the getCardinal

chrome beacon
eternal oxide
#

because you can;t modify a List you are iterating

chrome beacon
#

But I guess there might be some odd project out there

harsh totem
#

I downloaded this and idk how to compile this to jar

#

please help

chrome beacon
#

gradle build

#

gradlew.bat build

If you're on windows

iron glade
#

why was the /gamemode 0|1 command changed to /gamemode survival|creative

#

kinda annoying

warm saddle
#

ok so i've made a firework object how do i make it explode to cause the effect, here is the code for the firework:

Firework fw = (Firework) deathLoc.getWorld().spawnEntity(deathLoc, EntityType.FIREWORK);
                    FireworkMeta fwm = fw.getFireworkMeta();
                    fwm.setPower(2);
                    fwm.addEffect(FireworkEffect.builder().withColor(Color.LIME).flicker(true).build());
                    fw.setFireworkMeta(fwm);
                    fw.detonate();```
harsh totem
chrome beacon
#

Not the file

harsh totem
#

how do i open the terminal

warm saddle
#

that doesn't make it explode i dont think

iron glade
#

wdym with explode?

#

I used this to spawn a random firework which would go off

warm saddle
#

hm that wouldn't even detonate because it doesn't have fw.detonate();

iron glade
#

idk about that it's old code from 1.12 I think

warm saddle
#

thats just not helpful

iron glade
#

¯_(ツ)_/¯

#

What's exactly happening when you run ur code?

ivory sleet
#

@harsh totem are you familiar with maven?

#

Cuz it’s pretty similar to how maven works

harsh totem
#

im not

ivory sleet
#

There should be a tab there (hint the red arrow)

#

Click it and a window should expand

harsh totem
#

I have this

ivory sleet
#

Yes expand shadow

wary harness
#

any one can help how would I store Object to mysql

ivory sleet
#

And run shadowJar

iron glade
#

Is there a way to cancel the creation of a fire at the location a lightning strikes?

wary harness
#

any good example for it

#

I want to turn HashMap to Object and store it to mysql

#

so I can next time read it and loaded it

chrome beacon
#

You would need to serialize that Object

wary harness
#

when server starts up

wary harness
harsh totem
ivory sleet
#

Try the task build instead perhaps

kindred valley
#

Is always while loop kills the server?

harsh totem
#

press build?

ivory sleet
#

It can if it takes too long time to execute limpeex

harsh totem
ivory sleet
#

Although I wouldn’t worry too much unless you do some recursion for instance

kindred valley
#

how can i control something inside of the runnable

buoyant viper
#

its ur code, just do it

ivory sleet
#

Yeah ytg altho have you checked all the orange build folders?

chrome beacon
ivory sleet
#

Pretty sure the jar should be located in one of those

buoyant viper
#

if u run the build task in gradle it should be in build/libs

kindred valley
#

i mean i want runnable to run in a condition, otherwise cancelling

buoyant viper
#

shaded jar and regular iirc

ivory sleet
#

Correct

kindred valley
#

i dont know if it returns the beginning

iron glade
#
Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {

if(...) {
//do stuff
}

                                           }, 20L);```
#

or wdym?

buoyant viper
#

multithreading ezpz just have an atomic boolean that u check in the threads while loop and on ur main thread set that boolean to false when program is exiting

#

😎

undone axleBOT
harsh totem
ivory sleet
#

Hmm try the second one

harsh totem
#

that was the first one i tried

ivory sleet
#

Didn’t work?

harsh totem
#

nothing happened in the server

#

i reloaded ofc

chrome beacon
#

You need Eco. Also don't reload

ivory sleet
#

^

harsh totem
ivory sleet
#

It’s a library

harsh totem
#

for the server or the project

buoyant viper
#

yes

ivory sleet
chrome beacon
#

Ow

lethal python
#

who here is good at sql and relational databases

quaint mantle
#

Any ideas as to why this is returning as null?

if(data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER) == 0) return;```
When I try to do ```java
data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER)```
it returns the pdc value of it, which is 0 but when I try to compare it, it nulls.
keen basin
#

[00:15:40] [Craft Scheduler Thread - 5/WARN]: [TabList] Plugin TabList v5.6.2 generated an exception while executing task 30 java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.PlaceholderAPIPlugin.getInstance()" is null at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:71) ~[?:?] at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:98) ~[?:?] at hu.montlikadani.tablist.utils.variables.Variables.setPlayerPlaceholders(Variables.java:241) ~[?:?] at hu.montlikadani.tablist.utils.variables.Variables.replaceVariables(Variables.java:178) ~[?:?] at hu.montlikadani.tablist.tablist.TabHandler.sendTab(TabHandler.java:256) ~[?:?] at hu.montlikadani.tablist.tablist.TabManager.lambda$addPlayer$0(TabManager.java:54) ~[?:?] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499] at org.bukkit.craftbukkit.v1_18_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) [spigot-1.18.1-R0.1-SNAPSHOT.jar:3443-Spigot-699290c-2c1e499] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?] at java.lang.Thread.run(Thread.java:833) [?:?]

Why i get this error in some plugins
Version: 1.18.1

eternal oxide
keen basin
eternal oxide
keen basin
eternal oxide
keen basin
quaint mantle
eternal oxide
eternal night
#

well seems like your data is not properly persisted

quaint mantle
eternal night
#

wat

quaint mantle
#

Since you set the value type to an int.

#

if(data.get(new NamespacedKey(GioxMC.getPlugin(), "magnet"), PersistentDataType.INTEGER).equals("0")) return;

eternal oxide
# keen basin yes

I can only comment on the error you posted. The plugin is getting a null reference to placeholderapi. That can only happen if placeholderapi failed to load or you ask for the instance too early

keen basin
quaint mantle
#

Cannot compare PDC INTEGER DATA TYPE

#

?paste

undone axleBOT
terse raven
#

which minecraft items look the most like a gun

lethal python
#

retexture

terse raven
#

without retexturing

iron glade
#

What do you guys think would be the best sound effect to play when a player looses hunger?

lethal python
#

mjanko i used to see people use iron horse armor

iron glade
#

that represents like a growling stomach

terse raven
#

yea you can even color leather ones

#

but they just dont feel right

lethal python
#

what about a bass kick

#

minesuchtiiii

#

one of the note block instruments

iron glade
#

How do I play those?

lethal python
#

world.playSound(as, Sound.BLOCK_NOTE_BLOCK_BASS, (float) 0.8, 1);

#

the float is the volume

#

replace as with your player

terse raven
#

minecraft:block.cave_vines.pick_berries

lethal python
#

that's a good one mjanko

lethal python
#

change the 1 to a lower float

#

it's the pitch

#

1 is pretty high

iron glade
#

okay

#

I'll try it 🙂

broken helm
#

Hey, before blindly unloading and deleting a world folder, what are some necessary things I should do?

river oracle
#

idk you should be good to just delete it given you gave no information on any problems

#

it'll just create a new one on start up

broken helm
broken helm
lethal python
#

i have a database with a table of things and i want to keep track of what things a player has visited, how do i do this with database

#

i want to be able to get the list of things a player has visited

eternal oxide
#

depends what those things are

lethal python
#

3 varchars and a bunch of ints

#

and a primary key which is an int called ThingID

iron glade
#

Do I get an error if I remove 2 from a player's food level, but he has only 1 left?

#

Or does it just set it to 0

vocal cloud
eternal oxide
#

you probably need to use a primary key pair. Players uuid and the ThingID

#

then the player can have multiple records but only one for each ID

#

Block is the corner of the block

#

0,0

lethal python
eternal oxide
#

To get on top of the block, in its center Block#getLocation().add(0.5, 1, 0,5);

left swift
#

What is better way for armorstand nametags? via packets or not?

eternal oxide
lethal python
#

how do i do that

eternal oxide
#

players UUID and an array of ThingID

lethal python
#

then how would i select * from Things where ThingID = the ones in the array

#

SELECT * FROM Things WHERE ThingID IN ?

#

mayb

#

i made up that syntax

eternal oxide
#

You select the players record and read the ThingID array in the resultSet

#

you need to know WHO has visited what things

lethal python
#

no i need to know what things a person has visited

eternal oxide
#

Thats what I just said

lethal python
#

u said a different thing

eternal oxide
#

So each player has a record in teh database, it holds the ID's of all the Things he has visited

lethal python
#

yeth

eternal oxide
#

So two tables

lethal python
#

and then what's the sql statement to get the Things that a player has visited from the Things table

eternal oxide
#

one for (UUID, ThingsID[])
one for (ThingsID, any data on the thing)

#

Select ThingsID from table where UUID = playersUUID

#

gets you the array

lethal python
#

no

#

that would not work

#

the Things table doesn't keep player UUIDs

eternal oxide
#

I know, it needs to

#

you need a table to reference what Things a Player has viisted

#

There are two things your database needs to contain....

#

a list of Things and a list of players showing what Things they have visited

#

you are instance checking with == These are Locations you are comparing so use .equals

iron glade
#

Is there a way to spawn those "snow particles" ?

left swift
#

How can I get player body rot?

lethal python
#

the Things don't have a playerUUID

eternal oxide
#

if you want teh Things from the things table you use the join in sql

#

I've never used join when using arrays so I can;t advise you on that

#

Ok I give up. you are not listening

lethal python
#

me?

eternal oxide
#

You want to know what Things a player has visited. This data is to come from your database. So your database must contain TWO things at a minimum. Some way to identify the players (their UUID) and the Things they have visited.

echo basalt
#

Player#getLocation

lethal python
#

yes, there are two tables in the database: a list of Things each containing a ThingID, and a table containing Players, each row containing an array of ThingIDs

eternal oxide
#

ok, so you query the Players table to get their array of ThingIDs

lethal python
#

yes

left swift
eternal oxide
#

Select ThingID from Players where UUID = player.UUID

#

that gives you the array of ThingIDs

lethal python
#

yes

echo basalt
eternal oxide
#

You then want to know what Things those ThingIDs relate too in teh Things table

lethal python
#

yes

eternal oxide
#

Normally you would use the join to tell the SQL query what column to look up the values in the Things table but I've never used an array for that

naive loom
#

im attempting to teleport two players into a world when they join the server, imt eleporting the players i make one of the accounts join and wait 10s later to let the other one join and the first player cannot see the second player while the second player can see the first player.

anyone know how to fix this?

lethal python
#

can you do like SELECT thingID1, thingID2, thingID3 FROM Things?

eternal oxide
#

you could

lethal python
#

:0

#

is that bad to do

eternal oxide
#

if you do it all as one query, no

lethal python
#

yes i build the statement string then query in one go

eternal oxide
#

as I said normally you would join to make teh query simple, but I've no idea how you would do that from an array

lethal python
#

:v

#

hmm

#

would join reduce this to one query

#

instead of 2

eternal oxide
#

yes

lethal python
#

how would join work if we weren't using arrays

eternal oxide
#

if its possible to use an array to join

lethal python
#

is this it

eternal oxide
#

select ThingID from Players where UUID = player.UUID inner join Things on ThingID = Things.id

#

or somethign of that type

crude cobalt
#

Hello everyone. Please tell me how can I push the player in the direction of movement?

eternal oxide
#

setVelocity with a multiple of getDirection

iron glade
#

player.hidePlayer(otherPlayer)

crude cobalt
iron glade
#

use join event and just hide the player who joined to everyone who's online for 10 seconds

eternal oxide
#

Without hiding

naive loom
#

the issue is that when the second player joins he can't see the first player but the first player can see the second one

#

there isn't any coding hiding it since it's only running my custom plugin

iron glade
#

Wait

#

You want to hide the player who joins for 10 seconds to just one specific other player?

eternal oxide
#

I have a vague recollection of a visibility issue like this, but it was way back in 1.7

eternal oxide
naive loom
#

im actually not sure what im running let me check

eternal oxide
#

I guess its possible that bug still existed in 1.8.8

naive loom
#

how did you fix it?

eternal oxide
#

I didn't it would have been an MC/Spigot issue

iron glade
#

Ah you mean that's an issue on your server that the one player can't see the other one?

#

Is there a way to change smoke particle color?

summer mountain
#

Can someone help me with a toggle gui i'm trying to sort, the toggle is currently working.
Its disabled by default, when enabled it will ban if you, if you die. But when dying and then reconnecting (after unbanning) the toggle is reset back to false?
while when I disconnect and reconnect normally this is not the case?

eternal oxide
#

I stopped coding for Bukkit at 1.7 and didn't return until 1.14 ish. So the bug was fixed while I was gone.

dusk flicker
#

Ive ran 1.8.8 for a long time (until recently) and never experienced any issue like that

eternal oxide
#

I remember it happening on laggy server in 1.7

subtle folio
#

is there any fancy way to register all my listeners without having to type them all out?

dusk flicker
#

iirc Redempt has a method for it in their library

naive loom
#

im going to redeploy my docker image with a new spigot jar and see if it fixes the issue

naive loom
subtle folio
dusk flicker
#

That should work for your idea

naive loom
#

^ would use this instead of adding a whole new depend for it

subtle folio
#

I already use redlib in my plugin 😄 thanks

dusk flicker
#

Lol that works then

naive loom
#

yeah that didn't fix the issue

#

wtf

subtle folio
quaint mantle
#

go ask in redempts server

dusk flicker
#

^

subtle folio
#

oops mb

quaint mantle
#

i dmed you the link

maiden vapor
iron glade
#

Is there a way to cancel the creation of fire when a lightning strikes the ground?

crude cobalt
#

I'm building a plugin for my server and want to add an evasion system. How can I make the player push in the direction of travel? not necessarily forward. For example, the player will slant straight ahead, and go obliquely to the right. In this case, the player should be thrown obliquely to the right. And so on. I hope I explained clearly.

maiden vapor
crude cobalt
#

Didn't quite write it right. You're right. But the question is the same. How can i do this?

eternal oxide
#

if you want to throw them to the left or right, Player#getLocation().getDirection() gives you the vector in which they are traveling. Vectors have a set of rotate methods. Rotate the vector, then apply it to the players velocity

maiden vapor
#

Won't getLocation().getDirection() return where the player is facing rather than where they are moving?

eternal oxide
#

only if you use getEyeLocation()

crude cobalt
#

I understood that, but when should I change the vector? How can I understand that the player is moving in the right direction?

eternal oxide
#

When you want them to "dodge" is up to you

#

after all, what is the "right direction"?

crude cobalt
#

Oh right, I got it. I recently started creating plugins, so I don't understand everything. Could you write it in code if you don't mind?

pulsar yarrow
#

Hello, I'm looking to import craftbukkit with maven in 1.18.2 for an hour. I can't find the maven dependency. Could someone help me? Thanks in advance ^^ !

maiden vapor
#

Really depends on when you want them to do the dodge.

maiden vapor
crude cobalt
#

When to perform evasion I have already done. Now i need to understand how should i change movement with getDirection and its rotation

pulsar yarrow
#

I tried this but it doesn't work

<dependency>
    <groupId>org.bukkit</groupId>
    <artifactId>craftbukkit</artifactId>
    <version>1.18.2-R0.1-SNAPSHOT</version>
    <scope>provided</scope>
</dependency>
eternal oxide
#
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.18.2-R0.1-SNAPSHOT</version>
            <scope>provided</scope>```
#

?bt

undone axleBOT
pulsar yarrow
#

Okay so if I add the spigot jar with maven, no need for CraftBukkit as a dependency?

eternal oxide
#

correct

#

BUT you have to run BuildTools as CraftBukkit is the implementation not API

pulsar yarrow
#

Okay, I'll try it out, thanks!

maiden vapor
eternal oxide
#

if you use getVelocity() over getDirection, it will be better

#

I was just looking it up

pulsar yarrow
eternal oxide
#

Did you run Buildtools?

pulsar yarrow
#

Yes

eternal oxide
#

for 1.18.2?

pulsar yarrow
#

Yes

eternal oxide
#

?paste teh buildtools.log

undone axleBOT
pulsar yarrow
#

After building spigot 1.18.2, in the "project structure" panel of intellij I added the jar as a library. Is that what I needed to do?

eternal oxide
#

no

#

you are using maven

pulsar yarrow
#

Yes

eternal oxide
#

you don;t add jars

#

and you don;t build spigot in inteliJ

#

remove the manually added jar

pulsar yarrow
#

Okay

eternal oxide
#

let maven find the dependencies from yoru local maven cache

pulsar yarrow
#

Dosen't work 😅

eternal oxide
pulsar yarrow
eternal oxide
#

it will only throw the player a short distance. You can multiply the velocity after to achieve what you want

eternal oxide
pulsar yarrow
eternal oxide
#

show me your buildtools log

pulsar yarrow
#

Can I send it to you in mp?

eternal oxide
#

?paste

undone axleBOT
eternal oxide
#

it should fit

pulsar yarrow
#

(I tried to copy it to the site but it doesn't work, it's too big 😭)

#

The chrome tab is no longer responding 😭

iron glade
#

lmao

eternal oxide
#

paste teh last 50 or so lines then

pulsar yarrow
#

Ok

lethal python
#

for (HumanEntity p : event.getClickedInventory().getViewers()) p.closeInventory();
this is line 44 in this stack trace:

[01:51:49 ERROR]: Could not pass event InventoryClickEvent to Waystones v1.0-SNAPSHOT
java.util.ConcurrentModificationException: null
    at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:1013) ~[?:?]
    at java.util.ArrayList$Itr.next(ArrayList.java:967) ~[?:?]
    at website.callens.waystones.WaystoneGUIclickEvent.onClickGUI(WaystoneGUIclickEvent.java:44) ~[waystones-1.0-SNAPSHOT.jar:?]
    at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor3.execute(Unknown Source) ~[?:?]
#

im just trying to close an inventory for anyone looking at it

pulsar yarrow
#

I'm going to go crazy I have a haunted file 😭 it won't copy and paste 😭 😭

eternal oxide
#

you are iterating over the viewers and removing them at the same time

lethal python
#

:v fundamental programming error

maiden vapor
iron glade
#

How would I cancel a player to remove his helmet?

eternal oxide
#

clear caches and restart Intelij

lethal python
#
for (HumanEntity p : inv.getViewers()) p.remove();
#

so this

subtle folio
#

Hello friends, This error confuses me as I get the Player's uuid and then try to convert it from a string to a uuid object, ```java.lang.IllegalArgumentException: Invalid UUID string: d2698c41e5fb4dc98e887f8d524c9545

at java.util.UUID.fromString1(UUID.java:280) ~[?:?]

at java.util.UUID.fromString(UUID.java:258) ~[?:?]```
pulsar yarrow
lethal python
#

how can i find the keys which map to a specific value in a map

subtle folio
humble tulip
#

Think there are dashes every 8? Characters

maiden vapor
subtle folio
eternal oxide
#
Iterator<HumanEntity> iter = player.getInventory().getViewers().iterator();
        
while (iter.hasNext()) {
    iter.next().closeInventory();
}```
lethal python
humble tulip
pulsar yarrow
subtle folio
pulsar yarrow
humble tulip
eternal oxide
subtle folio
pulsar yarrow
eternal oxide
#

ok

#

?paste your current pom

undone axleBOT
pulsar yarrow
#

Okay

lethal python
#

how do i get all keys which map to a value in a map

eternal oxide
#

use a BiMap

iron glade
#

Iterate over all of them and check if they have the value you want?

vocal cloud
#

Usually I find when people have that issue they need to reverse their map

lethal python
#

how do bimaps work

vocal cloud
#

both sides are unique keys

eternal oxide
#

ah true, so no good for his purposes

pulsar yarrow
eternal oxide
#

all is fine, except for yoru java version

pulsar yarrow
#

Okay

eternal oxide
#

its in your .m2 so it shoudl be picked up. fix your java version as it requires at least java 17 for 1.18 I bleieve

pulsar yarrow
#

my .m2 ?

subtle folio
# humble tulip Yeah

not the best implementation but ```java
UUID = insertString(UUID, "-", 8);
UUID = insertString(UUID, "-", 13);
UUID = insertString(UUID, "-", 18);
UUID = insertString(UUID, "-", 23);
return UUID;

// https://www.geeksforgeeks.org/insert-a-string-into-another-string-in-java/
public static String insertString(String originalString, String stringToBeInserted, int index) {
String newString = new String();
for (int i = 0; i < originalString.length(); i++) {
newString += originalString.charAt(i);
if (i == index) {
newString += stringToBeInserted;
}
}
return newString;
}```

eternal oxide
#

thats your local maven repository

humble tulip
#

java.util.UUID.fromString( "5231b533ba17478798a3f2df37de2aD7" .replaceFirst( "(\p{XDigit}{8})(\p{XDigit}{4})(\p{XDigit}{4})(\p{XDigit}{4})(\p{XDigit}+)", "$1-$2-$3-$4-$5" ) ).toString()

subtle folio
#

welp thats great

#

too bad im not doing it cooldoge

humble tulip
#

Lol

pulsar yarrow
eternal oxide
#

you don;t goto your .m2

#

it just stores everything you set as a dependency

pulsar yarrow
#

Ok

eternal oxide
#

and you ran Buildtools so spigot 1.18.2 is in there too

#

just your InteliJ says it can;t see it

pulsar yarrow
#

I did not launch build tool with intellij

#

Do you think that's where it came from?

eternal oxide
#

no

pulsar yarrow
#

Okay

eternal oxide
#

In fact the only thing I see wrong in yoru setup now is your java version

pulsar yarrow
#

Okay

eternal oxide
#

It shoudl be showing up

pulsar yarrow
#

But it's not possible, where can it come from 😭 ?

iron glade
#

does .clone() on an ItemStack also clone Enchantments, etc?

eternal oxide
#

isn;t there a refresh button in teh maven tab of InteliJ?

#

I don;t use InteliJ so don;t know my way around it

maiden vapor
pulsar yarrow
iron glade
lethal python
#

i just tried creating then deleting a bunch of stuff from my h2 database but it just made the database bigger

eternal oxide
pulsar yarrow
#

Oh, ok....

iron glade
#

Is it "player will fall from the sky" or "player is going to fall from the sky" ?

eternal oxide
#

depends on the context, but both are grammatically correct

iron glade
#

context is that a player executes a command which let's the target fall from the sky and then the executer gets the message

eternal oxide
#

I'd probably use the first then

iron glade
#

okay thanks

#

are you a native english speaker?

eternal oxide
#

yes

iron glade
#

man I envy you

eternal oxide
#

UK, so queens English. Not this American butchered stuff 🙂

#

Colour has a U in it!!

iron glade
#

xD

#

Is it "recognize" or "recognise" ?

#

My teacher always said he doesn't care, just take one of them haha

elfin tusk
#

I was wondering if there was a better way to do the following code in order to return a text component as a string?

@Override
protected String[] get(Event event, Advancement[] source) {
  List<String> titles = new ArrayList<>();
  for(Advancement advancement : source)
    titles.add(advancement.getTitle().getText());
  return titles.toArray(new String[0]);
}
eternal oxide
#

S for UK English. Z for American

iron glade
#

ahhh okay

river oracle
#

wait what

eternal oxide
#

Sorry reverse

river oracle
eternal oxide
#

most things are S for UK. Z for US. I've been in here too long

river oracle
#

oh i was like idk if I've ever used an S for regonize

eternal oxide
#

fixed 🙂

#

You could just use a Dictionary site. It will actually tell you the US and UK spelling

#

How good is that teh Cambridge Dictionary, a UK bases group defaults to the US spelling 😦

elfin tusk
#

Why thank you :)

lethal coral
#

any reason why we're talking about the dictionary?

desert loom
iron glade
eternal oxide
#

Just grammatical decisions in text for plugins

elfin tusk
flint carbon
#

Hey I wanted to see if I can get some help..

Item 1
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-2026970914,-1921432084,-1200622279,1699038057],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}

Item 2
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-475614964,2137867341,-2074071497,-1007955428],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}

I'm spawning items from thin air with custom heads (like hypixel bedwars generators, but with custom heads), but the ID is different every single time

iron glade
#
Item 1
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-2026970914,-1921432084,-1200622279,1699038057],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}

Item 2
{PublicBukkitValues:{"loot:_loot":80L},SkullOwner:{Id:[I;-475614964,2137867341,-2074071497,-1007955428],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzA4ZTI3NzY4NDJiZGZkNmZhM2JhN2Q2NTRmNmZkNmFiMWFjZDg3ODQ3NTNkZmUyZThjNDk5YmNmZDFlZWQifX19"}]}},display:{Lore:['{"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Drop Info:"}],"text":""}','{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"? "},{"italic":false,"color":"white","text":"Sells for "},{"italic":false,"color":"aqua","text":"$80"}],"text":""}'],Name:'{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"white","text":"Ant-Man Loot"}],"text":""}'}}```
maiden vapor
#

What code are you using?

flint carbon
iron glade
#

I have no idea, I guess i'm the wrong person to ask

eternal oxide
#

Those two items are showing the same skin but different accounts

#

I'm going to guess they are being pulled from some website

river oracle
#

My guess would be a base64 String to create the skull texture with random UUID generation could be why they aren't stacking properly

#

instead of generating a new skull every time just save one into memory and reuse it

flint carbon
#

yes they are base64 configurated with "CUSTOMHEAD:<base64 id>"

flint carbon
river oracle
#

I mean you could, but not a real reason to unless you want to

#

again I reccomend just saving it into memory and reusing it if you want them to stack

flint carbon
#

Just trying to figure out how to do what you are saying

river oracle
#

use a variable

#

lol

iron glade
#

Is there a sound effect that sounds like a "whoosh" or like a wind blow?

river oracle
#

not that I know of, but you could probably add your own sound effects with a texture pack if you'd be interested in that

iron glade
#

Hm that's something I definitely wanna do at some later point, for now it's enough finding a sound that sounds somewhat similar

tranquil viper
#
java.lang.NoClassDefFoundError: com/mongodb/client/MongoClients
        at xyz.praydev.BorderSMP.registerDatabase(BorderSMP.java:99) ~[BorderSMP-1.0.jar:?]
        at xyz.praydev.BorderSMP.onEnable(BorderSMP.java:67) ~[BorderSMP-1.0.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:541) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:560) ~[paper-1.18.2.jar:git-Paper-349]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:474) ~[paper-1.18.2.jar:git-Paper-349]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:664) ~[paper-1.18.2.jar:git-Paper-349]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:431) ~[paper-1.18.2.jar:git-Paper-349]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:316) ~[paper-1.18.2.jar:git-Paper-349]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1163) ~[paper-1.18.2.jar:git-Paper-349]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:315) ~[paper-1.18.2.jar:git-Paper-349]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.ClassNotFoundException: com.mongodb.client.MongoClients
        at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:151) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:103) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
        ... 13 more
#

Anyone know how to fix this on startup?

tranquil viper
#

I did though

river oracle
#

you sure about that mate

tranquil viper
river oracle
#

doesn't look very shaded to me ASlaugh

tranquil viper
#

Unless I broke it, I copied it from a de-compilation of an old project

river oracle
#

why is it marked as provided

tranquil viper
#

Not sure, thats what fixed it last time

#

This time not so much

#

I'll try shading again

river oracle
#

dude

#

its provided you can compile it all you want

#

nothing will change

tranquil viper
#

?

river oracle
#

your error

       <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongodb-driver-sync</artifactId>
            <version>4.5.1</version>
            <scope>provided</scope>
        </dependency>```
#

just delete the scope provided

#

it will then shade

tranquil viper
#

Ah

river oracle
#

by saying its provided maven basically is like aight you already got it bet my pal

#

and won't shade it

tranquil viper
#

Alright cool thanks, I never really learned maven just how to get it up and running

#

When I compile, a shaded .jar doesn't appear?

eternal oxide
#

its all in that jar

tranquil viper
#

Interesting, in the past when I've shaded it makes 3 .jars and one of them is the shaded one.

fallow violet
#

^

tranquil viper
#

Still getting the same error.

glass mauve
#

what should I use to run smth x amount of times with a delay of y after each run

tranquil viper
#

A task

#

More specifically a scheduleSyncDelayedTask();

glass mauve
#

thanks

tranquil viper
#

nws

lethal python
#

how do i play a sound for only one player

iron glade
glass mauve
#

Im not sure

iron glade
#

"Play a sound for a player at the location.
This function will fail silently if Location or Sound are null."

glass mauve
#

Play a sound for a player at the location of the entity.

#

"at the location" maybe others also hear it if near

terse raven
#

is there any method to detect a player holding down left click, other then constantly placing a ball of ghost blocks around the player?

iron glade
#

why ghost blocks?

#

check if he's left clicking on air or smth

terse raven
#

yea but then it only fires once

flint carbon
terse raven
#

when he start clicking

#

i want to detect if he is currently clicking or not

#

/ if he is holding it down

iron glade
#

Is there a pdc for blocks?

terse raven
#

a what

limber mica
#

how can I check for a status 404 in a json?

iron glade
#

persistent data container

terse raven
#

yea

terse raven
limber mica
#

The json returns a 404 it caches it

terse raven
#

you mean you want to detect if you receive a {"status":404}

#

or what exactly?

limber mica
#

yes

terse raven
#

json.getAsJsonObject().get("status").getAsJsonPrimitive().getAsInt() == 404

buoyant viper
earnest forum
#

blocks have pdc

#

pdc is just nbt

earnest forum
#

with a fancy name

buoyant viper
#

well yeah but iirc blocks dont have an exposed pdc impl

#

like if i import spigot-api and try to get the pdc of a block there isnt a method p sure

cedar laurel
#

If a plugin makes a request to a random site, can I use a separate plugin to cancel that request?

I was seeing that the AutoSaveWorld plugin can monitor the requests that a plugin makes to sites out there

#

[AutoSaveWorld] Plugin mcMMO attempted to establish connection https://site.com/endpoint in main server thread

terse raven
lethal python
#

i am trying to find out if there are any entities in a 1x2x1 (xyz) volume using this code if (!world.getNearbyEntities(relative_block.getLocation().clone().add(0.5, 1, 0.5), 1, 2, 1).isEmpty()) return; but isn't working right, it's checking some other area

flint carbon
#

Y2K are you active?

tender shard
#

if a block gets moved by a piston etc, you have to take care of that yourself

iron glade
#

Does anyone know why this still teleports me into the block and not on top of it?

Location oneUp = target.getLocation().clone().add(0, 10, 0);
Location ground = oneUp.subtract(0, 2, 0);
target.getWorld().getBlockAt(ground).setType(Material.BARRIER);
target.teleport(oneUp);```
terse raven
#

add a clone

#

when you define ground

iron glade
#

ah you mean oneUp.clone().subtract... ?

terse raven
#

yes

iron glade
#

I try

#

Is there a command to remove all blocks with a specific material in the world?

#

Cause I used barriers which turn invisible after some time..

iron glade
#

So, how do I access a blocks pdc?

glass mauve
#

is there a class like java.awt.Point, which also got width and height? If not you have any naming ideas lmao

earnest forum
#

vector2?

tender shard
#

X and Y

#

how many dimensions do you need

glass mauve
#

yea and I want to store width and height so its probably a rectangle :D

#

I found a name lmao

glass mauve
tender shard
#

width and height is still only two dimensions

#

so why not just use the point?!

glass mauve
#

bc I need to store width and height

tender shard
#

?

#

are you trolling or sth lol

glass mauve
#

???

#

a point doesnt have width and height

tender shard
#

bruh

#

a point is an object that stores 2 dimensions in a 2 dimension coordinate system

#

and that's what you need

#

a point doesn't know whether you call "x" "height"

#

you can freely use a "point" and use the "x" as "width" or as "age"

#

it doesn't care about that

#

a point is merely an object that stores two numeric values

glass mauve
#

no you are wrong, wait

tender shard
#

and whether you use them for height or width or length or age, noone cares

tender shard
#

A point representing a location in (x,y) coordinate space, specified in integer precision.

glass mauve
#

thats what I mean and yea thats a rectangle

tender shard
#

ooooh

#

I know what you mean

#

you want to save two points

#

the starting and end point

glass mauve
#

no I just want the top left corner and the width and height

tender shard
#

then create your own datatype

buoyant viper
#

^

glass mauve
#

yea

tender shard
#

then just do it?

glass mauve
#

thats what Im doing it

tender shard
#

good

glass mauve
#

but I needed a name and I was too stupid to come up with "rectangle" lmao

glass mauve
tender shard
#

yeah I know what you mean

#

I'd call it "region"

#

or "boundingbox"

#

but BoundingBox already exists in spigot and it has 3 coords

#

X,Y,Z

glass mauve
#

ok thanks :D

tender shard
#

but yeah you do not need to store "origin", "width" and "length". You just need two points: "corner1" and "corner2"

glass mauve
#

probably should use a record for that

glass mauve
#

I think its also easier to use

tender shard
#

if you want it to be mutable, then you cannot use records

glass mauve
#

yea you are right

tender shard
#

no you

#

are

#

fabulous

iron glade
#

I want to save multiple locations from a player, is there something better than java HashMap<UUID, HashMap<UUID, Location>> ?

tender shard
#

why two maps?

#

Map<UUID,List<Location>>

glass mauve
#

isnt there a multimap

tender shard
#

yes but that's for sth else

iron glade
#

I forget that lists exist sometimes lmao

glass mauve
tender shard
glass mauve
#

yea ik

#

but why is MultiMap for smth else?

tender shard
#

oh yeah my bad

#

you can use a multimap

iron glade
#

which of the 2 options do you recommend?

glass mauve
tender shard
#

I'd use the Map<UUID,List<Location>> because it doesn't require any libs

glass mauve
#

MultiMap is not included in Java

tender shard
#

Multimap is only available in guava, isn't it?

glass mauve
#

yea

tender shard
iron glade
#

right

#

aight then the list it is

#

ty guys

tender shard
#

a multimap is probably the better way but yeah maybe SOMETIME spigot would remove guava so

#

if you can do it without a library, better do it without a library

real marlin
#

ight

glass mauve
#

its also called Multimap and not MultiMap 😭

tender shard
#

yeah very weird

#

why didn't they call it MultiMap

#

it's weird lol

glass mauve
#

idk its so unsatisfying

tender shard
#

another reason not to use it lol

glass mauve
#

yea

#

maybe it got some performance boosts

tender shard
#

probably

glass mauve
#

One thing to notice here is that, although we have a list that has two elements in it, size() method returns 1. In Multimap, size() returns an actual number of values stored in a Map, but keySet().size() returns the number of distinct keys.

tender shard
#

ugh I'd actually consider that a total downside

#

but that of course depends

#

just use whatever you think is better for your needs

glass mauve
#

yea, tbh I never used it :D

tender shard
#

I definitely would just use a plain Map<UUID,List<Location>>

glass mauve
#

yea

#

Im so bad at naming stuff ._.

#

I need to store a location for an Icon on an image and then I need to store a location for that Icon on a texture, where its from ._. and im completely lost :D

iron glade
#

?paste

undone axleBOT
iron glade
glass mauve
#

so I would use grounds.forEach method and I would change this:

if(locations != null) {
    for(Location toDelete : locations) {
        if(toDelete != null) {
            p.getWorld().getBlockAt(toDelete).setType(Material.AIR);
        }
        
    }

}

to this:

if(locations.isEmpty()) {
  return; // if void
}

locations.forEach(location -> {
  if(location != null) {
    // do stuff
  }
});
#

@iron glade

iron glade
#

thanks!

glass mauve
# iron glade thanks!

I would also change this:

p.getWorld().getBlockAt(toDelete).setType(Material.AIR);
```to:
```java
location.getBlock().setType(Material.AIR);
iron glade
#

Or did I mess up smth now

glass mauve
#

why this SkyliftCommand.grounds.? just do grounds. or is grounds static?

iron glade
#

yes it's static

glass mauve
#

👍

iron glade
#

forgot to remove it from the copy paste

#

thanks for your help you 2 :=)

glass mauve
#

:D

iron glade
#

Why does it spam the console saying player moved too quickly when I teleport them?

blazing rune
#

Uh

glass mauve
#

how are you teleporting him? with the vanilla command?

blazing rune
#

Intellij is being difficult and not downloading vault

#

I'm using maven to do it

#

[04:30:48 ERROR]: Could not load 'plugins/TestPlugin-1.0.jar' in folder 'plugins' org.bukkit.plugin.UnknownDependencyException: Unknown/missing dependency plugins: [Vault]. Please download and install these plugins to run 'TestPlugin'. at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:290) ~[patched_1.17.1.jar:git-Paper-411] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.loadPlugins(CraftServer.java:419) ~[patched_1.17.1.jar:git-Paper-411] at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:287) ~[patched_1.17.1.jar:git-Paper-411] at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1220) ~[patched_1.17.1.jar:git-Paper-411] at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:319) ~[patched_1.17.1.jar:git-Paper-411] at java.lang.Thread.run(Thread.java:833) ~[?:?]
This is the error

glass mauve
#

try and look if it logs moved to quickly when you use vanilla teleport

blazing rune
#

`<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>com.github.MilkBowl</groupId>
        <artifactId>VaultAPI</artifactId>
        <version>1.7</version>
        <scope>provided</scope>
    </dependency>

</dependencies>`

#

I hav the repository and dependency implemented

glass mauve
blazing rune
river oracle
#

I bet you 50 bucks irs not on your server though lmao

#

If it was it'd work

blazing rune
river oracle
blazing rune
#

Its something wrong with the plugin

river oracle
#

Bro

blazing rune
#

DOWNLOADED

glass mauve
#

you need to download Vault and put it in your plugins folder

#

do it

blazing rune
#

Bru

#

I did

glass mauve
#

show

river oracle
#

It legit says it's not in the stack trace idk what to say

blazing rune
#

I can't ss here

river oracle
#

So I can guarentee you vault isn't in the plugins folder

river oracle
#

If it is restart your server and it should work

blazing rune
#

Ok

#

I'll restart

glass mauve
#

the error literally says that you dont have Vault installed

river oracle
#

^ idk what else to say lmao besides you don't have it

blazing rune
#

I-

#

Okok

#

Whatever

#

I'll figure it out

glass mauve
#

?

river oracle
#

It's not in your plugin folder it's a dependency but vaulr legit can't be in your plugjns folder

river oracle
#

You download the plugin and plop it in

blazing rune
glass mauve
#

like this: Server->plugins->Vault and Server->plugins->YourPlugin

iron glade
glass mauve
#

yea its a vanilla problem

iron glade
#

does it cause any problems beside spamming the console?

glass mauve
#

no

iron glade
#

Alright, then I just have to ignore it I guess

glass mauve
#

maybe if you got any AntiCheat plugins on the same server, but idk

iron glade
#

hm

#

Is there a way to pause a scheduler task?

#

and resume it at some later point

earnest forum
#

not really

#

u can just make it not run when a certain condition is met

glass mauve
#

idk, but you can stop it and start another one later

earnest forum
#

or that

vocal cloud
#

You'd either need to write your own impl or stop and start it as squid said

earnest forum
#

new BukkitRunnable{
  @Override
  public void run() {
    if (runnableIsPaused) return;
  }

}
vocal cloud
#

yeah but that's an ugly way to do it

earnest forum
#

it is

worthy yarrow
#

So instead of using normal water around a spawn area, how would I write something to cancel fall damage for players in relation to a faction's claim.... (Using saber facs, might have to be a dependency)

earnest forum
#

?jd-s

undone axleBOT
worthy yarrow
#

Do you think I'd have to use saber as a dependency?

earnest forum
#

listen to entity damage event, check if last damage cause is fall damage and if so cancel the event

vocal cloud
#

well unless you know all the claims beforehand you'd need to figure out when a player is in a zone somehow

worthy yarrow
#

And if my plugin is dependent on saber can I get the zones as defined within saber?

vocal cloud
#

probably? Read their docs to find out

worthy yarrow
#

I'm not sure if they have any but I'll look

earnest forum
#

it depends on how saber's coded

#

if there isnt any docs you could decompile the plugin and figure out how its done

iron glade
#

I have a repeatingTask runnable that stops when a player leaves but doesn't resume when he joins back

earnest forum
#

yes because you canot pause or resume a runnable

#

you can only start or stop

worthy yarrow
#

I suppose, thank you for the help I'll send for more help if needed

iron glade
#

that's how it "stops" when the player leaves

earnest forum
#

player changes whenever u leave and rejoin

iron glade
#

shouldn't it automatically run again as soon as he joins back?

earnest forum
#

when a player leaves

#

a new object is created

vocal cloud
#

so it keeps checking even if the player leaves?

iron glade
#

so I'd compare the UUID instead

earnest forum
#

yes

#

actually no

#

that wouldnt work

iron glade
#

and completely stop it when he leaves

#

and remove the useless player != null check

earnest forum
#

yes

iron glade
#

I guess that's the cleanest way to do it

#

without having it run in the background

vocal cloud
astral atlas
#

Thank

worthy yarrow
#

I tried to make this MobEffect plugin yesterday and have been testing making tweaks, still can't get it to work... any idea why? ```
static final EntityType SPIDER = EntityType.SPIDER;
@EventHandler
public void MobHitEvent(EntityDamageByEntityEvent e) {
if (e.getEntity() instanceof Player) {
Player player = (Player) e.getEntity();
if (e.getEntity().getLastDamageCause().equals(SPIDER)) {
player.sendMessage(ChatColor.DARK_RED + "You have been given poison from the spider bite!");
player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 8, 1));

glass mauve
#

is there a way to debug/test your code?

worthy yarrow
#

test server

glass mauve
#

yea, but I mean debugging where you can see variable values with breakpoints etc

worthy yarrow
#

Most hosts should send you a numbered java line where a piece of code went wrong if thats what you're asking

glass mauve
#

but I dont get an error :D

worthy yarrow
#

Well then debugging is going to be a complete bitch

#

I'm not aware of anything you could use to test the code other than a test server and if you don't get an error, which is the problem I'm having, it's really hard to find what is wrong

glass mauve
#

yea, I cant test a few classes with just prints in console

worthy yarrow
#

I suppose that could work, it just seems like you could only go so far with testing what needs to be tested, as in, if you have player only related conditional statements

#

or something along those lines

#

things you cant necessarily test with console prints

glass mauve
#

yea

worthy yarrow
#

I would just keep that in mind

worthy yarrow
glass mauve
#

getLastDamageCause returns EntityDamageEvent

worthy yarrow
#

How should I define the player getting hit by a spider?

glass mauve
#

try e.getDamager().equals(SPIDER)

earnest forum
#

from the damage event

glass mauve
#

I think he wants to check if the damager is a Spider

earnest forum
#

a specific spider or just a spider?

worthy yarrow
#

So like if (e.getEntity().getLastDamageCause().getCause().equals(SPIDER))

#

any spider

earnest forum
#

get cause might have a damager

#

field

bright jasper
#

To implement gun recoil right now I teleport the players head up a certain distance by taking current pos and adding to pitch and yaw. It's really choppy and buggy though when moving at the same time. Is there a way to mitigate that?

earnest forum
#

try do .getDamager() or something

glass mauve
earnest forum
#

what is the actual event

#

ur using

#

entitydamagebyentity?

earnest forum
#

yeah just use e.getDamager().getType()

glass mauve
#

btw that is paper documentation

#

so could be wrong

worthy yarrow
#

Cannon resolve method getDamager

earnest forum
#

its fine

glass mauve
earnest forum
worthy yarrow
#

if (e.getDamager().equals(SPIDER)) gives no errors, is this how I should have it?

#

and yes, yada0

glass mauve
#

getType

glass mauve
worthy yarrow
#

got

earnest forum
#

EntityType.SPIDER

worthy yarrow
#

it

earnest forum
#

its an enum