#help-development

1 messages · Page 1604 of 1

fathom nova
#

you have >=

paper geyser
#

yup

#

just realized

chrome beacon
#

Well you're not calling it

fathom nova
#

it should be <

kind coral
#

anyone?

paper geyser
#

yup

heavy void
#
org.bukkit.craftbukkit.v1_8_R3.block.CraftBlockState cannot be cast to org.bukkit.material.Directional
``` whyyyy
fathom nova
heavy void
#

Im using the wrong directional? ' -'

fathom nova
#

Think so

chrome beacon
heavy void
fathom nova
#

I'm not sure

#

but it's something like org.bukkit.block.Directional

#

if that exists

#

why do you need blockstate

kind coral
chrome beacon
heavy void
#

How i cast the state

chrome beacon
#

You don't

heavy void
#

How i use directional on the block ,_,

chrome beacon
#

You create new MaterialData from the Material then cast that

#

I think..

lost matrix
lost matrix
#

Ah. Then:

  1. Update
  2. Do the stuff from above
heavy void
#

1.8 ' -'

#

It dont has org.bukkit.block.data ' -'

chrome beacon
#

Yeah do what I said

heavy void
#

Ill try put and modify this at my blockutils and try use.

#

at setFacingDirection

chrome beacon
#

Um that should get taken down lmao

narrow vessel
#

Latest compiled binaries and full source code

#

uh huh

#

totally legal

heavy void
#

Idk if this is legal, i only searched Spigot 1.8 setFacingDirection

narrow vessel
#

n

#

o

lost matrix
#

Its even for 1.8.4
And its def not legal

heavy void
#

uh, so, sorry.

chrome beacon
#

Anyway do what I said then getMaterial and set the new block

heavy void
#

Idk how to do that

chrome beacon
#

What part

heavy void
#

Idk how to create a MaterialData

chrome beacon
#

new MaterialData

heavy void
chrome beacon
#

.-.

#

Just create a new MaterialData

heavy void
#

Im saying about bytes

chrome beacon
#

Yeah blocks have byte values in 1.8

#

Use getData on the block

#

Wrong channel

heavy void
#

Im saying, how can i convert blockface to byte

chrome beacon
#

Why are you converting BlockFace

heavy void
#

I want to use BlockFace

#

or yaw

chrome beacon
#

For what

gentle meteor
#

Even when i cast it for some reason it still is CraftBlock

heavy void
#

Im making a mystery box plugin that has a command to add new mystery box to the map, and i want it to go directly on player direction.

gentle meteor
#

Like the compiler removes the cast for being unnesesary

chrome beacon
#

Yeah so do what I told you

#

I need you to trust me here...

#

Just do exactly what I said

chrome beacon
lost matrix
torn shuttle
#

oh wow I managed to permanently brick my intellij install

torn shuttle
#

no clue

#

it updated some plugins and seemingly bricked itself in the process

gentle meteor
#

Congrats on begoming a java ™️ teveloper

torn shuttle
#

you mean Oracle ™️ Java ™️ developer?

gentle meteor
#

Still less paim than c

torn shuttle
#

c# is lit tho

gentle meteor
#

Thats literaly like comparing javascript and java

lost matrix
#

Are you speaking of C# ?

gentle meteor
#

Yep comparing c# and c

torn shuttle
#

lol which one is js in this metaphor

lost matrix
#

Ah. I thought comparing C# and Java

#

Because those are basically the same language

torn shuttle
#

that's why I like it

#

easy to learn lol

#

if you know java and js it's fat stacks easy street

lost matrix
#

And the fact that types dont erase at runtime

torn shuttle
#

I've not done enough c# yet to see downsides but so far it feels a lot like java but slightly better

lost matrix
#

But if Java had those two features i wouldnt give C# a second thought

lost matrix
heavy void
chrome beacon
queen niche
#

if(sender instanceof Player) { Player player = (Player) sender;

How do I change this in so it also lets command blocks use this command?

torn shuttle
#

oh boy

#

commandsender

#

or bust

heavy void
lost matrix
queen niche
#

does this also let players use it?

chrome beacon
queen niche
#

or only command?

torn shuttle
chrome beacon
#

I think so

lost matrix
lost matrix
torn shuttle
#

what a bizarre behavioral pattern he has

lost matrix
# queen niche or only command?

Every CommandSender can execute every command. How you handle the different types of CommandSender inside your method is completely up to you.

quaint mantle
#

?paste

undone axleBOT
queen niche
quaint mantle
heavy void
torn shuttle
#

draw the rest of the owl

quaint mantle
chrome beacon
heavy void
#

Idk how to cast something ;;-;

quaint mantle
#

?learnjava

undone axleBOT
torn shuttle
#

(cast)something

heavy void
#

Uh

lost matrix
# queen niche Ah okay! thanks for explaining!

Example:

  @Override
  public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String string, String[] strings) {
    if (commandSender instanceof Player) {
      commandSender.sendMessage("You are a player.");
    } else if (commandSender instanceof BlockCommandSender) {
      commandSender.sendMessage("You are a command block.");
    } else {
      commandSender.sendMessage("Only a player or command block can execute this command.");
    }
    return true;
  }
heavy void
#

uh

#

lol

torn shuttle
lost matrix
heavy void
#

It is what i made with egtState()?

torn shuttle
#

(((triggered)triggered)triggered)

heavy void
#

Directional mdir = ((Directional) mdata); ?

chrome beacon
#

Yes

heavy void
#

I dont know the name lol

chrome beacon
#

Now use mdir to set facing

heavy void
#

But now i know lol

tame coral
#

Directional mdir = (Directional) mdata; is fine

#

no need for those parenthesis

torn shuttle
#

brackets and parenthesis are different things

tame coral
#

yeah mb

quaint mantle
#

Is there any way to pass in the getCommand method as an parameter to another method?

tame coral
#

i'm not fluent in english lol

torn shuttle
#

[] brackets () parenthesis {} curly braces/brackets

tame coral
#

corrected me

lost matrix
lost matrix
#

Assuming that values are unique

heavy void
#
Directional mdir = ((Directional) mdata);
```and now?
#

wait

#

my control + v isnt working

#

lol

torn shuttle
lost matrix
# quaint mantle ?

You cant pass methods to other methods. The question doesnt really make sense.

chrome beacon
heavy void
#

mdir.setFacingDirection(BlockUtils.yawToFace(this.location.getYaw(), false));

#

What i do with this now

quaint mantle
heavy void
#

Im using .setType to set the block.

lost matrix
quaint mantle
chrome beacon
lost matrix
# quaint mantle what do i do

You should have methods inside the class that contains the data structure to modify it.
Like
giveInventoryOfKey(String)
or
clearKeys(), sortValues() etc.
Just never pass the data structure to other classes

quaint mantle
#

ok

cold tartan
#

is there a way to make momentum last for longer? like less drag?

torn shuttle
#

vector math

lost matrix
heavy void
chrome beacon
heavy void
#

Then...
Why i made a materialdata...

chrome beacon
#

Because I found the EnderChest interface

#

You know I haven't done this before either

#

I'm literraly just looking around in Javadocs

carmine urchin
#

What would be the best way to store wins and losses and points (such as coins and gems and such). Would it be better to use static or use a class with constructor to make a manager? {

lost matrix
lost matrix
carmine urchin
shadow gazelle
#

I give up at this point lol

#

My plugin keeps saying item is null in this

#
size: 54
itemshop:
    categories:
        blocks:
            slot: 10
            item: "WHITE_WOOL"
            name: "&7&lBlocks"
            lore: "Blocks for building"
#
String mat = file.getString("itemshop." + category + ".item");
ItemStack item = new ItemStack(Material.getMaterial(mat));
#

That's in a for loop going through the categories

paper viper
#

Uhhh you are doing .item

#

Not like .blocks?

#

Unless I’m seeing something wrong

heavy void
#

lol

shadow gazelle
paper viper
#

What

heavy void
#

uh

paper viper
#

That doesn’t make sense

shadow gazelle
#

How

#

The loop loops through all of the keys under categories

heavy void
#

If blocks is the category, you dont need to put "itemshop.categories." + category?

shadow gazelle
#

blocks is a category

heavy void
#

Its like you doing itemshop.blocks.item

#

Dont itemshop.categories.blocks.item

shadow gazelle
#

What

heavy void
shadow gazelle
#

How the fuck did I forget that

#

big brain time

#

Thanks

heavy void
#

lol

#

np

shadow gazelle
#

Excuse me while I die

heavy void
#

It keeps returning null? XD

shadow gazelle
#

No

#

Just that I did dum

#

Ah yes

#

You close Minecraft and it keeps starting anyway

#

very nice, Forge

heavy void
#

Minecraf is a game made in a 4x4 house ' -'

shadow gazelle
#

Watch it crash when I try to open the GUI

heavy void
#

Maybe you need to use a material formatter, not?

shadow gazelle
#

Aaand I forgot to cancel the click event

#

n o i c e

#

Wait

heavy void
#

Lol, my server is returning Timed Out ,_<

shadow gazelle
#

No, I wasn't doing click events yet

heavy void
#

LOL, my Yaw to BlockFace converter is getting the opossite face

#

Why i need +1 restart, god? ,_<

#
EnderChest ec = new EnderChest(BlockUtils.yawToFace(this.location.getYaw(), false).getOppositeFace());
    this.block.setType(Material.ENDER_CHEST);
    this.block.setData(ec.getData());
```Its finally workinggggg.
hybrid spoke
shadow gazelle
#

How would I have to translate color codes in a string list?

hybrid spoke
#

loop over

lost matrix
heavy void
#

;-

manic bison
#

hey, anyone knows how to disable spectator menu when someone is on spectator mode ?

#

don't seem to find it on google

lost matrix
#

But never investigated it

manic bison
#

but on server siude, is there a way to cancel teleport

ivory sleet
#

probably

lost matrix
manic bison
#

so it'd be
on player teleport
if player is on spectator
event.cancel ?

lost matrix
#

pretty much

#

try it out ^^

manic bison
#

alrighty i'll try it, thanks

manic bison
# lost matrix That for sure

umm the problem is thaat while on spectator, i teleport the player, so it's gonna cancel the teleport event, anyway for my teleport event to bypass the restriction on PlayerTPEvent ?

manic bison
#

player's UUID? or what do you mean

lost matrix
# manic bison player's UUID? or what do you mean

Example:

  private final Set<UUID> bypassedPlayers = new HashSet<>();

  @EventHandler
  public void onTeleport(final PlayerTeleportEvent event) {
    final Player player = event.getPlayer();
    if (player.getGameMode() == GameMode.SPECTATOR && !this.bypassedPlayers.remove(player.getUniqueId())) {
      event.setCancelled(true);
    }
  }

  public void tpWithBypass(final Player player, final Location tpLocation) {
    this.bypassedPlayers.add(player.getUniqueId());
    player.teleport(tpLocation);
  }
#

To make it more clear:

  @EventHandler
  public void onTeleport(final PlayerTeleportEvent event) {
    final Player player = event.getPlayer();
    
    final boolean isSpectator = player.getGameMode() == GameMode.SPECTATOR;
    final boolean isBypassed = this.bypassedPlayers.remove(player.getUniqueId());
    
    if (isSpectator && !isBypassed) {
      event.setCancelled(true);
    }
  }
manic bison
#

alrighty, so the second code works ?

lost matrix
#

Everything there should work

#

The second code is the same as the first. Just written more verbose.

hasty prawn
#

Is there a benefit to writing final before everything

tame coral
#

Every entity has a UUID

#

And, as its name states, it's unique

lost matrix
hasty prawn
#

Hm, I guess. Aren't they still qualified if they're effectively final anyways?

lost matrix
#

So it makes the intent of the code much more clear. Depending on your code, it serves as a hint for the compiler to potenitally enable optimizations.
It also makes them thread safe by default.

hasty prawn
#

Hm interesting, thanks

lost matrix
#

I just configured my IDE to fill those things in for me and it helped me write cleaner code for a while.

hasty prawn
#

I usually know when my variables shouldn't be redefined, but I do understand the use if you're working in a team environment

dense goblet
#

How can I check if an item can be damaged

lost matrix
dense goblet
#

ah ty

lost matrix
grim ice
#

im rly bored anyone has an idea of a plugin

torn shuttle
#

asking again, does anyone know if loading worlds is possible on load instead of on enable?

lost matrix
lost matrix
#

But then i also dont see a reason to do that.

torn shuttle
# lost matrix But then i also dont see a reason to do that.

I want to guarantee that world loading happens before I try to load things in them and in general world loading comes with a shitload of logging data which is largely irrelevant for 99.99% of people but makes it hard to see anything else, especially if you're loading a lot of them

#

I can just shift stuff around but ideally I'd shuffle it way, way before the core loading part of things

lost matrix
#

Just block console output while your worlds are loading ^^

torn shuttle
#

I might have to, it's getting on my nerves

dense goblet
#

is there an event for an explosion caused by calling world.createExplosion?

dense goblet
#

really? Thought thats if a block itself explodes

torn shuttle
#

I've never really dealt with console message suppression, what's the starting point for that?

lost matrix
#

Which is what happens if you call World#createExplosion()

dense goblet
torn shuttle
#

I need a way to toggle between ddg and google search

#

easily

dense goblet
#

but I'll give it a go ty

torn shuttle
#

ok so just java then, nothing spigot-side?

lost matrix
chrome beacon
torn shuttle
#

iirc firefox had a system to quickly search in a specific location but I had to stop using it because the websites I have to use for work don't support it

lost matrix
#

Let me try just setting it to null XD

torn shuttle
#

I'm sort of surprised there's no event for this

#

sounds like a good event candidate

dense goblet
#

btw why is the yield inverted in the explosion events

lost matrix
lost matrix
# torn shuttle I'm sort of surprised there's no event for this

Im this far:

  @Override
  public void onEnable() {
    System.out.println("Test");
    this.getLogger().info("LoggerTest");

    this.disableSTDOut();

    System.out.println("Post_Test");
    this.getLogger().info("Post_LoggerTest");
  }

  public void disableSTDOut() {
    System.setOut(new PrintStream(new ByteArrayOutputStream()));
    this.getLogger().setLevel(Level.OFF);
  }

Console:

[23:34:07 INFO]: Time elapsed: 1177 ms
[23:34:07 INFO]: [SpigotSandbox] Enabling SpigotSandbox v${project.version}
[23:34:07 INFO]: Test
[23:34:07 INFO]: [SpigotSandbox] LoggerTest
[23:34:08 INFO]: Running delayed init tasks
[23:34:08 INFO]: Done (4.158s)! For help, type "help"
[23:34:08 INFO]: Timings Reset

So it suppresses some stuff but not the server logging.

torn shuttle
#

world loading is logged by servers right?

dense goblet
#

or whatever (1/creeper power) is

torn shuttle
#

yield isn't inversely proportional, the bigger the yield the bigger the explosion

dense goblet
#

nope, I logged it

#

in 1.16.5 at least

torn shuttle
#

I've actively used setting yields and I can guarantee that bigger numbers go bigger boom

#

you can create an explosion yourself

dense goblet
#

I'll test it again ig

#

what yield are you talking about though

torn shuttle
#

explosion yield

dense goblet
#

when creating an explosion or when receiving the event

torn shuttle
#

I've mostly messed with creating them

dense goblet
#

then that's different

#

that's power

#

but yield = 1/power for whatever reason

#

they use yield in the events

torn shuttle
#

no it's not

#

or at least the field is called yield

dense goblet
#

that's even worse then

#

they call it the same but the event has it inverted

torn shuttle
#

why do you think it's inverted

dense goblet
#

since logging it shows that it is inverted

torn shuttle
#

if you didn't know how to set the yield in the first place how do you know the one you're getting isn't accurate?

dense goblet
#

I use tnt which has a known yield of 4

faint vector
#

can someone explain to me as to why when I start a plugin java.lang.ClassNotFoundException: org.apache.commons.io.FileUtils appears even though I included it as a dependency when I compiled the plugin???

dense goblet
#

I'll test again comparing tnt's reported yield (0.25) vs a custom explosion with power 2.5

torn shuttle
#

power isn't yield

dense goblet
#

they call it yield as you said

torn shuttle
#

no "they" don't

dense goblet
#

then it has a known power of 4

torn shuttle
#

yes

#

not a known yield

#

have you considered that 4 power = .25 yield?

paper viper
#

And also bukkit I think has that dependency and you need to relocate it

#

To some different name

faint vector
#

oh

paper viper
#

It’s when you include the classes in the library into your jar file

#

So your classes can use them directly

faint vector
#

ooooh

faint vector
paper viper
#

Maven or gradle?

faint vector
#

maven

dense goblet
opal juniper
#

U need the compiler plugin

dense goblet
#

if the power is 2, the yield is 0.5

dense goblet
#

for creeper it is 0.333 and for tnt it is 1.0

#

it seems completely inconsistent

paper viper
#

Then you need to setup as so, and set your dependency to compile

dense goblet
#

also for custom explosion with power 2.5, it says yield is also 1.0

#

oh wait wow

torn shuttle
dense goblet
#

yield is the percentage chance to drop blocks

#

what a terrible naming scheme

dense goblet
#

and no javadocs in the jar doesnt help lol

#

so how do we get the power of an explosion?

torn shuttle
dense goblet
#

both of these seem to be the same though

#

you are looking at the creation side

torn shuttle
#

does tnt actually drop 100% of the blocks though

#

I thought it came with some loss

dense goblet
#

they changed it at some point iirc

#

recently

torn shuttle
#

well if they changed it after 1.0 it's recent to me

dense goblet
#

so it's impossible to get the power of an explosion from the event...

faint vector
paper viper
#

Np

rose aspen
#

How to spawn an Item with ProtocolLib-API for one player ?

I know I need these two:

  1. https://wiki.vg/Protocol#Spawn_Entity
  2. https://wiki.vg/Protocol#Entity_Metadata

But im not really able to understand and spawn a item!
Im trying to spawn a item with this lines of code:

                        EntityItem entity = new EntityItem(((CraftWorld) loc.getWorld()).getHandle(), loc.getX(), loc.getY()+2, loc.getZ(), CraftItemStack.asNMSCopy(i));

                        PacketContainer item = protocolManager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
//                        PacketContainer itemData = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);

                        item.getIntegers().write(0, entity.getId())
                                .write(6, 2);
                        item.getUUIDs().write(0, entity.getUniqueID());
                        item.getDoubles()
                                .write(0, loc.getX())
                                .write(1, loc.getY()+2)
                                .write(2, loc.getZ());```

But instead of an default stone item, it just spawn this https://i.imgur.com/vCe6vb7.png

Before I'm trying to use `ENTITY_METADATA`, I want to `SPAWN_ENTITY` get working xd
Im very very very new to protocolLib's API, but I dont have any idea how to work with it o.O
lost matrix
crude sleet
#
EntityShulker shulker = new EntityShulker(EntityTypes.ay, ((CraftWorld) loc.getWorld()).getHandle());
            shulker.setLocation(loc.getX(), loc.getY(), loc.getZ(), 0, 0);
            shulker.setFlag(6, true); //Glow
            shulker.setFlag(5, true); //Invisibility

What is the new flag for Glow and Invisibility? I cant find it

rose aspen
manic bison
#

hey, i'm having trouble with this code :

       public void onDeath(PlayerDeathEvent event) {
        event.setDeathMessage(null);
        Player player = event.getEntity(); 
        if(player.getKiller() != null){
        Player killer = player.getKiller();
        
         if(killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //If the killer has and helmet AND the player doesn't have a helmet : say "player has been killed by unknown"
             Bukkit.broadcastMessage(player.getName() + " s'est fait tuer par un inconnu");
         }
         if(killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //If the killer has an helmet AND the player has an helmet : SEND NOTHING
             return;
         }
         if(player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //if the player has an helmet AND the killer doesn't have a helmet : say "unknown has been killed by killer"
             Bukkit.broadcastMessage("un inconnu s'est fait tuer par " + killer.getName());
         }
         if(!player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //if the player doesnt have an helmet AND the killer doesnt have a helmet : say "player has been killed by killer"
             Bukkit.broadcastMessage(player.getName() + " s'est fait tuer par " + killer.getName());
         }
        
        
        
        
         
        }else{
        //killer is null
        }
         
         
       }```
#

in the chat it returns me nothing, like nothing AT ALL

rose aspen
manic bison
#

I did

rose aspen
#

I would recommend to just put overall a System.out.println to test your code is even working.
Place one right at the beginning, like over your event.setDeathMessage(null);

#

And check if the killer is an instance of Player

next crater
#

How do I check if a player stopped moving? (My ideia is: If a player stopped moving, they die :D, so they need to constantly move :)

manic bison
#

i'm adding one to each condition statement

lost matrix
manic bison
#

PlayerMoveEvent ?

rose aspen
next crater
rose aspen
#

Then just a Thread or Task

#

Check Pos

#

Check 2x pos and their distance and so on .. xd

lost matrix
#

With scale i mean: How many people do you expect to support?

next crater
#

fuck im dumb

#

im a begginer with spigot xd

lost matrix
#

Then i would actually just go with the PlayerMoveEvent

next crater
#

ok thx :v

#

cant I just do:

if (plyaer.getWalkSpeed() == 0) {
// do stuffs
}

#

somehow?

torn shuttle
#

you're looking for velocity

#

although iirc it's never 0?

#

since it's acceleration and there's always a negative y vector

#

something like that

next crater
#

fuck my life...

#

ok

#

so I think I would need to learn how to use the "RunTaskLater"

#

I searched a little bit

torn shuttle
#

probably not a bad idea

next crater
#

the concept is:

  • Create a HashMap (with the last player location)
  • Every second (with the RunTaskLater, I think) it would update the HashMap
  • If it updates with the same location, then it means that he stopped moving, and then he dies :D
#

again, sorry if my english sucks 😔

lost matrix
#

Just a quick mock up:

  private static final long MIN_DELTA_TIME_MS = 1000;
  private static final double MIN_DELTA_SPACE_SQ = 0.01 * 0.01;

  private final Map<UUID, Long> trackedTimes = new HashMap<>();

  @EventHandler
  public void onMove(final PlayerMoveEvent event) {
    final UUID playerID = event.getPlayer().getUniqueId();
    final Location from = event.getFrom();
    final Location to = event.getTo();
    final double distanceSquared = from.distanceSquared(to);

    if (distanceSquared > MIN_DELTA_SPACE_SQ) {
      this.trackedTimes.put(playerID, System.currentTimeMillis());
    } else {
      final long timeStanding = System.currentTimeMillis() - this.trackedTimes.getOrDefault(playerID, System.currentTimeMillis());
      if (timeStanding > MIN_DELTA_TIME_MS) {
        // Player stopped moving here
      }
    }

  }
next crater
#

did you test it?

lost matrix
#

Nope

next crater
#

np

lost matrix
#

And there is one big flaw i just realised. If they just stand still for a while nothing happens. Just if they move their mouse ever so slightly the time will get detected.

next crater
#

ok, I'll try to do that tomorrow

#

thx guys ❤️

manic bison
#

okay, i retested this code

       public void onDeath(PlayerDeathEvent event) {
        System.out.println("Begin");
        event.setDeathMessage(null);
        Player player = event.getEntity(); 
        Player killer = player.getKiller();
        if(player.getKiller() != null){
            if(killer instanceof Player) {
         if(player != null && killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //If the killer has and helmet AND the player doesn't have a helmet : say "player has been killed by unknown"
             System.out.println("killer has helmet AND plyer no helmet");
             Bukkit.broadcastMessage(player.getName() + " s'est fait tuer par un inconnu");
         }
         if(player != null && killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //If the killer has an helmet AND the player has an helmet : SEND NOTHING
             System.out.println("both helmeted");
             return;
         }
         if(player != null && player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //if the player has an helmet AND the killer doesn't have a helmet : say "unknown has been killed by killer"
             System.out.println("player has helmet AND killer doesnt have helmet");
             Bukkit.broadcastMessage("un inconnu s'est fait tuer par " + killer.getName());
         }

#
         if(player != null && !player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             //if the player doesnt have an helmet AND the killer doesnt have a helmet : say "player has been killed by killer"
             System.out.println("both no helmet");
             Bukkit.broadcastMessage(player.getName() + " s'est fait tuer par " + killer.getName());
         }
        }}else{
        }
       }```

and all conditions doesnt work, checked it with sysouts, only the first sysout works which tells "Begin"
any ideas ?
#

honestly, sorry for bothering much, but i really cant find the answer i tried everything i could

#

conditions just arent firing

ivory sleet
#

kinda clustered with comments so slightly hard to tell

manic bison
#

i'll delete

lost matrix
#

You should def group the conditions and early escape

ivory sleet
#

write self expressing code btw 😄

manic bison
#

okay, i retested this code

       public void onDeath(PlayerDeathEvent event) {
        System.out.println("Begin");
        event.setDeathMessage(null);
        Player player = event.getEntity(); 
        Player killer = player.getKiller();
        if(player.getKiller() != null){
            if(killer instanceof Player) {
        
         if(player != null && killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             System.out.println("killer has helmet AND plyer no helmet");
             Bukkit.broadcastMessage(player.getName() + " s'est fait tuer par un inconnu");
         }
         if(player != null && killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             System.out.println("both helmeted");
             return;
         }
         if(player != null && player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             System.out.println("player has helmet AND killer doesnt have helmet");
             Bukkit.broadcastMessage("un inconnu s'est fait tuer par " + killer.getName());
         }
         if(player != null && !player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET)) {
             System.out.println("both no helmet");
             Bukkit.broadcastMessage(player.getName() + " s'est fait tuer par " + killer.getName());
         }
        }}else{
        //killer is null
        }
       }```
#

here

lost matrix
#

Example:

Player killer = player.getKiller();
if(killer == null) {
  return;
}
manic bison
#

i'll just replace return with a sysout

next crater
#

sorry if it is a dumb question, but whatever

lost matrix
manic bison
#

alright killer isnt null

lost matrix
manic bison
#

because no sysout

#

but it tells me on console "exception : null on line 49" which is

#

if(player != null && killer.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET) && !player.getInventory().getHelmet().getType().equals(Material.LEATHER_HELMET))

#

my first condition

next crater
#

my english never was the best

lost matrix
# manic bison if(player != null && killer.getInventory().getHelmet().getType().equals(Material...
  @EventHandler
  public void onDeath(final PlayerDeathEvent event) {
    final Player player = event.getEntity();
    final Player killer = player.getKiller();

    if (killer == null) {
      return;
    }

    final ItemStack playerHelmet = player.getEquipment().getHelmet();
    final ItemStack killerHelmet = killer.getEquipment().getHelmet();

    final Material playerHelmetType = playerHelmet == null ? null : playerHelmet.getType();
    final Material killerHelmetType = killerHelmet == null ? null : killerHelmet.getType();

    final boolean playerHasLeatherHelmet = playerHelmetType == Material.LEATHER_HELMET;
    final boolean killerHasLeatherHelmet = killerHelmetType == Material.LEATHER_HELMET;

    if (playerHasLeatherHelmet) {
      if (killerHasLeatherHelmet) {
        System.out.println("Both have a leather helmet.");
      } else {
        System.out.println("Only the player has a leather helmet.");
      }
    } else {
      if (killerHasLeatherHelmet) {
        System.out.println("Only the killer has a leather helmet.");
      } else {
        System.out.println("Nobody has a leather helmet.");
      }
    }

  }
#

This code doesnt need comments because the variable names are expressive and tell you exactly what you are trying to do.

manic bison
#

oh so bsiclly i can just do this

#

oh

#

allright thank you so much ❤️

manic bison
lost matrix
#

Youll get there if you keep coding

manic bison
#

i hope so, i started learning java 4d go

#

ago

#

all day just clicking & clicking my keyboard

slow oyster
#

Anybody use Hibernate in their plugins? I'm getting a problem when closing the SessionFactory in onDisable() Caused by: java.lang.ClassNotFoundException: org.h2.mvstore.MVMap$2 even though I can definitely see the anonymous classes shaded in the jar

lost matrix
#

You can block the main thread really fast if you are not careful

slow oyster
#

I use it in work with Spring Boot which is really nice, so thought I'd give it a go standalone

lost matrix
#

Do you fully understand how the lifecycles work and when hibernate is actually accessing a database? Because you really dont want that to happen on the main thread.

#

Also JAP entities are quite primitive. Serializing more complex data with hibernate is a bit of a hustle.

#

Especially if they are life Objects

slow oyster
#

I hadn't thought about the main thread issue tbf

lost matrix
#

Because even serializing an ItemStack with hibernate could result in half the server being serialized recursively

#

You can play around and give me an update if you found a nice way of decoupling the JPA Entity from the main thread. Maybe with a proxy class?

slow oyster
#

I'm currently serializing everything into a YAML file so it can't be much worse. And yeah I was planning on storing most of the Bukkit ConfigurationSerializable's as JSON anyway

slow oyster
#

Not sure I get what you mean by decoupling the entity from the main thread though? Do you mean the Queries to get/update entities?

lost matrix
#

Oh you probably dont want full autonomous persistence. So you just want to serialize/deserialize the entities in a DB and then schedule the queries yourself?

slow oyster
#

Yep that's what I'm doing, currently I'm storing everything in HashMaps and Lists in memory etc. And then that all gets serialized into a YAML file when the world file is saved. It's grew fairly fast and so it's not practical doing it all in memory anymore.

lost matrix
#

Holy moly. Too big for memory? You need to have a TON of data then. I lately was on a server project that just kept the data of the latest 5000 users in memory. Didnt even occupy 2 gigs of ram.

slow oyster
#

No it's not too big for memory

#

It's just annoying to maintain

lost matrix
#

I just throw everything into gson and register custom serilizers for the more complex types. 😄

slow oyster
#

Especially when it's all relational data, and doing all that object orientated is getting annoying.

#

I.e storing a HashMap with player ID's and everything related to them. Then a hashmap of Locations and everything related to players at that location.

#

I'm planning on utilizing Geospatial queries for the Locations which will help a lot

lost matrix
#

Oh i see. I normally have a more centralised data approach.
Map<UUID, PlayerData>
And PlayerData contains all the data i need.
Then throw everything into Gson -> MongoDB and hide it behind a AsyncLoadingCache for access to offline data.

slow oyster
#

I basically have HashMap<String, HashMap<String, ChestLinkStorage>> which is UUID -> StorageName -> Object

lost matrix
#

But do you really want Hibernate then?
Because custom serialization with hibernate is a bit tedious.

slow oyster
#

All I need to store is player UUID's, String and ItemStack's tbh

#

There's just a lot of relationships between them all

#

Which is why I think a relational model will work much better

#

I.e get all Storages that Player X is a member of. Or that Player Y is the Owner of. Will be much easier

lost matrix
#

But if you are confident with custom mappings then go for hibernate

slow oyster
#

I thought I need to use those on top of Hibernate?

#

Hibernate will automatically update database schemas for me too on upgrades

lost matrix
proud basin
#

@eternal oxide and 7smile7 I was talking to the devs that made NBT api and they said that it's not possible to do what im trying to do

lost matrix
#

Hibernate is there to abstract the queries away from you

proud basin
#

yeah

#

He said that plain file is slower than sql

#

Is that true?

lost matrix
proud basin
#

ah ok

#

So I guess im sticking to sql

lost matrix
#

I mean... Databeses have build in memory caches. So that why for repeated access they are in fact faster

#

But you can do the same with flat files.

slow oyster
proud basin
#

I guess ima have to deal with that delay I have

#

I think my query bad though

#

it takes longer than 10ms

slow oyster
#

10ms sounds good for an SQL query to me...

lost matrix
slow oyster
#

Do you have an N+1 problem by any chance?

lost matrix
slow oyster
#

I.e are you firing off a shit load of queries one after the other?

proud basin
#

no

slow oyster
#

So why is 10ms slow?

proud basin
#

I never said it was slow

slow oyster
#

Oh right, I thought you meant that SQL was your bottleneck

proud basin
#

Wait isn't there a way to check if its running on your main thread

lost matrix
rose aspen
#

v1_17_R1

worldly ingot
proud basin
#

ah ok thank you

#

wait where should I actually be running this?

worldly ingot
#

SQL? Off thread wherever possible. This is where CompletableFutures come in handy

lost matrix
proud basin
#

No Bukkit.isPrimaryThread()

#

What is CompletableFutures though?

#

ugh

#

why is the server crashing

lost matrix
# proud basin No ``Bukkit.isPrimaryThread()``

As we told you yesterday. Really edge case method you will probably never use.
You first need to understand how to properly spawn a new thread, do something on it, and
sync back with the main thread when you are done.

slow oyster
#

Can you call Bukkit APIs inside a Future?

#

I presume not?

lost matrix
rose aspen
proud basin
#

Do you close the Connection first or PreparedStatement I forgot

ivory sleet
#

latter probably

slow oyster
#

I could probably extend CompleteableFuture and just make it call directly through BukkitScheduler then?

ivory sleet
#

why

ivory sleet
#

just wrap the bukkit scheduler into an executor and the pass that to the future?

proud basin
#

if Bukkit.isPrimaryThread() returns true that means its running on main thread correct

ivory sleet
#

ye

proud basin
#

ah shit

#

ok

lost matrix
rose aspen
slow oyster
ivory sleet
#

well what exactly do you want?

lost matrix
slow oyster
#

CF? I was just going to look at wrapping my queries to return Future's so that the queries can be run on a separate thread?

#

Oh completableFuture

rose aspen
ivory sleet
#

James then just use CompletableFuture#runAsync(command) and supplyAsync(supplier)

#

Or no?

#

Might wanna pass a custom executor actually

slow oyster
#

I suppose I want it to run on a separate thread and then I want the stuff in the future to be able to be run on the Bukkit thread

ivory sleet
#

Sure

lost matrix
#

Here is an example how you would load some data async and then apply an action to the data on the main thread.

  public CompletableFuture<PlayerData> applyToPlayerData(final UUID playerID, final Consumer<PlayerData> playerDataConsumer) {
    return CompletableFuture.supplyAsync(() -> {
      final File playerFile = getPlayerFile(playerID);
      final PlayerData playerData = readAndLoadPlayerData(playerFile);
      return playerData;
    }).thenAccept(playerData -> {
      Bukkit.getScheduler().runTask(SomePlugin.getInstance(), () -> playerDataConsumer.accept(playerData));
    });
  }
ivory sleet
#

Aww smile is fast as usually

proud basin
slow oyster
#

Okay cool, I suppose I can write a utility method that would return a Consumer directly from that method to be consumed in the BukkitScheduler

lost matrix
#
  public void spawnItemWithProtocolLib(final ItemStack itemStack, final Location location) {
    final ThreadLocalRandom random = ThreadLocalRandom.current();

    final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    final PacketContainer itemPacket = manager.createPacket(Server.SPAWN_ENTITY);
    final PacketContainer metaPacket = manager.createPacket(Server.ENTITY_METADATA);

    final int entityID = random.nextInt();
    final int entityType = 41;
    final int extraData = 1;

    final StructureModifier<Integer> itemInts = itemPacket.getIntegers();
    itemInts.write(0, entityID);
    itemInts.write(1, entityType);
    itemInts.write(2, extraData);

    final StructureModifier<UUID> itemIDs = itemPacket.getUUIDs();
    itemIDs.write(0, UUID.randomUUID());

    final StructureModifier<Double> itemDoubles = itemPacket.getDoubles();
    itemDoubles.write(0, location.getX());
    itemDoubles.write(1, location.getY());
    itemDoubles.write(2, location.getZ());

  }
opal sluice
#

Hey guys, how would I check if a player is looking at a location

#

Like, getting the direction, and by the direction he can see the location

lost matrix
#

You can however easily find out what block the player is looking at by just using the ray trace method of Player

opal sluice
#

Yup, but I need to have this ray being able to tell me if it actually passes inside a "region"

#

Basically, like the hitboxes works

rose aspen
quaint mantle
rose aspen
#

Looking at the client ? I've never done this before

quaint mantle
#

Yea you can get the client source and it has an implemented server

rose aspen
#

Ah okay

lost arch
#

Is this the right place to ask about plugin development? I’m looking to port my fabric mod.

waxen plinth
#

This is the channel for it, yes

lost matrix
lost arch
#

How close are the APIs in terms of functionality?

lost matrix
rose aspen
#

If it helps idk

lost matrix
# rose aspen Did you see an Item with your instance ?

Now you will have to do something like this:

    final StructureModifier<Integer> metaInts = metaPacket.getIntegers();
    metaInts.write(0, entityID);    

    final WrappedDataWatcher watchableObjects = new WrappedDataWatcher();
    // Do some weird stuff here idk
    final StructureModifier<WrappedDataWatcher> metaDataWatcher = metaPacket.getDataWatcherModifier();
    metaDataWatcher.write(0, watchableObjects);

And fill the WrappedDataWatcher with stuff. But im not 100% sure. Maybe Plib has some separate wrapper for Items

lost arch
#

Is hot registering and unregistering commands possible?

lost arch
#

In Fabric you have direct access to brigadier

lost matrix
#

But you usually dont want to do that

lost matrix
lost arch
#

Is there a spigot equivalent to mixin? My mod cancels methods.

lost matrix
#

What do you mean by "cancels methods"?
Spigot has a command framework.

#

If you want to do bytecode injection then you need to shade that in yourself.

lost arch
#

In fabric I can inject into a Minecraft method and then return from that

#

Yeah

#

Wdym shade it in?

lost matrix
#

Use your dependency manager (maven or gradle) and provide an injection library like ASM with your plugin.

#

So shade the library into your plugin.

proud basin
#

How bad of performance can you lose from getting a value from your sql db if it's on the main thread?

lost matrix
proud basin
#

Is there a reason why my server isn't crashing?

lost matrix
#

You didnt encounter any problems with your DB so far and you probably dont stress test the DB to simulate what would happen with multiple users online.

proud basin
#

right

#

So when your connecting to the db do you still not want to be on the main thread?

lost matrix
#

If you DB (or your hard drive) is busy then the main thread will just wait (worst case) several seconds for a response.
In this time nothing on the server will function. Every user will stand still, every entity will stand still, nothing falls moves or flows. The server is just dead for that time.

unreal quartz
#

worst case scenario using default values you could be waiting 30 seconds for a connection timeout

#

by that time all your players have been disconnected

proud basin
#

hm ok

lost matrix
proud basin
#

Is there different threads to let me return a long?

lost matrix
proud basin
#

right

#

but

#

wait do I just need to put the connection in a new thread?

#

Sorry I'm just trying to understand this

quaint mantle
lost matrix
proud basin
#

ok

quaint mantle
#

Look just run your stuff with a bukkit runnable async.

#

You’re better off with that for now

proud basin
#

But then I gotta redo everything

lost matrix
#

Ok so Minecraft is a tick based game.
Every 50ms a new tick begins.
First Minecrafts core mechanics will be applied. All mobs will be ticked. Packets will be prepared and read. Chunks will be loaded etc. This consumes the first 10, 20, 30 ms
Then there is some Spigot stuff happening. Event handling. Runnables will be executed etc. This lasts another lets say 5ms.
Now you have maybe 25ms to waste with your plugins code. If you start a query that lasts longer than 25ms then the next tick has to be delayed. This results in fewer ticks per second being scheduled.
(1000ms / 50ms = 20(ticks) but if a tick lasts 60ms on avg then 1000ms / 60ms = 16,66(ticks))
@proud basin

lost matrix
# proud basin But then I gotta redo everything

But i most cases you dont need to do complicated stuff like this.
You can always listen for the AsyncPlayerPreLoginEvent which is async on default and just load all the player specific data there into memory.
Then just work with the data in memory.
Then listen for the PlayerQuitEvent and save the player specific data back into your DB using the BukkitScheduler.runTaskAsync(...)

unreal quartz
#

fancy diagrams

lost matrix
torn shuttle
#

hello, it is I, magmaguy, master of java programming here to teach the people who make java how to make java better

#

lads, you have instanceof, give me notinstanceof

lost matrix
#

!(X instancof Y)

#

lul

torn shuttle
#

every time I do (!(a instanceof b)) a fragment of my soul exits through my ass

lost matrix
#

But i get you. Ive always wanted something like that because the brackets are tedious

torn shuttle
#

hell

#

I'll even take a !instanceof b

lost matrix
#

Same. But that would violate the syntax

torn shuttle
#

yes but not having it violates my soul

lost matrix
#

XD

torn shuttle
#

anyway thanks for coming to my tedx talk, you can purchase my book "how java ruined my soul" on your way out for $45

hasty prawn
#

Is it signed?

torn shuttle
#

you can pay an additional $20 for the signature

hasty prawn
#

deal.

torn shuttle
#

sure just paypal me the $65 and I'll send you a copy

worldly ingot
#

I'd take a !instanceof too sadge

#

Oracle pls

torn shuttle
#

you know what I've not checked at all but I bet c# has a way to deal with this that is entirely seamless

lost matrix
#

Just write an email to the oracle HQ notinstanceof when?

worldly ingot
#

I don't actually think it does, Magma

#

iirc it too uses !(value instanceof whatever)

torn shuttle
#

java is like the lame stepfather who hits you with a belt when you try to put on your hat backwards and c# is the cool dad who picks up your friend in a convertible while blasting russian hardbass

worldly ingot
#

Oh it's is in C#. Sorry. Haven't done much C# in a while

proud basin
lost matrix
#
if(C is not typeOf(D)) {

}
worldly ingot
#

But yeah, same issue

torn shuttle
#

hm seeming obj is MyClass is valid syntax

#

so

#

see

#

cool russian hardbass dad

cold tartan
#

how do u get the paper api?

torn shuttle
#

I mean sure he'll be in a car wreck one of these days but it will be a cool car wreck and he probably will have a dashcam

lost matrix
worldly ingot
#

Well you're definitely in the wrong server, burger lol

cold tartan
#

oh crap ya lol

torn shuttle
#

C# is lit and once I start using it for unity I will probably never really come back to java

lost matrix
proud basin
#

ah ok

#

so I think I am actually doing it completely wrong

lost matrix
lost matrix
torn shuttle
#

for the foreseeable future I have the liberty of choosing which programming language I want to use

worldly ingot
#

Definitely overcomplicating that because Bukkit's scheduler will suffice for that

lost matrix
hasty prawn
#

Python 🤮

torn shuttle
#

I don't really see why I'd ever bother with python

worldly ingot
#
Bukkit.getScheduler().runTaskAsync(plugin, () -> {
    // Do your SQL stuff in here. No need for the Thread creation
});```
torn shuttle
#

unless it really changes in the future

proud basin
lost matrix
#

In some industries getting stuff done quickly with scripts is more important than maintainability

worldly ingot
#

Not completely wrong. What you wrote works fine, just no reason to start the thread yourself when Bukkit supplies you with a thread pool

torn shuttle
#

well if things go right I won't need to worry about that

lost matrix
lost arch
#

Few words go slow

proud basin
#

ah

lost matrix
hasty prawn
#

It's also super ugly imo

#

Having indentation matter is

#

:(

torn shuttle
#

for some reason every time I see a python program is seems to be made to just process some math and maybe make some graphics

#

just lots of number crunching

lost matrix
# proud basin ah ok so I did it completely wrong

You should probably follow the routine ive described earlier.

  1. Load the Data from a DB in the AsyncPlayerPreLoginEvent
  2. Use the data in memory (so a Map for example)
  3. Save the data back when the player quits (PlayerQuitEvent) then you can just use an async task from bukkit
#

So you dont have to constantly tinker with multithreading or async tasks.

proud basin
#

hm

proud basin
lost matrix
#

Because you only need a players cooldown when he is actually online, right?

proud basin
#

What if the command /reload was used?

lost matrix
proud basin
#

But it's such a useful command

lost matrix
#

But you can just iterate over all online users on onEnable() and onDisable() to load/unload the data on reaload.

proud basin
#

I guess

lost matrix
proud basin
#

Then why did they add it?

lost matrix
proud basin
#

mojang did

lost matrix
#

I think its a bukkit command

proud basin
#

uh

#

I believe its in vanilla

#

although haven't touched vanilla in a long long time

lost arch
#

Can I cancel chat from going through to other players in a spigot plugin?

lost matrix
#

Anyways. You can support reloads by saving all online player data onDisable() and load all online player data onEnable()

lost matrix
proud basin
#

alright

lost matrix
#

Which is done using a library called ProtocolLib

lost arch
#

Cool beans, another question, can I run commands from a plugin or run Minecraft methods?

lost matrix
#

It injects a packet handler into the netty pipeline

maiden thicket
lost arch
#

Thx

proud basin
maiden thicket
#

u cant run client methods from mc but u can run nms methods from the net.minecraft.server package

lost matrix
maiden thicket
#

in order to do that u have to use buildtools and compile spigot

lost arch
#

Can I capture server console log output?

lost matrix
lost arch
proud basin
#

7smile7

lost matrix
#

jtx

proud basin
maiden thicket
lost matrix
# proud basin bump to you

Ah. Yes. Thats the right event. You dont need to do anything special here other than loading the data.

proud basin
#

ok so I don't need the scheduler

lost matrix
#

Nope. Just load the data right there. The event is already async. So stuff you call in this event wont be on the main thread.

proud basin
#

ok

opal sluice
#

Does someone know what's the math to calculate if a vector does intersect a plane ?

proud basin
#

I think im gonna have to use getter and setters

#

well actually I don't

#

but

lost matrix
proud basin
#

Alright the asyncpalyerprelogin is event is done

opal sluice
#

Cause I'm trying to dev a custom hitbox system that need to know if the player is actually looking at the hitbox

void haven
#

Hello I need help with Bungee

proud basin
#

Step 1 is completed

lost matrix
opal sluice
#

Yeah, but that's a box

torn shuttle
#

say you have class A then class B extends class A then class C extends class B , and they all have a #remove() method which gets more complex as you go down, is the correct solution to override and then have a non-overwritten helper method that contains the logic for the #remove method so you don't just copy paste code from class to extended class?

lost matrix
torn shuttle
#

it feels sort of dumb

opal sluice
proud basin
void haven
#

I need help with bungee!

lost matrix
# opal sluice Any kind of shape

Ok then be prepared for some ridiculous amount of math. Calculating the intersection of a vector and an arbitrary shape is complex.

lost matrix
opal sluice
#

I was thinking of getting all the shape's planes (from the shape's coordinates) and then calculate if the vector does intersect one of the planes

#

Which would result in the player looking at the shape (I guess)

torn shuttle
#

ideas for my polymorphistic nightmare?

lost matrix
proud basin
#

Is it recommended to always close the connection?

void haven
#

name "Command Pannel"

lost matrix
silk mirage
#

command panel?

void haven
torn shuttle
silk mirage
#

Is that a bungeecord plugin?

silk mirage
lost matrix
torn shuttle
#

I'm looking at raymarching already lol

#

I feel like I half remember this

void haven
lost matrix
torn shuttle
#

hoh

#

dumb

lost matrix
#

This calls remove from the super class before it runs other code

torn shuttle
#

man I even did that in other parts of my plugin, I need to go get some more coffee

#

thanks

#

man I am doing some stupid shit today

void haven
#

So i have to install it in my bungee for it to work aswell? @silk mirage

lost matrix
silk mirage
opal sluice
lost matrix
#

A fixed set of shapes? Or even custom shapes imported from something like blender

opal sluice
#

Imagine having a dragon, with a proper hitbox that is shaped as the dragon

lost matrix
dusk flicker
#

Has anyone had problems with the maven shade plugin not working on Java 16?

#

Cant seem to get mine to shade anything in with an unsupported class ver of 60 error

lost matrix
opal sluice
silk mirage
#

compiler target

dusk flicker
#

I have maven.compiler.target in the properties set to 16

lost matrix
dusk flicker
#

I have that aswell

#

My shade plugin is ver 3.2.4 and that's the latest ive seen

silk mirage
lost matrix
lost matrix
dusk flicker
#

It's when I run mvn clean install

lost matrix
#

Ah. Then make sure maven properly recognises your installed java version.

torn shuttle
silk mirage
#

that is not working

lost matrix
dusk flicker
void haven
#

It’s a plug-in

lost matrix
void haven
#

Named command panel

lost matrix
torn shuttle
#

so is non-spherical raymarching faster than ray tracing in general and then sphere tracing would only be faster in very specific contexts?

#

sphere tracing sounds like a technique someone would've used back in the ps2 era in order to squeeze more juice out of the hardware but still have a form of tracing

quaint mantle
#

I know this thing has been fixed for ages: https://bugs.mojang.com/browse/MC-106202 but was the fix only on the chest block glitching out?
if so do you think it would still be possible to open a chest with a 3 chest layout?

lost matrix
dusk flicker
quaint mantle
# lost matrix You can do it via code for sure

I had an idea of how this could be utilized but yeah idk if you really can open the gui with a triple layout, I have not looked into it at all so I really don't know anything about it

lost matrix
torn shuttle
#

you know what I'm going to implement sphere tracing on my plugin just for the hell of it

dusk flicker
quaint mantle
#

I just remembered this old bug and got an idea out of it so it would be cool to get it working

torn shuttle
#

you should probably be asking that on the worldedit discord

quaint mantle
torn shuttle
#

then you have your answer

#

sure it's possible

#

anything is possible if you have an infinite amount of time

#

there's probably a way to do it using reflections

lost matrix
quaint mantle
lost matrix
#

It means that you basically scan the actual class file instead of getting the information from the runtime.
So you can change stuff you are normally not supposed to even see.

torn shuttle
#

reason why it gets mentioned so much is because it and nms are the only ways of doing some pretty crucial stuff

#

cough pathfindergoals cough

quaint mantle
# lost matrix 🤷

just read thru some patch notes on the bug and it seems as if the actual gui problem wasn't ever actually fixed, the only thing that was fixed was the chest bug that allowed it

lost matrix
quaint mantle
#

yeah I see

#

what happens if you try setting exactly the 3 chest size? so 81

quaint mantle
#

hmm

#

I guess it was patched in some way then in the CraftContainer

lost matrix
#

I tried going down to 7 * 9 which is one row more that usual

lost matrix
quaint mantle
#

oh lmao

#

that wasn't like that before was it?

lost matrix
#

Nope. Im pretty sure that when im going to try and tinker a new version of this container with 9x9 slots the client would just crash.

proud basin
#

So I managed to get the list of columns but how could I just get the rows from those columns (sql)

quaint mantle
lost matrix
#

but im out for today

quaint mantle
#

cya

cold tartan
#

oh wait

#

found it

#

forgot to add the plugin to my plugins folder

opal sluice
#

Does someone has the bit of code where the damages are calculated ?

opal sluice
#

I would like to know the damage a player would do if he hits something WITHOUT hitting something

dusk flicker
#

Likle you want to damage someone?

quaint mantle
#

but yeah container sizes are checked in some ways so maybe you could do something with reflection idk

opal sluice
paper geyser
hasty prawn
opal sluice
paper geyser
#

ahh

#

forgot to notate that

#

Entity ent = Bukkit.getWorld("rpg").spawnEntity(event.getLocation(), EntityType.SLIME);

#

what is the issue with this

hasty prawn
#

Does the world "rpg" exist

paper geyser
#

yes

opal sluice
#

Send the full error pls

hasty prawn
#

^

paper geyser
#

alright

quaint mantle
hasty prawn
#

Hm, lemme see if I can find anything

paper geyser
#

alright it took a bit of effort to get a latest.log that isn't so big that I cant save it to the hastebin but here it is

hasty prawn
#

Oh, spawnEntity is calling SlimeReplace(EntitySpawnEvent), so it's infinitely looping

paper geyser
#

hmm

#

how would I work around this?

#

I thought my if (event.getEntity().getType() != EntityType.SLIME || event.getEntity().getType() != EntityType.PLAYER || event.getEntity().getType() != EntityType.DROPPED_ITEM) { would cover that

#

WAIT

#

IT SHOULD BE =

#

NOT !=

#

or

#

hmm

#

it should be .equals not == right/

#

hmm

#

wait no

#

ahh i got it nvm

quaint mantle
hasty prawn
#

👍

quaint mantle
hasty prawn
#

This is terribly confusing the way they've done this ngl

lost arch
#

Is spigot built on top of vanilla or is it completely reprogrammed from the protocol?

hardy swan
paper geyser
#

I figured it out

#

yeah

#

did this instead

#
            if (event.getEntity().getType() == (EntityType.SLIME)) {
                return;
            }
            event.setCancelled(true);```
#

silly mistake haha

#

thanks for scrolling up and still trying to help though! Appreciate it

hardy swan
#

or is there sth else you are doing before the second if

paper geyser
quaint mantle
#

How to check if offlineplayer exists?

paper geyser
#

wait

#

hmm

paper geyser
#
    public void SlimeReplace(EntitySpawnEvent event) {
        if (event.getEntity().getType() != EntityType.SLIME || event.getEntity().getType() != EntityType.PLAYER || event.getEntity().getType() != EntityType.DROPPED_ITEM) {
            event.setCancelled(true);
            if (event.getLocation().getWorld() == Bukkit.getWorld("rpg")) {
                Location center = new Location(Bukkit.getWorld("rpg"), 68, 69, 125);
                Double distance = 75D;
                Location location = event.getLocation();
                if (location.distanceSquared(center) <= distance * distance) {
                    Entity ent = Bukkit.getWorld("rpg").spawnEntity(event.getLocation(), EntityType.SLIME);
                    Slime slime = (Slime) ent;

                }
            }
        }
    }
}
``` this code was giving the error which does have that
#

plus other stuff

hardy swan
#

no what im saying is

hardy swan
#

suppose A || B but ~A -> B, then A || B is always true

little heron
#

Before I begin, this idea has come from me experimenting with numerous plugins as I plan my server to death. Real shoutout to @NoLogic with his Vivaldi plugin for what I feel is the best seasons plugin out there right now. Now here we go!

#

Using a secondary world(s) to simulate seasons in Minecraft

#

To my understanding a plugin should have the capability of modifying blocks, tracking movement, altering game states/rules, force texture packs, alter files, and enabling chunks.

What should be possible to simulate seasons without seriously altering biomes or being global projections across the server while also controlling good tps for a immersive world, this would give the most controlling form of seasonal support in vanilla Minecraft. It plays as this, a world (A) is generated with another world (B) that should be exactly the same. World A serves as one season, most likely summer. World B serves as a winter variation of the world.

The worlds both A and B will be generated by seed if the server is just normal Minecraft. If using custom maps World A would be generated with whatever features (new generation or custom map) then copied to world B. (raw region files for optimization). This second option would most likely be the optimal way to do it even if its vanilla Minecraft seed generation.

Next, we alter World B to be winter. This is done by having a loaded chunk alternate through the world checking ever chunk. This is while the server would be offline from player use, in server setup or when setting up this plugin or to play catch up on the following functions. World B is modified using functions to modify blocks so that (based on biome type, an uploaded image map, or coordinate/height-based settings) So that regions are snow covered, and water now ice.

#

Now we have world A in summer and world B in Winter. Hit the start button and players join. These players actions will be tracked in the following way to keep world B synced to world A. Real time editing could be enabled so that new blocks made or destroyed are detected including all attributes such as generation, changes in block states, items in chests, accounting for seasonal variation etc) and is copied into a currently FROZEN world B. world B should be programmed where the only block changes made can be done by this interaction between World A and B. Functionally World B is dead. It will have world game rules to disable for example natural decay of snow in the winter world even in say a desert. If tps becomes an issue, the changes could be saved to a file that will chronologically act it out in World B when server tps improves or set up for a maintenance.

#

Winter approaches and the server now must load world B and unload A. In this process it tells the server to use a winter version resource pack instead of vanilla summer or unloaded one. The plugin also updates all player locations in world B to match world A. Server reboots, players join and now are in a winter tone of their world where the texture pack with optifiine would be used to solve ambience, textures, biome colors, rain to snow based on biome, sound, you name it) to account for the visual aspect, so that it snow in a plains biome that has been altered to be covered in snow.

Pros to this: With techniques to minimize server resources when making the opposite variation world or worlds, players can enjoy exploring without lag. Then they can explore complete chunks that are already loaded into another seasonal type. This is due to the pre scan of making seasonal affects across an entire world before the server starts up and having a function that when new chunks are generated load additional resources to make it seasonal type of the current world a player is in, adding a layer to current world gen (which can be copied to the other worlds later).

The downsides is players would be forced to use a resource pack and the server would be down between seasons for a restart. .

Thoughts?

quaint mantle
#

ehm… why?

#

having 4 worlds that are exactly the same is not minimizing resources

#

also instead of using 4 worlds you could just fake biomes for snowing and stuff like that

#

but creating 4 worlds that would need to be constantly updated for changes will definitely cause issues

quaint mantle
#

Hello spigot how can I open workbench and set result and metric? when I use CraftingInventory craftingInventory = (CraftingInventory) player.openWorkbench(null, true); craftingInventory.setResult(item); player.openInventory(craftingInventory);, the error occursjava.lang.ClassCastException: class org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryView cannot be cast to class org.bukkit.inventory.CraftingInventory (org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryView and org.bukkit.inventory.CraftingInventory are in unnamed module of loader 'app')

and when I use CraftingInventory craftingInventory = (CraftingInventory) Bukkit.createInventory(player, InventoryType.CRAFTING, "e"); craftingInventory.setResult(item); player.openInventory(craftingInventory);the error occurs Caused by: java.lang.IllegalArgumentException: Cannot open an inventory of type CRAFTING

#

no more google threads :/

digital plinth
#

workbench

#

its called crafting table now XD

#

so u cant open a crafting table inventory

#

try this

#
                 p.openInventory(inv); ```
#

InvType from crafting to workbench

quaint mantle
# digital plinth InvType from crafting to workbench

hmm thanks you but still error occurs ```CraftingInventory craftingInventory = (CraftingInventory) Bukkit.createInventory(player, InventoryType.WORKBENCH, "e");
craftingInventory.setResult(item);
player.openInventory(craftingInventory);````aused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom cannot be cast to class org.bukkit.inventory.CraftingInventory (org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom and org.bukkit.inventory.CraftingInventory are in unnamed module of loader 'app')`

digital plinth
digital plinth
#

CraftInventoryCustom

#

and

#

CraftingInventory

#

org.bukkit.craftbukkit.v1_15_R1.inventory.CraftInventoryCustom

#

is this nms?

#

weird name

#

so you want to set a recipe on the workbench when a player opens a workbench with right click or with a command?

quaint mantle
#

hnmm

quaint mantle
#

when player right clicks book

#

open workbench, set result of item and metric

quaint mantle
digital plinth
granite stirrup
#

anyone know the best way to convert a HashMap's values into a List

digital plinth
#

i think

digital plinth
#

lol

#

googl

granite stirrup
#

its not a thing?

digital plinth
#

hashmap is a map

#

they are different?

#

list cant store keys and values

quaint mantle
#

I can't find any google result or thread

granite stirrup
#

i dont want to store the keys tho i just want to store the values

#

i want to put them into a list

digital plinth
#

.values?

granite stirrup
#

intellij gave me this lmao ArrayList<>(myHashMap.values())

#

for some reason

digital plinth
#

i dont quite understand java collection tbh

granite stirrup
#

apparently ArrayList<>(myHashMap.values()) this is a arraylist constructor?

#

it should work right ?

quaint mantle
#

Still trying to figure out how to cancel the bow pulling

#

like its possible

#

but idk how

granite stirrup
#

pretty sure theres a event for that

digital plinth
#

check for bow

#

cancel

#

?

#

bow pulling

#

not bow shoot

quaint mantle
#

I already cancelled the interact event

digital plinth
#

oh

quaint mantle
#

but that just prevents it from shooting

digital plinth
#

packets

quaint mantle
#

its still draws/pulls back the bow

quaint mantle
digital plinth
#

its client sided hmmm

digital plinth
#

ask in protocalLib discord

summer scroll
#
InventoryView inventoryView = player.openWorkbench(null, true);

CraftingInventory craftingInventory = (CraftingInventory) inventoryView.getTopInventory();
craftingInventory.setResult(new ItemStack(Material.BARRIER));
player.updateInventory();
#

and it works, it set the result and you need to update the inventory otherwise you will got a visual bug.

summer scroll
quaint mantle
#

does anyone have a link to protocol Lib discord?

granite stirrup
summer scroll
#

Oh, Map#values then

granite stirrup
#

yeah ik i was messing around and intellij gave me that

quaint mantle
#

removed the snapshot part and it works

#

i cant find the discord for protocolLib

summer scroll
#

bro, just go to their resource page on spigot