#help-development

1 messages · Page 1903 of 1

quiet ice
#

If you use paper, use the slf4j logger, it is far better than any other logger

#

Sadly bukkit does not directly expose it

#

(though you can just copy&paste the method that obtains the logger, it should work the same regardless)

boreal sparrow
#

how do u change gamemode

opal juniper
#

the sout catcher is good

tardy delta
opal juniper
#

stops stupid plugins printing error messages without you knowing where from

boreal sparrow
#

thnx

opal juniper
#

anyways you can disable it

#

-Dio.papermc.paper.suppress.sout.nags=true

boreal sparrow
#

in setgamemode() what comes in ()

quiet ice
#

?jd

quiet ice
#

Read the documentation

opal juniper
#

GameMode.X

boreal sparrow
#

ok thank

tardy delta
boreal sparrow
#

ex. creative?

opal juniper
#

yes

tardy delta
#

Gamemode.CREATIVE i guess

opal juniper
boreal sparrow
#

thanks

opal juniper
#
public static long getChunkKey(final Chunk chunk) {
    return ((long)chunk.getX() < 32) | (chunk.getZ() & 0xFFFFFFFFL);
}

This returns a chunkkey for an x&z coord but is there a way to include the world?

quiet ice
#

Not without using BigDecimal or something like that

tardy delta
#

<<?

opal juniper
#

or cast it to a string and concatenate the name of the world 😈

white frost
#

Exception Connecting:NativeIoException : readAddress(..) failed: Connection reset by peer

How to repair it?
Bungee latest version
Spigot latest 1.8.8 + ViaVersion

opal juniper
#

latest 1.8.8

onyx fjord
#

latest 1.4.6

white frost
#

newest 1.8.8 mc version on spigot

tardy delta
#

add the hashed world name?

white frost
#

last patch

onyx fjord
white frost
#

its for lobby

onyx fjord
#

then fix it yourself

quiet ice
#

Then use cuberite, supports 1.8 - 1.12 --- no plugins needed!

white frost
#

but 1.18 doesnt support 1.17 in ViaVersion

onyx fjord
#

viabackwards exists

opal juniper
onyx fjord
#

mr adrian

white frost
#

oh

#

okay

quiet ice
#

Which is equally cursed but eh

opal juniper
onyx fjord
#

we all know you are adrian nowak żalno

#

@white frost

boreal sparrow
#

cancel player hunger (they should not be able to regen just not run out of sprint)

tardy delta
#

are you a cat object?

quiet ice
#

@opal juniper You could reduce the amount of bits used to store the x/z coords and use it to store a hashed version of the UUID, but you will only have access to like 6 or so bits for that (if you do not make use of compromises), so eh

boreal sparrow
#

thanks

white frost
#

im too

onyx fjord
#

how do u know

#

did u doxx me

#

😂

quiet ice
#

The european axis is strong with spigot

white frost
#

i downloading 1.18.1 and check if works

white frost
onyx fjord
#

where do you download 1.18 from, just curious

lost matrix
#

?bt

undone axleBOT
onyx fjord
#

@white frost did the bot delete your message?

quiet ice
#

If you downloaded your 1.8 version from the source I think you downloaded it from, you might have been running a server with a critical security exploit

onyx fjord
#

then it means that site is malicious

#

dont use it

#

?jar

undone axleBOT
#
"Cant you just send the Spigot jar?"
  No, we can't. It's illegal to distribute Mojang code, meaning that you have to use BuildTools to build the Spigot jar.
onyx fjord
#

running buildtools is as easy as running the server

quiet ice
#

Or well, not malicious malicious, just that noone can truely verify whether it is safe to use

onyx fjord
#

just takes a bit of time

quiet ice
#

I ran a bytecode differential on the jars and there were no notable differences outside of a few lambda names being different

#

Just once though

onyx fjord
#

¯_(ツ)_/¯

quiet ice
#

So I cannot say that all are not malicious, just that a single jar from a single provider was clean (except if it used exploits in the zip protocol to hide some classes)

peak gulch
#

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 1 java public static void createRole(String id,String role , Integer position,String prefix , String sufix) throws SQLException { Bukkit.getLogger().info(position.toString()); PreparedStatement date = connection.prepareStatement("INSERT INTO rolemanager(id,name,position,prefix,sufix)" + " VALUES (? , ?, ?, ?, ?)"); date.setString(1,id); date.setString(2,role); date.setInt(3,position); date.setString(4,prefix); date.setString(5,sufix); date.executeUpdate(); } whats wrong?

quiet ice
#

Did you define the command in the plugin.yml?

boreal sparrow
#

how do i change gamemode of player in a playerevent (death event to be specific)

quiet ice
#

I'd use player respawn event

boreal sparrow
#

hmm good idea

quiet ice
#

though idk if it makes a difference

boreal sparrow
#

nah

#

the thing is that gamemode change is non static so help lmao

hollow bluff
boreal sparrow
#

hmm ill try

worldly ingot
#

stitchWhat event.getEntity().getPlayer() is redundant. If you can call getPlayer(), you probably have a Player

boreal sparrow
#

isnt there a way to change player gamemode on death/respawn

real palm
#

Hey everyone 👋

I need some help regarding BuildTools.

The console showed me, when powering up the server, my current build is outdated. Thought, fine, time to update.
After building the new Jar, BuildTools ran into issues while compiling the code I guess.
So I deleted the BuildTools.jar and re-downloaded it, gave it the appropiate permissions which needs it and re-ran it again. Same issue.
Error with compiling.

The Log is here: https://pastebin.com/kAZSw6pK

TIA Newt

quiet ice
#

do what?

#

PluginMessagingChannels

ornate heart
#

Re-wrote some of the conversation api stuff to my liking. Is this considered "clean" or is it overengineered?

quiet ice
#

looks good to me

boreal sparrow
#

@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent event){
kills = kills + 1;
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
onlinePlayer.sendMessage(ChatColor.RED + "The Hunter Now Has " + kills + " Kills!");
onlinePlayer.playSound(onlinePlayer.getLocation(), Sound.ENTITY_ENDERMAN_DEATH,100000 ,1);
}
}

#

is something wrong

#

becuase no work lmao

chrome beacon
#

You can't compare strings like that

#

Also don't use name to identify your inventory

woeful moon
#

I have a Long which stores a time in milliseconds:

Long test = 360000L;

And I'm trying to print it in HOURS:MINUTES:SECONDS format.
I've tried this:

String hours = String.valueOf(TimeUnit.MILLISECONDS.toHours(test));
String minutes = String.valueOf(TimeUnit.MILLISECONDS.toMinutes(test));
String seconds = String.valueOf(TimeUnit.MILLISECONDS.toSeconds(test));
player.sendMessage(hours + "H " + minutes + "M " + seconds + "S");

but it doesn't subtract hours from minutes and minutes from seconds, so it'll say "1 hour 60 minutes 3600 seconds" (example) instead of "1 hour 0 minutes 0 seconds". Any ideas?

real palm
#

Perhaps doing it over the SimpleDateFormat and a custom Datestamp? 🤔

woeful moon
real palm
#

like

SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String dateTime = sdf.format(new Date(test));```
boreal sparrow
#

if i want an event player's name in a death message how would i do it

real palm
#

yeah, right ^^ I know, but assuming that string is 0 with 01.01.1970 00:00:00 and 360000 is 01.01.1970 01:00

buoyant viper
real palm
boreal sparrow
#

thnx

real palm
#

more like event.getView().getTitle().equalsIgnoreCase("your String to compare")) {

boreal sparrow
#

event.setDeathMessage(Player.getName(); + " was shot by hunter!");
hmm how do i do this in a death event

buoyant viper
woeful moon
#

(it should be 0 hours 4 minutes 57 seconds)

real palm
#

Well, I need your code completely, so I can actually see, what you want t do 🤷‍♂️

woeful moon
#

mine?

real palm
#

sativa's issue

boreal sparrow
#

lmao how make custom death message

#

with player name

real palm
#

show me your code

#

check the message I was refering to

buoyant viper
#

what if u didnt send the same thing 3 times within 5 minutes of each other and waited for someone to get to helping u

real palm
#

^this

sly trout
#

If on blockbreakevent I get the block how do i check if its a spawner and put it in the players inv

#

cuz if i get the Material it wont keep the spawner type

#

and im trying to keep the type of spawner

boreal sparrow
#

hello how do i put someone in spectator on death pls hel[

woeful moon
sly trout
real palm
#

sigh

boreal sparrow
#

thanls

real palm
#

I am already helping you, but you cant work with it - I'm not gonna write your code, you have to figure out, what I am refering to.

#

check, what I wrote and think, to what I could refer to in your code.

#

Use the PluginMessaging Channels then

pine island
#

just google lol

#

?google

undone axleBOT
sly trout
#

how do I make something like this ? : Block block = (Spawner) e.getBlock();

sly trout
#

or maybe like Spawner block = e.getBlock();

#

I really need help

lunar python
#

Hi, I've been trying to port a 1.8 plugin with custom items to 1.18 but when I try to use the NMS item's getOrCreateTag function, it gives me this error:
java.lang.NoSuchMethodError: 'net.minecraft.nbt.NBTTagCompound net.minecraft.world.item.ItemStack.getOrCreateTag()'

boreal sparrow
#

check how many people online

real palm
# peak gulch `com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in...
    public static void createRole(String id,String role , Integer position,String prefix , String sufix) throws SQLException {
        Bukkit.getLogger().info(position.toString());
        PreparedStatement date  = connection.prepareStatement("INSERT INTO rolemanager(id,name,position,prefix,sufix) VALUES (?, ?, ?, ?, ?)");
        date.setString(1,id);
        date.setString(2,role);
        date.setInt(3,position);
        date.setString(4,prefix);
        date.setString(5,sufix);
        date.executeUpdate();
    }```

That should be it.
boreal sparrow
#

is there any way to store the amount of players online into a int

real palm
#

Bukkit.getOnlinePlayers().size() <- Returns the current players as int

kind hatch
#

^

boreal sparrow
#

thanks

real palm
#

yw!

real palm
#

👍

kind hatch
#

When working with maven multi modules, is there a way to put the version of the parent pom into the sub modules automatically?
Because right now I have to change the version in each module to update the version number. I would like to just set the version number once.

delicate lynx
#

I think if you use the placeholder in the sub modules it works

kind hatch
#

That's the thing, you can't.

#

Maybe there's a work around?

delicate lynx
#

sorry it's ${revision}

#

that inherits the parent version

tardy delta
#

this looks stupid two times the same generic types

kind hatch
delicate lynx
#

what maven version you using

kind hatch
#

Is there a quick way to check?

#

I'm just using what the IDE provides.

#

Don't think I have an actual version of it installed on the system.

delicate lynx
#

open the terminal on intellij and try mvn -v maybe?

kind hatch
#

Apache Maven 3.6.3

tardy delta
peak gulch
# tardy delta how are you using that method?
        try {
            Player p = (Player) sender;
            if (args.length >= 4) {
                String role = args[0];
                String roleId = UUID.randomUUID().toString();
                Integer position = parseInt(args[1]);
                Bukkit.getLogger().info(position.toString());
                String prefix = args[2];
                String sufix = args[3];
                p.sendMessage(RanksAPi.createRole(roleId,role,position,prefix,sufix));
            } else {
                p.sendMessage("za mało argumentów");
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }```
tardy delta
#

is it suffix or sufix?

sacred mountain
#

is there a way to detect if a player has a certain item in their inventory, and then not let them do anything? im trying to create a sort of spawn protection that requires an item(s) to be protected. Protection meaning that they cannot be damaged and they cannot placeblocks/damage other players etc

peak gulch
tardy delta
#

,sufix) in your statement

real palm
#

what is the exact sql error?

tardy delta
delicate lynx
#

forgot lol

tardy delta
#

idk if it works with materials or itemstacks

peak gulch
delicate lynx
#

then reload project

sacred mountain
peak gulch
# real palm what is the exact sql error?

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line

tardy delta
#

are you sure those are the exact names of the columns?

peak gulch
#
"CREATE TABLE IF NOT EXISTS roleranager(id VARCHAR(100) not null,name VARCHAR(100)," +
                "position " +
                "INT," +
                "prefix " +
                "VARCHAR(100)," +
                "sufix VARCHAR(100))");```
tardy delta
#

i think you want id as a primary key with auto_increment too

kind hatch
peak gulch
tardy delta
#

why rolemanager in the message of MauriceLPs and you use roleranagar?

kind hatch
#

Care to be more specific? Help with what?

real palm
#

You have us to tell that so we can help you

kind hatch
#

Again, need to be more specific. We don't know what to look for if you don't tell us what your problem is.

sacred mountain
#

how do i check for an item in the players inventory with a specific name? with color

tardy delta
# peak gulch so what i should put there
CREATE TABLE IF NOT EXISTS rolemanager (
  id INT AUTO_INCREMENT,
  name VARCHAR(100),
  position INT,
  prefix VARCHAR(100),
  sufix VARCHAR(100),
  PRIMARY_KEY (id)
);```
not sure if you want 100 as length too
hasty prawn
#

Build.getPlugin()

#

It wants some sort of parameter.

kind hatch
tardy delta
hasty prawn
tardy delta
#

oh 😳

sacred mountain
tardy delta
#

System.out.println 🤔

hasty prawn
#

It tells you the error.

#

Build.getPlugin()is not what you want to be using.

tardy delta
#

Build.getPlugin() requires an argument

kind hatch
hasty prawn
#

Inside the parenthesis...?

#

?learnjava @viral hazel

undone axleBOT
tardy delta
#

you need your plugin's instance

#

instead of Build.getPlugin() what it even means

sacred mountain
tardy delta
#

but it requires a parameter, what parameter

sacred mountain
#

im not sure how i would prevent the player from doing stuff, i dont wanna use like 15 eventhandlers

tardy delta
#

ah bruh Build is his main class' name

#

better than Main...

tardy delta
#

or listeners otherwise ._.

sacred mountain
#

worldguard uses regions or maybe they have like some other features im unaware of

lost matrix
tardy delta
#

i see many people calling their main class Main 🥺

tardy delta
kind hatch
hasty prawn
#

Wdym aren't effects

lost matrix
#

Manually searching for them

tardy delta
#

i did it too 😔

#

😂

sacred mountain
#

?

tardy delta
#

wha-

hasty prawn
#

Well for filtering out the ones that require data, just check if getDataType returns Void.class. All the non-effect ones you'll probably have to filter out manually.

tardy delta
#

if they have a menu item in their inventory?

sacred mountain
#

yeah

tardy delta
#

cant you make the players invulnerable?

kind hatch
rancid snow
#

if a player logs out while I have an item of theirs in a gui, how can I return it to them while they are offline?

sacred mountain
tardy delta
#

i guess if they join the game, a menu opens?

kind hatch
#

Ah

#

Ok

sacred mountain
tardy delta
#

that they dont continue with the previous one

sacred mountain
#

and im trying to check if they have those items they cant pvp

#

yeah sorry im bad at explaining

#

its a bit of a weird plugin concept

tardy delta
#

wdym? items to choose like a server, a kit, etc?

sacred mountain
peak gulch
tardy delta
#

so when they have that menu, they arent yet in the actual "fight arena"?

kind hatch
#

@sacred mountain What version are you making this for? I need to know before I suggest something that you might not be able to use.

tardy delta
#

dont do if there important stuff in it

sacred mountain
rancid snow
#

for particles that don't require data, you can do: ```java
Arrays.stream(Particle.values()).filter(p -> p.getDataType() == Void.class);

tardy delta
sacred mountain
#

and the plugin im using doesnt seem to have the feature so im making a llightweight plugin as sort of an addon

#

since the plugin isnt opensource

tardy delta
#

then just store the players that are waiting in the lobby somewhere and make them invulnerable

rancid snow
#

if a player logs out while I have an item of theirs in a gui, how can I return it to them while they are offline?

sacred mountain
#

or a teleportation system

rancid snow
kind hatch
# sacred mountain It's 1.8, and yes before anyone hates me for it i hate coding in 1.8 too im doin...

Well, that eliminates the usage of the PDC. 😦 However, the concept I have works the same.
I'd recommend putting some form of NBT on your items. That way you can modify the item and change how it looks if you need to.
Then, you will need a runnable that runs every tick or so. In that runnable, you will just check to see if the player's inventory contains an item that has that NBT in slot 1 and if they do, set them to invulnerable. Then you will need another listener to prevent them from pvping.

tardy delta
sacred mountain
#

and hit other players

#

without a kit

tardy delta
sacred mountain
tardy delta
#

working on players that arent online wont work

lyric oar
#

Hello, is there any way to detect a tree with spigot? I want to do something so that if a player breaks a tree, i want to know the tree location, the number of wood blocks and then break all of the tree

tardy delta
#

thats how i see it

lost matrix
sacred mountain
#

like run a command

kind hatch
tardy delta
#

"permission group"

#

i'm also thinking about luckperms

sacred mountain
#

wouldnt that just make the player lag back constnatly

lost matrix
sacred mountain
#

since theyre falling into the arena

tardy delta
#

uhm i guess

sacred mountain
#

and not walking into it

tardy delta
#

that depends on your build

kind hatch
tardy delta
#

if they have to jump down probably

tardy delta
#

i would do it in that way but its probably not ideal for someone else

kind hatch
#

But he doesn't. That's something that he should probably be aware of.

tardy delta
#

and you will need to use the luckperms api too.

#

hmm

sacred mountain
#

im tryna make them invulnerable and they cant do things/drop/pickup whilst they have an item, no matter where they are

lost matrix
#

Dont fiddle around with permissions

tardy delta
#

he will definitely need worldguard to prevent a user from entering a region

lost matrix
#

Just use the scoreboard tags

tardy delta
#

explain

sly trout
#

How do I change the spawner's type

tardy delta
#

ah instead of permission nodes?

sly trout
#

like how do i change a spawner's type in the player's inventory

sacred mountain
#

i have to go now, but ill see the mentions when i get back :) thanks for the help so far though

sly trout
lost matrix
# sly trout noice

You can try the following:

  1. get the ItemMeta of the spawner ItemStack
  2. Cast it to BlockStateMeta
  3. get the BlockState of the BlockStateMeta
  4. Cast it to CreatureSpawner
  5. set the CreatureSpawners type
  6. set the BlockState back on the BlockStateMeta
  7. set the BlockStateMeta back on the ItemStack

If that doesnt work then i got another workaround.

tardy delta
#

CreatureSpawner#setSpawnedType? what about that

sly trout
#

CreatureSpawner is a block

tardy delta
#

or is that when placed down?

sly trout
#

yes

tardy delta
#

ah what i thought

sly trout
#

im trying to change the itemstack

tardy delta
#

when you place it down, apply the spawn type

#

save it in the pdc? 🥺

lost matrix
#

ItemStacks which represent blocks that contain TileEntities posses a BlockStateMeta.
Use this

lost matrix
# sly trout im trying to change the itemstack

You can try the following:

  1. get the ItemMeta of the spawner ItemStack
  2. Cast it to BlockStateMeta
  3. get the BlockState of the BlockStateMeta
  4. Cast it to CreatureSpawner
  5. set the CreatureSpawners type
  6. set the BlockState back on the BlockStateMeta
  7. set the BlockStateMeta back on the ItemStack
kind hatch
#

You can set the type on an ItemStack, it's just that it won't work in survival. However if you place it down in creative, it will have the proper data.

sly trout
#

cast it to CreatureSpawner?

lost matrix
#

What does it refer to?

kind hatch
#

The spawner.

sly trout
#

blockstate of the blockstatemeta

#

basicly

#

when i'm trying to make a spawner pickaxe

#

that when you breaka spawner

#

it gives you the right spawner

lost matrix
#

one moment...

sly trout
#

I'm trying to find a way other than storing the type in the nbt and then having a HUGE if statement and then changing the spawner when placing it down

vocal cloud
#

Huge if statement? Use a switch

sly trout
#

well

#

yeah

kind hatch
#

You wouldn't need a huge if statement. If you store the name of the SpawnerType or whatever it's called, you can just use Enum#value(String name) and if the name is correct, which it should be, you only have one method instead of a bunch of checks.

sly trout
#

but still would be ugly

tardy delta
#

nah

sly trout
#

wasn't for that one

tardy delta
#

just EntityType#valueOf

#

and some casts and stuff

sly trout
#

never thought that entitytype#valueof existed

tardy delta
#

what is the block of the spawner?

#

does it have a tilestate?

kind hatch
tardy delta
#

yes it has a tilestate

#

tilestate has #getPersistentDataContainer

#

save the entity type it spawn in string form in there?

sly trout
#

what I'm gunna do is save the spawner.getSpawnedType.toString() to the nbt of the item

tardy delta
#

nbt? why?

sly trout
#

and then on block place change the spawner spawned type to EntityType.valueof

lost matrix
#
  public static ItemStack createSpawnerItemFromBlock(Block block) {
    Material blockType = block.getType();
    if (blockType != Material.SPAWNER) {
      return null;
    }
    BlockState currentState = block.getState();
    ItemStack spawnerItem = new ItemStack(Material.SPAWNER);
    BlockStateMeta meta = (BlockStateMeta) spawnerItem.getItemMeta();
    meta.setBlockState(currentState);
    spawnerItem.setItemMeta(meta);
    return spawnerItem;
  }

  public static void setSpawnerBlockFromItemStack(ItemStack spawnerItem, Block target) {
    target.setType(Material.SPAWNER);
    if (spawnerItem.getType() != Material.SPAWNER) {
      return;
    }
    BlockStateMeta meta = (BlockStateMeta) spawnerItem.getItemMeta();
    CreatureSpawner spawnerState = (CreatureSpawner) meta.getBlockState();
    CreatureSpawner currentState = (CreatureSpawner) target.getState();
    currentState.setSpawnedType(spawnerState.getSpawnedType());
    currentState.setDelay(spawnerState.getDelay());
    currentState.update(true);
  }
tardy delta
#

doesnt my method works?

sly trout
#

i didnt quite understand your method

#

D:

#

tilestate?

tardy delta
#

a block that hosts a tile entity

#

at a location

sly trout
#

oh yes

#

yes my bad

#

my memory

#

is dum

#

ik what tile entity is

tardy delta
#

7smile, would it work?

#

setting the entity type in string format there

#

nvm

sly trout
#

?

tardy delta
#

im dead it doesnt work when inside inventory

#

use his way

sly trout
#

yes his way makes a lot more sense

#

it was confusing when he explained it but i understand it perfectly now

tardy delta
#

it doesnt, i was misinterpreting it

sly trout
#

his way doesnt work now?

lost matrix
#

idk if my approach works. Just threw it together in a min

sly trout
#

doesnt seem to be working

lost matrix
#

Let me check

tardy delta
#

do something with this
return meta.getPersistentDataContainer().has(IS_INVISIBLE_KEY, PersistentDataType.BYTE);

#

sec

#

IS_INVISIBLE_KEY = new NamespacedKey(this, "invisible");

#

i guess idk

#

you need an itemstack with material itemframe

#

get the itemmeta and the persistent data container from it and apply the namespaced key

#
ItemStack itemFrame = new ItemStack(Material.ITEM_FRAME);
itemFrame.getItemMeta().getpersistentDataContainer().set(new NameSpacedKey(plugin, PersistentDataType.STRING, "invisible"));
#

idk if it can be chained but i hope it helps

#

oh you need to set the meta again

#

its just about knowing that it uses a namespacedkey

sly trout
#

if(e.getBlock().getType() == Material.SPAWNER) {
CreatureSpawner creatureSpawner = (CreatureSpawner) e.getBlock();

#

it gives me an exception

#

java.lang.ClassCastException: class

#

there should not be any exceptions for that cuz i verify that it is a creture spawner

tardy delta
#

does creaturespawner extends/ implements block?

sly trout
#

yes

#

CreatureSpawner is a ? blockstate ? ..

#

but CreatureSpawner does not extends BlockState

maiden thicket
sly trout
#

ayo

maiden thicket
#

it extends TileState which extends BlockState

sly trout
#

oh

#

alright

#

thanks

#

ill try

rustic bloom
#

Hey, I have the following problem. I'm trying to connect to an external MySQL database in my plugin, but I cant seem to execute the Command through the command Class (implementing CommandExecutor). If i try to send a request to the database via a public static void main() outside of the class it works fine, but otherwise im getting a "Communication link failure" when I try to execute the command in MC /command.

lost matrix
sacred mountain
#

hello! did anyone find a solution to what im trying to do

chrome beacon
#

With "them" I assume you mean players

#

All you need to do is listen to the event of each thing you want to prevent and cancel it

sacred mountain
#

can i put event handlers in an IF statement

#

or should i loop it to constantly check for the item idk

chrome beacon
#

No put if statement inside of event

#

So

Event:
If has item then:
Cancel

sacred mountain
#

oh yea true

#

ok

#

how do i check for an item with a specific name?

#

like if i wanted to check for e.g.

Chest with name '&aTest Item'

chrome beacon
#

Loop items in inventory:
If item has ItemMeta:
getItemMeta.hasDisplayName:
getDisplayName

lethal knoll
#

Does anyone know what the player.setTime() will do? Will it actually change the day-night cylcle for the player to the chosen time? I'm looking for the best way to kick players from a bed

chrome beacon
#

Time seems like a bad idea

#

Try damaging or teleporting the player instead

hoary pawn
#

is there a right way for a cmd to say something to the executer

lethal knoll
#

a teleport seems a good solution

#

If I teleport the player to his current location, that would also kick him/her from the bed?

chrome beacon
#

I think so

lethal knoll
#

Alright, worth a shot

#

Thanks

sacred mountain
#

like what eventhandler

chrome beacon
#

?jd-s I recommend learning to use this

undone axleBOT
solemn gulch
#

what jvm version do i have to use for 1.18 plugins

brave sparrow
#

17

tender shard
#

No

#

you can use any version you like

#

I always compile against 1.8 so that 1.16 people can use my plugins too

#

still works fine on 1.18 servers with java 17

#

java is backwards compatible (in 99.9% of cases)

quiet ice
#

The compiler needs to be j17+

tender shard
#

no

eternal night
#

mostly because bukkit API is still on java 8

sly trout
#

how do you remove an item from player's inventory

#

like inv.remove() removes every item

#

i wanna remove 1

delicate lynx
#

get the index of the item and remove it that way

#

you can remove stuff via index instead of removing all itemstacks of that material

sly trout
#

okay but if they got 54 of them

#

i wanna remove 1 only

delicate lynx
#

get the index, set the quantity of the item - 1

eternal night
rancid beacon
#

Hello guys, how can I define block as Concrete, and then get color of this concrete?

            if (block.getType() != Material.AIR) {
                if (block.getType().toString().endsWith("CONCRETE")) {
                    Location newL = new Location(world, block.getX() - 1, block.getY(), block.getZ());
                    newL.getBlock().setType(block.getType());
                    block.setType(Material.AIR);
                    
                    
                    // and here, how can I define block as Concrete? Cause something like "Concrete = (Concrete) block.getType();" don't work, cause there's no "Concrete"
                    
                    Idk_whats_here my_concrete = block.getType();
                    Bukkit.getLogger().info(my_concrete.getColor());
                    
                    tak++;
                }
                Location newL = new Location(world, block.getX() - 1, block.getY(), block.getZ());
                newL.getBlock().setType(block.getType());
                block.setType(Material.AIR);
                tak++;
            }
#

(i'm using spigot 1.18.1)

glossy scroll
#

does Bukkit.getOfflinePlayer work if the player has never joined the server before?

tall dragon
#

no

candid galleon
#

@rancid beacon it's not a blockstate, each material has its own color

rancid beacon
#

so how can i get color of block?

tall dragon
#

seems like an xy problem

candid galleon
#

it actually might be a block state one sec

candid galleon
#

oh neat

#

was looking at and outdated javadoc

delicate lynx
tender shard
tall dragon
#

that does work?

tender shard
#

yes

#

Bukkit.getOfflinePlayer even is annotated with @ NotNull

tall dragon
#

well guess i learned something today then

tender shard
tall dragon
#

does it use mojang api to get then?

tender shard
tender shard
#

an OfflinePlayer is just a wrapper for the UUID, basically

#

BUT

#

OfflinePlayer#getName() will return null if the player never joined before

#

🙂

tall dragon
#

ah i see

#

alright thanks

tender shard
#

np 🙂

#

oh wait

#

the first method I sent, getOfflinePlayer(String name) does indeed to a web request

#

but the UUID one doesn't

tall dragon
#

yea

#

to get the uuid

#

probably

tender shard
#

exactly

#

This method may involve a blocking web request to get the UUID for the given name.

rancid beacon
tall dragon
#

why do you want the color of the block

candid galleon
rancid beacon
tender shard
#
public static String getColor(Material mat) {
        if(mat.name().endsWith("_CONCRETE")) {
            return mat.name().split("_")[0];
        }
        return null;
    }
#

returns null for everything that's not concrete, or for uncolored concrete

#

or "RED" or "PURPLE" etc

tender shard
#

oh

#

you're right

#

yes @rancid beacon

#

let me correct the code

rancid beacon
#

okay

glossy scroll
candid galleon
#

If you’re just replacing the block then just save the block type

#

No need to manually check or assign

tender shard
#
    public static String getColor(Material mat) {
        if(mat.name().contains("_CONCRETE")) {
            return mat.name()
                    .replace("_CONCRETE_POWDER","")
                    .replace("_CONCRETE","");
        }
        return null;
    }
#

this works

proven river
#

I didnt know where to ask this so I'll ask it here.
If anyone has messed around with textures? i'm trying to make my bossbar invisible (the white one) so I can display text without the bar but
whenever I remove the whitebar from the image it goes onto the black bar for some reason?
I've removed all of the bossbars and that works but its not exactly viable for what I want to do.

quaint mantle
#

hehehehe paper has player profile api

tender shard
#

iirc

rancid beacon
quaint mantle
#

you kinda, put base64 in skull's nbt

tender shard
#

I'm pretty sure about that though because all my servers are behind a firewall and skull textures work fine for me

#

I only allowed 25000...25999

#

outgoing

glossy scroll
quaint mantle
#

SP?

glossy scroll
#

i tried digging through the code to see how they get the texture

#

singleplayer

quaint mantle
#

ah

glossy scroll
#

and yea you're right

#

since it doesnt get the name of the player

#

the server cant fill in the texture

#

not sure why it needs both

tender shard
#

the client needs it

#

because as I said, the client is the one querying the texture IIRC

#

and ONLY the name is required IIRC

#

you can use a random UUID, if you set the correct name, the client will get the texture by name

#

(I might be wrong though, that's just how I remember how it used to work)

candid galleon
#

It’s possible

#

Gotta use NMS I believe

tender shard
#

sure it's possible to set custom textures

#

here's my class for custom heads etc

#

WHY

#

THE FUCK

#

does recipe not implement Keyed

#

I know why. because ALL recipe subclasses implement Keyed EXCEPT for MerchantRecipe

#

but

#

why doesn't MerchantRecipe implement it too

#

@sullen marlin why doesn't MerchantRecipe implement Keyed D:

#

removing ones plugin's recipes is more complicated then it should be imho lol

    private void removeOldRecipes() {
        Iterator<Recipe> it = Bukkit.recipeIterator();
        NamespacedKey dummy = new NamespacedKey(this,"dummy");
        while(it.hasNext()) {
            Recipe next = it.next();
            if(!(next instanceof Keyed)) continue;
            Keyed keyed = (Keyed) next;
            if(!keyed.getKey().getNamespace().equals(dummy.getNamespace())) continue;
            it.remove();
        }
    }
shy wolf
#

does any one know how to cancel "InventoryCloseEvent"?

quasi patrol
#

So uh? Gradle just stopped wanting to work, and has this error, it was working before yesterday.

terse raven
#

I made an npc but he wont spawn with the specified pitch, i can only change if he looks up or down

private static byte getConvertedRotation(float a) {
        return (byte) (a * 256f / 360f);
    }




PlayerConnection connection = ((CraftPlayer) player).getHandle().b; // weird mojang name for PlayerConnection

        DataWatcher watcher = npc.ai();
        watcher.registrationLocked = false;
        watcher.b(new DataWatcherObject<>(17, DataWatcherRegistry.a), (byte) 127);
        connection.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a, npc));
        connection.a(new PacketPlayOutNamedEntitySpawn(npc));
        connection.a(new PacketPlayOutEntityHeadRotation(npc, getConvertedRotation(npc.getBukkitYaw())));
        connection.a(new PacketPlayOutEntityMetadata(npc.getBukkitEntity().getEntityId(), watcher, true));
        Bukkit.getServer().broadcastMessage(npc.dm() + " - " + npc.dn());
        connection.a(new PacketPlayOutEntity.PacketPlayOutEntityLook(npc.getBukkitEntity().getEntityId(), getConvertedRotation(npc.dm()), getConvertedRotation(npc.dn()), true));
        ```
terse raven
#

you cant

#

i think

shy wolf
#

me too

terse raven
#

i mean just resend the Inventory

#

if it was a chest

#

but if its the inventory, then i think there is no way to force open it

shy wolf
terse raven
#

as the inventory is, if i call correctly, handled completely client sided

#

and you cant force open it or listen for it to open

hasty prawn
#

Delay it by a tick

tender shard
shy wolf
hasty prawn
#

?scheduling

undone axleBOT
tender shard
shy wolf
#
public class OnPlayerCloseInventory implements Listener {

    @EventHandler
    public void Event(InventoryCloseEvent e){
        if(e.getView().getTitle().equals("Pick Nation")){
            if(PlayerData.HasPlayerData(e.getPlayer().getUniqueId())){
                if(PlayerData.GetPlayerData(e.getPlayer().getUniqueId()).IsInNation == false){
                    e.getPlayer().openInventory(e.getView());
                }
            } else {
                Objects.requireNonNull(Bukkit.getPlayer(e.getPlayer().getUniqueId())).kickPlayer("Did Not Found Player Data");
            }
        }
    }
}```
hasty prawn
#

Yeah delay the openInventory call using schedulers

shy wolf
terse raven
#

rip

hasty prawn
#

I do, just a sec.

#

I remember having the same issue. Need to look back at how I fixed it.

hasty prawn
sly trout
#

in PlayerBucketFillEvent does e.getItemStack() not give you the actual item stack

#

because the item stack has nbt data

#

but when i check for it

#

it doesnt work

tender shard
#
                        Bukkit.getScheduler().runTaskLater(yourPlugin, () -> {
                            e.getPlayer().openInventory(e.getView());
                        }, 1);
#

and

#

PLEASE

#

USE PROPER VARIABLE NAMES

#

"e" is NOT a proper variable name

hasty prawn
crude estuary
hasty prawn
tender shard
crude estuary
#

Just why

hasty prawn
#

Yes 😄

tender shard
#

runTask runs it on the same tick

hasty prawn
#

Nope

#

It's next tick

tender shard
#

runTask runs on the same tick

#

but after everything else was done

#

but yeah, runTask would work too

hasty prawn
tender shard
#

oh

#

you're right

#

sorry

hasty prawn
#

I mean it's not like it really matters KEKW

tender shard
#

it doesn't, but at least I learnt sth new today :3

hasty prawn
#

True!

hasty prawn
#

?paste your code again

undone axleBOT
terse raven
#
PlayerConnection connection = ((CraftPlayer) player).getHandle().b; // weird mojang name for PlayerConnection

        DataWatcher watcher = npc.ai();
        watcher.registrationLocked = false;
        watcher.b(new DataWatcherObject<>(17, DataWatcherRegistry.a), (byte) 127);
        connection.a(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a, npc));
        connection.a(new PacketPlayOutNamedEntitySpawn(npc));
        Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(LobbySystem.instance.getInstance(), new Runnable(){
            @Override
            public void run(){
                connection.a(new PacketPlayOutEntityHeadRotation(npc, getConvertedRotation(npc.getBukkitYaw())));
            }
        }, 1);
        connection.a(new PacketPlayOutEntityMetadata(npc.getBukkitEntity().getEntityId(), watcher, true));
        Bukkit.getServer().broadcastMessage(npc.dm() + " - " + npc.dn());
        connection.a(new PacketPlayOutEntity.PacketPlayOutEntityLook(npc.getBukkitEntity().getEntityId(), getConvertedRotation(npc.dm()), getConvertedRotation(npc.dn()), true));
        ```
hasty prawn
#

What happens if you remove the EntityLook packet at the end

#

Also use runTask instead of scheduleSyncDelayedTask

sly trout
#

in PlayerBucketFillEvent

#

how do you get the itemstakc of the bucket

terse raven
#

uhh

hasty prawn
terse raven
#

still looks up

hasty prawn
#

Are you sure you're reloading it properly

terse raven
#

yes

hasty prawn
terse raven
#

i reload + rejoin

sly trout
#

bruh nobody wanna help

lavish hemlock
#

Have you tried turning it off and on again

hasty prawn
#

Are you respawning the NPC?

lavish hemlock
#

Most of the time /reload is a bad idea :p

hasty prawn
terse raven
sly trout
#

it doesn't work

terse raven
hasty prawn
#

Yeah, restart and try

terse raven
#

yea i do that

sly trout
#

because when i check for nbt data it doesnt say yes

hasty prawn
#

Well try restarting lol

terse raven
#

it resends the packets when i rejoin

hasty prawn
undone axleBOT
sly trout
#
    public void onWaterPlace(PlayerBucketEmptyEvent e) {
        e.getPlayer().sendMessage("1");
        if (PickupBucketWaterEvent.prevents.contains(e.getPlayer().getUniqueId())){
            e.setCancelled(true);
        return;
        }
        e.getPlayer().sendMessage("2");
        ItemStack bucket = e.getPlayer().getItemOnCursor();
        NBTItem nbti = new NBTItem(bucket);
        if(nbti.hasNBTData() && nbti.hasKey("CustomItemKey")) {
            e.getPlayer().sendMessage("3");
            if(nbti.getString("CustomItemKey").equals("DolphinBucket")) {
                e.getPlayer().sendMessage("4");
                e.setCancelled(true);
                bucket.setAmount(bucket.getAmount()-1);
                Player player = e.getPlayer();
                player.getInventory().addItem(new ItemStack(Material.BUCKET));
                e.getBlock().setType(Material.WATER);
                player.getLocation().getWorld().spawnEntity(e.getBlock().getLocation(), EntityType.DOLPHIN);
            }
        }```
hasty prawn
#

You're not using getItemStack

#

You're using getItemOnCursor Thonk

sly trout
#

oh my bad but yes i did try with get item stack

hasty prawn
#

Try it again 😄

sly trout
#

I will

terse raven
hasty prawn
#

No no

terse raven
#

oh ok

hasty prawn
#

Talking to Fenzy to try getItemStack again lol

terse raven
#

oh lol

lavish hemlock
sly trout
hasty prawn
#

Mjanko try just sending the PacketPlayOutPlayerInfo and the delayed HeadRotation

#

And comment out all the other ones

hasty prawn
sly trout
#

it prints 1 and 2

#

not 3

terse raven
#

whats the comment hotkey for intellij again

#

;-;

hasty prawn
#

Ctrl + /

hasty prawn
# sly trout it prints 1 and 2

Print your itemstack before checking and see what it says. My guess is that your ItemStack just doesn't have that key.

sly trout
#

that's what a thout

sly trout
#

getItemStack returns a bucket everytime

hasty prawn
#

Problem solved!

sly trout
#

a normal bucket

lavish hemlock
hasty prawn
#

Lol send what you're doing now Mjanko

sly trout
#

i'm not even using a bucket and it returns a BUCKET

#

normal bucket

#

i'm using a salmon bucket

hasty prawn
#

You know you're checking PlayerBucketEmptyEvent right?

#

Of course it's always empty lol

terse raven
#

YOOOOOOOOOOOOOOO

#

it works

hasty prawn
terse raven
#

i was using npc.getBukkitYaw

#

when i should be using npc.dn

hasty prawn
#

Ahhh

sly trout
#

okay then what should i use @hasty prawn

hasty prawn
#

You should switched to remapped Mjanko it's going to make working with NMS a million times easier

terse raven
sly trout
#

ur welcome

terse raven
#

and i was always defeated by it

hasty prawn
sly trout
#

no im trying to listen for when i place it down

hasty prawn
sly trout
#

im making a dolphin bucket

hasty prawn
#

You can only get the material of the bucket used before

#

Not the itemstack

sly trout
#

that sucks cuz im trying to get the nbt of the item

#

used

patent horizon
#

how can you remove a value from a hashmap?

#

i thought it was hashmap.remove(key), but i dont see the option show up

lavish hemlock
#

. . .

patent horizon
#

wait is the thing on the right for return values?

lavish hemlock
#

yes

#

remove (with no value argument) returns the value that was removed from the map

patent horizon
#

why would it return ConfigManager if i was just removing a value

#

oh

#

so i can just ignore the return value

lavish hemlock
#

yes

#

remove with a value argument returns whether or not the value was actually removed

cold tartan
#

is there a way to add CanBreak to an itemstack?

lunar forge
#

that extends itemstack

#

Or idk if you can add flags to an itemstack, i think its possible

worldly ingot
#

It's one of those things nobody ever finalized API for

tender shard
patent horizon
#

a hashmap

tender shard
#

then it'd have a remove method

#

it's something else

patent horizon
#

queue the naming convention comments

patent horizon
tender shard
#

CM is NOT a map

lavish hemlock
#

well is CM a static final variable? :)

tender shard
#

please show your definition of CM?

patent horizon
#

public Map<Player, ConfigManager> CM = new HashMap<>();

tender shard
#

oh wait I'm stupid

#

your screenshot even shows that it has a remove method

#

sooo

tender shard
#

where's the problem? 😛

patent horizon
#

there isnt one

lavish hemlock
#

There was no problem he misunderstood what remove meant because of the return type being on the far right of IDEA's code completion.

tender shard
#

oh ok

patent horizon
#

no i misunderstood that the remove event returned a vlue and mistaked it for a different method

lavish hemlock
#

That's what I said

patent horizon
#

after 4 tries

#

yes

little elm
#

In plugin.yml, for the command usage section, what's the convention for optional command arguments? eg how to communicate that the player in "/kill <player>" is optional?

lavish hemlock
#

I mean there's not really a convention

#

you could say uhhh

#

/kill (<player>)?

little elm
#

gotcha maybe like uh "/kill <optional: player>"?

lavish hemlock
#

that could work too

little elm
#

thanks!

#

if anyone has better ideas pls lmk lol

lost matrix
lost matrix
tall dragon
#

for example

lavish hemlock
#

oh that's pretty

tall dragon
#

isnt it?

lavish hemlock
#

I'mma steal that style in the future thanks

tall dragon
#

haha, feel free

quaint mantle
#

monke

lunar forge
#

Hi, I'm using Vault in my server, and now I've added it as a Dependency in my plugin. But it won't work as it can't find Vault in my plugins folder orso. I've exactly this code in my plugin, https://github.com/MilkBowl/VaultAPI. And yes, I've added Vault in my plugin.yml. And Vault is in my server

lost matrix
lunar forge
#

Yes

#

I'm using 1.17

lost matrix
#

How does this "won't work as it can't find Vault" manifest?

eternal night
#

?paste

undone axleBOT
lunar forge
eternal night
#

well sounds like vault is either not in your deps or you misconfigured your plugin.yml

lunar forge
#
depend:
  - Vault```
eternal night
#

and you are 100% sure it is loaded as a plugin

#

with that name ?

lunar forge
#
    <repositories>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.17.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>RELEASE</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.github.MilkBowl</groupId>
            <artifactId>VaultAPI</artifactId>
            <version>1.7</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>```
lost matrix
#

Paste your class that checks for vault pls

lunar forge
eternal night
#

like, the plugin is running at runtime in your server

#

and that is its name

#

also what smile sad

lunar forge
#
    private boolean setupEconomy() {
        if (getServer().getPluginManager().getPlugin("Vault") == null) {
            return false;
        }
        RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);
        if (rsp == null) {
            return false;
        }
        econ = rsp.getProvider();
        return econ != null;
    }```

And in my onEnable:
```java
        if (!setupEconomy() ) {
            System.out.println("Disabled due to no Vault dependency found!");
            getServer().getPluginManager().disablePlugin(Main.getInstance());
            return;
        }```
lost matrix
#

Do you have a plugin installed that provides a Economy.class?

lunar forge
lost matrix
#

Sure

lunar forge
#

Do I need to do that?

#

bruh

lost matrix
#
RegisteredServiceProvider<Economy> rsp = getServer().getServicesManager().getRegistration(Economy.class);

This ovsly returns null if there is no plugin that actually provides the Economy service

proud forum
#

hello, i am making a toggle command that changes a boolean to true or false to use in my listeners class, is there a more optimized or better way to do this?
main class:```java
public final class Main extends JavaPlugin {
public static boolean toggle = false;
@Override
public void onEnable() {
System.out.println("Hello world!");

    getServer().getPluginManager().registerEvents(new BreakBlock(), this);
    getServer().getPluginManager().registerEvents(new MobSpawns(), this);

}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}```

command class: ```java
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (args[0].equalsIgnoreCase("on")) {
if (sender instanceof Player)
Main.toggle = true;
} else if (args[0].equalsIgnoreCase("off")) {

  if (sender instanceof Player)
    Main.toggle = false;
}

}```

lost matrix
#

Dont use public for this and dont use static

proud forum
#

alrighty

lavish hemlock
#

private is better in most situations for fields

#

public is mainly reserved for constants like public static final CONSTANT_VALUE = 6;

proud forum
#

okay, beginner to java and spigot stuff so thanks for the help!

lost matrix
#

Write a class like:

public class PluginOptions {

  private boolean toggled = false;

  public boolean isToggled() {
    return toggled;
  }

  public void toggle() {
    this.toggled = !this.toggled;
  }

}

Then have one single instance of it and pass it to other classes that need it.

proud forum
# lost matrix Write a class like: ```java public class PluginOptions { private boolean togg...

like this?

command class:```java
package me.mrhonbon.opmobs;

import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;

public class MobSpawnCommand implements CommandExecutor {
private boolean isToggled;

@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (args[0].equalsIgnoreCase("on")) {
        if (sender instanceof Player)
            sender.sendMessage("Overpowered Mobs has been enabled.");
            this.isToggled = true;
    } else if (args[0].equalsIgnoreCase("off")) {
        if (sender instanceof Player)
            sender.sendMessage("Overpowered Mobs has been disabled.");
            this.isToggled = false;

    }
}

}```

lost matrix
#

Nope. This makes it really hard to share the "isToggled" property

#

You need a shared instance.

sterile token
ivory sleet
lost matrix
lost matrix
proud forum
#

ohhhhh okay i think i get what you're sayin

sterile token
# proud forum ohhhhh okay i think i get what you're sayin
  public class PlayerOption {   
    
    private static Map<UUID, Option> options = new HashMap<>();
    
    public static Option getOptions(UUID uuid) {
        return options.computeIfAbsent(uuid, option -> new Option(true));
    }
    
    public static class Option {
        
        private boolean property;
        
        public Option(boolean property) {
            this.property = property;
        }

        public boolean getProperty() { return property; }
    }
}
#

There you have a simple example

ivory sleet
#

What the

proud forum
#

wha

ivory sleet
#

Verano you sober or not? (Just good to know)

proud forum
#

LOL

ivory sleet
#

Idk I think he was drunk once here before

#

So asking out of curiosity just to make sure

sterile token
lost matrix
# proud forum wha

Yes. I would advise you just to ignore that for now. I think you got the idea right.
Implement it and then update us.

proud forum
sterile token
ivory sleet
#

What’s a manager?

#

The term manager is very vague, especially in enterprise

sterile token
ivory sleet
#

So a repository?

sterile token
#

Yeah

#

I think that the correct term

ivory sleet
#

Not a problem but the Option class is just a glorified Boolean?

sterile token
#

Explain again

#

My brains has exploded

ivory sleet
#

I mean you could literally use sth like the type Boolean instead

lost matrix
lavish hemlock
#

Yeah the Option type doesn't say anything about the actual option

#

Just whether or not it's true

sterile token
lavish hemlock
#

And that also means there's only one option for a player, which is not extensible.

sterile token
#

But for example i doit together

lavish hemlock
#

Don't write useless code just for the sake of it existing :p

sterile token
#

So let forget he already solve his problem. Any scoreboard api recommendation without Reclections i hate them

#

Every scoreboard api on github works with them i dk why

lost matrix
#

Should be more of a Map<UUID, List<Option>>
Which is bad because nested collections.
So you would write a new class "OptionDomain"
and then use a Map<UUID, OptionDomain>

sterile token
#

How i use man

#

BTWW

#

Look

#

Omg

lavish hemlock
#

of UUID -> Option

#

a single option

#

only one option

#

you'd need a list of Options

#

but then you'd not be able to differentiate the options since it's just a wrapper around a boolean

ivory sleet
#

I’d say nested collections might be fine if they stay strictly within the concretion smile, thoughts?

lavish hemlock
#

Multimap is still nicer than nested collections

ivory sleet
#

Ya

lavish hemlock
#

I would recommend using Guava in your plugins since Minecraft depends on it anyway

lost matrix
lavish hemlock
#

anyway the better solution is like

#

Map<UUID, Map<String, Boolean>>

ivory sleet
#

Yeah, probably depends very much on scenario, just need to hear someone else agree upon it :>

sterile token
#

Its exactly the same, the only things as an example i do it all together

sterile token
lavish hemlock
sterile token
#

Omg

#

I love how people critice and them apologice

#

😂

lavish hemlock
#

With the previous example the addition of an Option was legitimately pointless and just served to add noisiness.

#

I am not apologizing, I'm saying that this is a better use case for a custom DTO.

lost matrix
sterile token
lavish hemlock
#

I don't have a scoreboard API

sterile token
#

You just depressed more than i am 😮‍💨

ivory sleet
lavish hemlock
lost matrix
#

Yes. Clown face indeed.

lavish hemlock
#

It's not just when a class should be inherited

#

He just never uses private

sterile token
ivory sleet
#

neva’ 😔

lavish hemlock
#

Yeah, I agree too that that is in fact what you do

#

But I don't agree that it's a good idea

sterile token
#

Someone here told me that its not wrong

#

Cuz it intended to use to protect field access

lavish hemlock
#

It's not wrong for classes that are designed to be inherited

#

It is terribly wrong for classes that should never be inherited or are designed not to be (like data classes)

sterile token
#

MMM

#

I wont change more than 40 classes only for that yet

ivory sleet
#

I mean usually we want to code defensively by restricting ourselves and surrounding ourselves with + by abstractions Verano shrug

lavish hemlock
#

You should change the way you code :p

sterile token
#

wHAT do you recommend for project?

#

Multi module?

ivory sleet
#

Module as?

sterile token
#

Cuz it will have 2 plugins Bungee side and Spigot side

lavish hemlock
#

You'd want 3 modules probably

sterile token
#

So i would have to create a core and them implement it on the sides right?

ivory sleet
#

Multiple gradle modules? Multiple java modules? Or just multiple layers?

lavish hemlock
#

common, spigot, and bungee

sterile token
ivory sleet
#

Groovadle

#

(:

lavish hemlock
#

I'm not gonna get into this debate again we've argued about Maven and Gradle like 25 thousand times

sterile token
#

I know

#

Just ignore it

ivory sleet
#

Lol conclusion gradle wins 8)

lost matrix
lavish hemlock
lost matrix
#

I know it but im tempted

ivory sleet
#

Smile stop resisting the inevitable danceDog

lavish hemlock
#

My opinion still stands

#

Maven and Gradle are both terrible

sterile token
lavish hemlock
#

...

lost matrix
#

Im a gradle user now anyways...

lavish hemlock
#

that is not what "provocation" means

brave sparrow
#

I mean

#

It is one thing it means

ivory sleet
sterile token
brave sparrow
#

But not what you meant

lavish hemlock
#

action or speech that makes someone annoyed or angry, especially deliberately.

brave sparrow
#

That’s one definition

#

There’s also things like a provocative image

#

Etc

#

A provocative gesture

lavish hemlock
#

well I don't think "provocative" applies just to sex

brave sparrow
#

He’s running everything through a translator

lavish hemlock
#

it can also mean just to

#

provoke

brave sparrow
#

So sometimes he gets the wrong definition

lavish hemlock
#

to elicit a response from someone

lost matrix
lavish hemlock
#

be it HORNY, angry, sad, etc.

brave sparrow
#

I understand that

#

I’m just saying that’s where he’s coming from

ivory sleet
brave sparrow
#

His translator translated it into a word without those multiple meanings

lost matrix
lavish hemlock
#

No horny ⛔

brave sparrow
#

Remember, no horny

lost matrix
ivory sleet
#

It’s very indulging when people know the rules

lavish hemlock
#

I don't know the rules

ivory sleet
lavish hemlock
#

I didn't actually read Spigot's rules

#

I just assumed they were the same copy-paste shit like

#

"no committing murder"

#

and

#

"no jaywalking"

ivory sleet
#

In short it’s just common sense

lavish hemlock
#

Yes

brave sparrow
#

Man I hate jaywalkers

#

You know how annoying it is as a driver to have to constantly look for idiots crossing at random parts of the road?

lavish hemlock
#

Nope

#

I don't have a car :)

proud forum
#

i apologize if this is taking too long, im still learning java and how OOP works and such

#

bare with me 😁

ivory sleet
#

Especially when you also learn the semantics of the language

lost matrix
sterile token
#

People what difference betweeen:

getCollection("test").updateOne(Filters.eq("uuid", uuid), document, new UpdateOptions().upsert(true));

getCollection("test").updateOne(Filters.eq("uuid", uuid), new BasicDBObject("$set", document));
#

I cannot understand then

proud forum
#

thanks for understanding conclure 😄

ivory sleet
hasty prawn
#

We all were at some point

proud forum
lavish hemlock
#

Humans are just moving speedbumps

proud forum
#

which i think is kinda stupid

sterile token
lost matrix
ivory sleet
brave sparrow
lavish hemlock
#

Java is probably the best way to learn OOP

hasty prawn
#

^

brave sparrow
#

So if they do something stupid and I hit them, they can be found at fault for the accident

sterile token
hasty prawn
#

Anyone who learned otherwise just had it worse OMEGALUL

lost matrix
#

Eh. Sure. Probably not much of a difference in most cases.

ivory sleet
#

Yeah tho it seems most people who learn it starts by going insanely procedural shrug

lavish hemlock
#

C# is a better language but it has a lot more syntax and features

brave sparrow
proud forum
#

okay here is my confusion
plugin options class:```java
package me.mrhonbon.opmobs;

public class PluginOptions {

private boolean toggled = false;

public boolean isToggled() {
    return toggled;
}

public void toggle() {
    this.toggled = !this.toggled;
}

} main class:java
package me.mrhonbon.opmobs;

import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin {
private PluginOptions pluginOptions = new pluginOptions();

@Override
public void onEnable() {
    System.out.println("Hello world!");

    getServer().getPluginManager().registerEvents(new BreakBlock(), this);
    getServer().getPluginManager().registerEvents(new MobSpawns(), this);


}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

}

sterile token
proud forum
#

am i close?

sterile token
hasty prawn