#help-development

1 messages · Page 1368 of 1

cosmic sleet
#

what do you mean

#

different type?

summer scroll
#

different files/separate txt files

cosmic sleet
#

for each inv

summer scroll
#

i'm guessing you're gonna save it in yaml?

cosmic sleet
#

no

#

txt

#

what is yaml

#

it is my first plugin

summer scroll
#

it's basically a txt file.

#

idk how to explain it properly.

#

usually spigot plugin will use yml as their configuration.

cosmic sleet
#

ok

summer scroll
#

so for the answer of your question is no

#

it will not take a lot of server performance

#

and also it really depends on how you save and load it.

cosmic sleet
#

thx

latent vale
#

[14:44:22 INFO]: [BasicCMDs] Enabling BasicCMDs v1.0*
[14:44:22 ERROR]: Error occurred while enabling BasicCMDs v1.0 (Is it up to date?)
java.lang.NullPointerException: null
at me.zeprix.BasicCMDs.cmd.help.<init>(help.java:17) ~[?:?]
at me.zeprix.BasicCMDs.Main.onEnable(Main.java:19) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-574]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-574]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-574]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-574]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-574]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:580) ~[patched_1.16.5.jar:git-Paper-574]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Paper-574]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1055) ~[patched_1.16.5.jar:git-Paper-574]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-574]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_281]
[14:44:22 INFO]: [BasicCMDs] Disabling BasicCMDs v1.0

#

What is wrong?

cosmic sleet
#

you try to execute a method on a something that is null

quaint mantle
#

Hello, I have 2 small questions.

  1. How to get server folder? but Not plugin folder. (ex: I want to get also, bukkit.yml spigot.yml etc) (I tried file = Bukkit.getServer().getWorldContainer().getName(); it only returns .)

  2. how to zip my file? (No result in google)

latent vale
#

just check code i tried args but it didn't work

cosmic sleet
#

i used this

#

very good

latent vale
quaint mantle
#

What is the best way to do custom enchantments?

crude charm
#

@abstract sleet

quaint mantle
quaint mantle
latent vale
#

???? so

quaint mantle
#

I just want zip file in code

cosmic sleet
#

oh

latent vale
#

how to register command with args in plugin.yml?

cosmic sleet
#

server folder

quaint mantle
#

I don't want zip myself! lol

cosmic sleet
#
getServer().broadcastMessage("Working Directory = " + System.getProperty("user.dir"));

@quaint mantle

#

You mean this?

quaint mantle
#

hm ye

#

I think

cosmic sleet
#

you get the direcctory of the folder

#

where the server.bat is

quaint mantle
#

thanks

cosmic sleet
#

np

latent vale
#

how to register command with args in plugin.yml?

young knoll
#

You don't

quaint mantle
young knoll
#

You just register the base command

latent vale
quaint mantle
#

It works. but i'm not sure

latent vale
#

mb just register command and all args auto register

rugged topaz
#
        Team team = score.getTeam(p.getName()) == null ? score.registerNewTeam(p.getName()) : score.getTeam(p.getName());
        if (!team.hasEntry(p.getName()))
            team.addEntry(p.getName());
        team.setPrefix(ChatColor.valueOf("RED").toString());

        team.setNameTagVisibility(NameTagVisibility.ALWAYS);

        p.setScoreboard(score);

why does this only apply it to the local player, rather than showing for everyone else?

young knoll
#

Because you only set it for that player

vital ridge
#

Yeah

rugged topaz
#

nah

#

p = everyone

quaint mantle
rugged topaz
#

it's called from a Bukkit#getOnlinePlayers with that passed in as a parameter

young knoll
#

Are you giving them each a different scoreboard?

rugged topaz
#

am i meant to?

young knoll
#

no

rugged topaz
#

uh well in that function i described above, i'm declaring a scoreboard

#

so yea...? i think?

#

since the function's being called for each player alone

#

i'll try fixing that rl quick

latent vale
#

now my server doesn't even start ........//

rugged topaz
#

btw RED was just a filler, each player would have different colors

#

does that still require the same scoreboard per player?

latent vale
#

name: BasicCMDs
version: 1.0
main: me.zeprix.BasicCMDs.Main

commands:
discord:
description: Discord invite link!

basic:
description: Basic commands'

ivory sleet
#

:0

latent vale
#

[15:04:33 ERROR]: Could not load 'plugins\BasicCMDs.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml

#

yeahhhh

paper viper
ivory sleet
#

Lol

paper viper
#

wtf

quaint mantle
#

can you show me full error?

rugged topaz
#

@young knoll

    @Override
    public void onEnable() {
        org.bukkit.scoreboard.Scoreboard score = Bukkit.getScoreboardManager().getNewScoreboard();
        for (Player p : Bukkit.getOnlinePlayers()) {
            Scoreboard.setTag(score, p);
        }
    }
    public static void setTag(org.bukkit.scoreboard.Scoreboard score, Player p) {
        Team team = score.getTeam(p.getName()) == null ? score.registerNewTeam(p.getName()) : score.getTeam(p.getName());
        if (!team.hasEntry(p.getName()))
            team.addEntry(p.getName());
        team.setPrefix(ChatColor.valueOf("RED").toString());

        team.setNameTagVisibility(NameTagVisibility.ALWAYS);

        p.setScoreboard(score);
    }
#

what's up w this?

abstract sleet
latent vale
#

Here error and plugin.yml

#

name: BasicCMDs
version: 1.0
main: me.zeprix.BasicCMDs.Main

commands:
discord:
description: Discord invite link!

basic help:
description: Basic commands

#

in 'reader', line 10, column 3:
description: Basic commands
^

opal juniper
#

Can you set an item to not be able to be crafted with?

#

as in not able to be used as an ingredient

young knoll
#

Add unique data to the PDC and then use PrepareItemCraftEvent to check for it

abstract sleet
abstract sleet
#

Replace the old class with this one and lmk now it goes :)

crude charm
#

yup

proper notch
abstract sleet
#

only the base command

latent vale
#

oh

abstract sleet
#

e.g. if I had the command /how are we going, I would only add how to plugin.yml.

rugged topaz
#

cause it don't seem to work

latent vale
#

but it still says the same thing -_-

opal juniper
abstract sleet
crude charm
#

@abstract sleet what do I do nne and stuff to?

#

north

#

east

#

ect

#

what one

opal juniper
#

cause there isn't like a event.setCancelled()

abstract sleet
#

North = {North, NorthNorthWest, NorthNorthEast}, East = {East, NorthEastEast, SouthEastEast}

#

for example

crude charm
#

ok

young knoll
abstract sleet
#

Each main direction has two deviations now so it is far more accurate

abstract sleet
young knoll
#

Wrong replay, dangit discord

abstract sleet
#

ah np :)

young knoll
opal juniper
burnt totem
#

does anyone know a good minecraft bot api plugin?

abstract sleet
burnt totem
burnt totem
abstract sleet
#

ah okay, sorry I don't know

crude charm
#
        switch(DirectionUtil.getDirection(loc.getPitch())) {
            case NORTH_WEST:
            case NORTH_EAST:
            case NORTH_NORTH_EAST:
            case NORTH_NORTH_WEST:
            case NORTH:
                clipboard.rotate2D(0);
                System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
                break;
            case EAST:
            case NORTH_EAST_EAST:
            case SOUTH_EAST_EAST:
                clipboard.rotate2D(90);
                printConsole("EAST");
                System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
                break;
            case SOUTH_EAST:
            case SOUTH_WEST:
            case SOUTH_SOUTH_EAST:
            case SOUTH_SOUTH_WEST:
            case SOUTH:
                clipboard.rotate2D(180);
                printConsole("SOUTH");
                System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
                break;
            case WEST:
            case NORTH_WEST_WEST:
            case SOUTH_WEST_WEST:
                clipboard.rotate2D(270);
                printConsole("WEST");
                System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
                break;
}
#

like this?

abstract sleet
#

I think so. There is still a slight issue where you have north east, north west, south east and south west but we can't really do anything about it

#

if you want, you can even avoid the entire DirectionUtil class and use multiple if statements like

snip, don't use this
#

actually yeah, @crude charm this would be far better

#

scrap the DirectionUtil class

young knoll
#

Pitch is the vertical one

abstract sleet
#

tfw I am trying to help but keep fucking up 😄

#

if yaw >= 90, west
else if yaw >= 0, south
else if yaw >= -90, east
else, north

@crude charm ignore absolutely everything I have said previously, this is the way

young knoll
#

It may be 0-360

abstract sleet
#

I tested in singleplayer, it's -180 to 180, unless bukkit does differently, highly unlikely that they would change it to 0-360.

crude charm
#
if (yaw >= 90) {
//west
}else if (yaw >= 0) {
//south
}
else if (yaw >= -90){
//east
}
else {
//north
}
abstract sleet
#

yup, just put clipboard.rotate2D(...); in and should be good to rock and roll

crude charm
#
        if (yaw >= 90) {
            clipboard.rotate2D(90);
            System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
        }else if (yaw >= 0) {
            clipboard.rotate2D(180);
            System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
        }
        else if (yaw >= -90){
            clipboard.rotate2D(270);
            System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
        }
        else {
            clipboard.rotate2D(0);
            System.out.println("DirectionUtil translated yaw of " + loc.getYaw() + " to direction " + getDirection(player.getLocation().getYaw()).toString() + ".");
        }

is this it?

#

or did I mix one up

abstract sleet
#

try that and if it works then get rid of the debug logs 👍

crude charm
#

yup

sour sand
#

i am tring to build my project into a jar but i just get the error: java: invalid source release: 11 does anyone know how to fix it

#

i am useing java 8 and intellij if that helps

abstract sleet
#

that's weird.

crude charm
#
[22:43:40 INFO]: 177.6405
[22:43:40 INFO]: Successfully pasted 'plugins\WorldEdit\schematics\House1.schematic' at -247 21 -12
[22:43:41 INFO]: Pasting plugins\WorldEdit\schematics\House1.schematic
[22:43:41 INFO]: (FAWE) @CuboidClipboard used by SchematicUtil.pasteSchematic():40 is deprecated.
[22:43:41 INFO]: (FAWE)  - Alternatives: { class com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard,class com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat }
[22:43:41 INFO]: 282.59448
[22:43:41 INFO]: Successfully pasted 'plugins\WorldEdit\schematics\House1.schematic' at -247 27 -11
[22:43:42 INFO]: Pasting plugins\WorldEdit\schematics\House1.schematic
[22:43:42 INFO]: (FAWE) @CuboidClipboard used by SchematicUtil.pasteSchematic():40 is deprecated.
[22:43:42 INFO]: (FAWE)  - Alternatives: { class com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard,class com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat }
[22:43:42 INFO]: (FAWE) @CuboidClipboard used by SchematicUtil.pasteSchematic():53 is deprecated.
[22:43:42 INFO]: (FAWE)  - Alternatives: { class com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard,class com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat }
[22:43:42 INFO]: SOUTH
[22:43:42 INFO]: DirectionUtil translated yaw of 3.4956055 to direction SOUTH.
[22:43:42 INFO]: 3.4956055
[22:43:42 INFO]: Successfully pasted 'plugins\WorldEdit\schematics\House1.schematic' at -247 34 -12
[22:43:43 INFO]: Pasting plugins\WorldEdit\schematics\House1.schematic
[22:43:43 INFO]: (FAWE) @CuboidClipboard used by SchematicUtil.pasteSchematic():40 is deprecated.
[22:43:43 INFO]: (FAWE)  - Alternatives: { class com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard,class com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat }
[22:43:43 INFO]: 90.69678
[22:43:43 INFO]: Successfully pasted 'plugins\WorldEdit\schematics\House1.schematic' at -247 40 -12
young knoll
abstract sleet
#

Interesting.. so it is 360?

#

@crude charm Try adapt the values from 0 to 360 instead.

sleek crest
#

I have some problems setting NBT-Tags with ProtocolLib. If I apply NBT-Tags to items and try to query them, the specific keys aren't there:

NbtCompound nbtData = (NbtCompound) NbtFactory.fromItemTag(MinecraftReflection.getBukkitItemStack(selectTeam));
nbtData.put("Team", team.getTeamId());
NbtFactory.setItemTag(MinecraftReflection.getBukkitItemStack(selectTeam), nbtData);
NbtWrapper<?> nbtWrapper = NbtFactory.fromItemTag(event.getCurrentItem());
NbtCompound nbtCompound = (NbtCompound) nbtWrapper;
System.out.println(nbtCompound.getKeys());
teamId = nbtCompound.getInteger("Team");
java.lang.IllegalArgumentException: Cannot find key Team
    at com.comphenix.protocol.wrappers.nbt.WrappedCompound.getValueExact(WrappedCompound.java:227) ~[?:?]
    at com.comphenix.protocol.wrappers.nbt.WrappedCompound.getInteger(WrappedCompound.java:380) ~[?:?]
    at de.daniel.speedrun.game.item.lobby.SelectTeamItem.onInventoryClick(SelectTeamItem.java:73) ~[?:?]
opal juniper
#

Soooooooo, i need some ideas / pointers. I need a way to have ammo for an item... At the moment i just do it by getting the slot in the hotbar to the right of it however does anyone have a better idea?

crude charm
#

0, 90, 180, 270?

abstract sleet
#

yes

abstract sleet
crude charm
#
if (yaw >= 0) {
            clipboard.rotate2D(0);
        }else if (yaw >= 90) {
            clipboard.rotate2D(90);
        }
        else if (yaw >= 180){
            clipboard.rotate2D(180);
        }
        else  if (yaw >= 270){
            clipboard.rotate2D(270);
        }
young knoll
#

The first one will always pass

opal juniper
abstract sleet
#

you need to do it in the reverse order,
if it is more than 270 then execute x, more than 180 then do y, more than 90 then do z, etc.

abstract sleet
#

I'm sure a <UUID, Integer> map should be fine

crude charm
#
        if (yaw >= 270) {
            clipboard.rotate2D(0);
        }else if (yaw >= 180) {
            clipboard.rotate2D(90);
        }
        else if (yaw >= 90){
            clipboard.rotate2D(180);
        }
        else  if (yaw >= 0){
            clipboard.rotate2D(270);
        }

like this?

abstract sleet
opal juniper
abstract sleet
crude charm
#

if the schem is taken north

abstract sleet
#

e.g.

Shotgun
---
Ammo: 123
---
opal juniper
untold whale
#

i love you guys

abstract sleet
#

You can scan the gun item's lore, look for a line that starts with Ammo: , grab the number next to that, decrease it by 1, set new lore

untold whale
#

Your all making me want to put on a bassnectar remix and write some plugins

#

your reminding me of my youth right now

#

Paint and all

crude charm
abstract sleet
#

please show how yaw is set

untold whale
#

^

abstract sleet
#

i will hop off in a min by the way :)

crude charm
#

double yaw = loc.getYaw();

abstract sleet
#

ok

untold whale
#

Plus there has got to be a cleaner way to invert your angle besides a big branch

cosmic sleet
#

i have a CommandKit.java

#

How do i register it in my main file?

#

getServer().getPluginManager().registerEvents(new EventClass(), this);

#

I used to use this for my event class

#

what do i have to use instead of registerEvents?

abstract sleet
untold whale
#

Ok I just noticed something

#

Big logic error. Your only making the first branch or second

cosmic sleet
#

ok thx

untold whale
#

Yaw is probably greater then 0 at the bottom is always triggering.

#

Cause your yaw is zero

#

Im assuming your trying to rotate the building depending on where your looking?

olive lance
#

Quick question how can I compare itemstack and material

cosmic sleet
#
package me.geoffrey.Tutorial.Events;

import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;


public class CommandKit implements CommandExecutor {

    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if (sender instanceof Player) {
            Player player = (Player) sender;

            ItemStack diamond = new ItemStack(Material.DIAMOND);

            diamond.setAmount(20);

            player.getInventory().addItem(diamond);
        }

        return true;
    }
}
#

I get an error

#

In my main file i got in my onEnable

getCommand("inventory").setExecutor(new CommandKit());
#

why does it not work

young knoll
#

Is it in your plugin.yml

cosmic sleet
#

what is plugin.yml

#

?

untold whale
# crude charm yes

You seem to be pasting these blocks to an anchor a couple blocks off of you in a direction. You need to shift those block in the direction your looking. I would recommend seeing where the anchor is.

crude charm
#

I just want

#

n

#

s

#

e

#

w

cosmic sleet
#

i got no such file

crude charm
#

idc about exact

young knoll
#

yes you do

#

Or your plugin wouldn't load

cosmic sleet
#

where

#

nvm

#

i found it

untold whale
#

Ok then you need to calculate what Direction they are looking (I'm sure the API has something baked in [I haven't touched the spigot API in a while]). Then you need to shift whatever that anchor is in that direction. Im not sure exactly how these blocks are being placed.

#

But rotating them in a "clipboard" is probably just rotating the whole structure.

#

Thats not actually manipulating their X/Y Coords in relation to you. It seems to just take your POS then minus some X or Z then paste the structure there.

#

Plus your overall If Else Statement is flawed. Your checking if a number is bigger then or equal to another in sequential order in what im guessing is to reverse it.

crude charm
#

I had something "somewhat" working before

#

ima just go back to that

minor fox
#

Does anyone know about any popular closet clients? (For use in anti cheat testing)

untold whale
#

How are these blocks being placed? Are you using a library or are you converting them from some flatfile (i.E schematic) yourself and placing them

crude charm
#

schematic

untold whale
#

Show me what code exactly is being executed

#

Instead of just a random if else statement

crude charm
#

ok give me 1 sec

#

wanna test this

#

yup this dont work

#

ook

untold whale
#

So I see why this is fucky. Your always triggering the first if statement in your invert.

#

Your yaw is always gonna be >= 0 and if it isnt then it doesnt trigger at all

#

This Cuboid Clipboard where is it's API?

crude charm
#

we api

untold whale
#

Is this a schematic thing? ( I havent been in the Spigot Scene since like 2018~)

crude charm
#

world edit api

untold whale
#

I see you have a Parameter called loc. Humor me where this Location comes from. I see it is passed into this Method.

#

Is this the player location?

crude charm
#

yes

untold whale
#

So im assuming the rotate2D just rotates the whole structure top down. But lets assume it does. Your never rotating the object cause your first branch in that else if statement is looking for a positive angle.

Another assumption, but all angle are positive so your always rotating by 0.

But I see on line 91 you are adding the schematic with a vector off of the players Location.

I would recommend maybe shifting that location. That will actually move the structure around you.

untold whale
#

Try adding 10 blocks to the x and z on the vector and see what happens.

burnt totem
#

@crude charm i saw u on mc market lol

crude charm
#

I havent touched java / mcmarket in over a year

#

so ive forgot alot

#

compared to when I was taking commissions every day and coding for hours

burnt totem
#

i saw the post

olive lance
#

What order does getArmorContents return the array in

burnt totem
#

were you wanted a prac core

olive lance
#

Boots to helmet or other way?

burnt totem
untold whale
#

Thats common. 8 months ago I was building a nodejs Server Wrapper and could quote off the dome how to read processes and write to them.

I was writting a small script to scrape some youtube id's off of filenames the other day and had to look up the fs modules o.o

burnt totem
#

@crude charm what practice core you ended up buying?

olive lance
#

My hcf core free not that it works or anything

burnt totem
#

send

#

link

crude charm
#

no

#

cause its custom

#

@burnt totem

burnt totem
#

i was talking with geegeetom

olive lance
#

I got you

burnt totem
olive lance
cosmic sleet
#
player.sendMessage("/msg "+player.getDisplayName()+" "+data);
olive lance
#

I did a update but forgot about this feature I started to add but didn’t finish so it spams console rn

cosmic sleet
#

why does this not work to send a private message?

undone pebble
#

Reread it

burnt totem
olive lance
#

That’s going to send a message to “player” saying “/msg”

cosmic sleet
#

bruh

#

how can i achieve the effect than

cosmic sleet
#

what command

burnt totem
#

what do you want to do?

olive lance
#

Boom

cosmic sleet
#

i make an inventory backup command

olive lance
#

player.chat

cosmic sleet
#

and i want only the concerned user to send

#

thx @olive lance

olive lance
#

Thank @young knoll

pine wing
#

Hey would it be safe to load an inventory async with some items and then display it to the user back in the main thread? (its a gui)

olive lance
#

A method returning an array should specify order in docs fr

#

I can’t be booting up the server for this

hybrid spoke
pine wing
#

Basically I have few loops to add the items into the inventory before displaying it to the user which creates some lag to the main thread

carmine ivy
#

I'm trying to make a bedwars shop but I don't know how to buy the items with iron and gold etc. Is there anything that could help?

hybrid spoke
opal juniper
#

Can i set durability on an item like a blaze rod which doesn't normally have durability

carmine ivy
#

I don't think so

#

Maybe there is a way

pine wing
#

Well its not something really really heavy but I was thinking that if it's thread safe why not do it that way.

#

We are talking about ~20-15ms

hybrid spoke
opal juniper
#

Im not in the mood for packets

#

don't go any further 😄

hybrid spoke
#

then you have to throw your idea

opal juniper
#

hmm, ok

olive lance
#

Anybody know what order getArmorContents returns the pieces in

opal juniper
#

thanks anyways then 🙂

rugged topaz
#

does anyone know what IntStreamEx and StreamEx are, error that came in a resource about protocollib's sign input w packets, dk if it's a library i get or if it's supported in a newer version of java

hybrid spoke
pine wing
#

basically I have a switch statement that holds a value and I loop materials to get the value

#

Some kind of a "shop" basically.

#

They way I think it modifying the inventory async before sending it to the player should work

young knoll
#

Can you not cache it

pine wing
#

That's what I do currently

hybrid spoke
#

are you looping with a while.. for...?

untold whale
#

So you need to think about time complexity my friend.

sleek pond
#

O(n^6)

#

idk how time ocmplexity works

pine wing
#

O(N^6) jesus

sleek pond
#

lmao

#

what does o and n mean

pine wing
untold whale
#

me either I just heard about it in a ben awad video where he commited 2 counts of cha cha slide.

But for real though how many loops are you doing, plus whats going on in the loop

sleek pond
#

what does O mean

untold whale
#

Cause you can start squaring instructions like a mad man really easdy

sleek pond
#

and n

#

is n input size?

hybrid spoke
#

and more important what loop are you using

pine wing
#

for

untold whale
#

Im guessing the For loop is the loop in Java that isnt using iterators and generators instead of a foreach or whatever it is in Java (Has been a while since I have written Java)

sleek pond
#

for is both a for and a foreach loop

#

in java

hybrid spoke
#

its more or less the same

untold whale
#

I guess you can just write both in there. I remember you could do (string [] derp : string herp) or whatever in the loop

#

I've been writing interpreted javascript and php garbage the past 2 years

sleek pond
#

;p

hybrid spoke
#

im wondering what you are doing inside your loops to get performance peaks, @pine wing.
can you show us your code, or is it a top secret?

pine wing
#

Basically my question was if it would be safe to modify an inventory before its shown to a user unrelated to the amount of time needed to fill the inventory

cinder thistle
untold whale
#

wait is the NSA gonna kick in my door for talking about time complexity with you for your project?

pine wing
#

uh no

untold whale
#

Encrypts Dank Memes Folder

cinder thistle
#

lmao

#

NSA cracks it in 20 minutes

pine wing
#

uses AES-512

#

hehe

pine wing
#

Yeah I know right but since its Bukkit API and they say "async bad" everywhere

hybrid spoke
#

but it should be, if you don't mess with it in another thread

#

you also could synchronize it

sour rampart
pine wing
#

this fits here more

sour rampart
#

um...

untold whale
sour rampart
#

bruh

hybrid spoke
#

i love this link. are there more like this? or like giyf.com

untold whale
#

I dont know but I know it's now being imprinted into memory

pine wing
untold whale
#

Not the same affect though. I like how it shoots out an mp4. Its pairs BEAUTIFULLY with discord

hybrid spoke
#

but i need to know.. what shouldn't i forget to click???

sharp bough
#

whats getI18NDisplayName ?

lilac dagger
#

there's no such thing as n^6 as big o annotation

sharp bough
#

can it be used to get the display name of an item in a gui?

sharp bough
#

ah yea

olive lance
#

yeah think its just still n^2

sharp bough
#

sorry didnt see it

crude charm
olive lance
#

cause big o notation is like trash and doesnt describe anything helpful

lilac dagger
#

it does

cinder thistle
#

not true

hybrid spoke
lilac dagger
#

it tells you the growth rate

cinder thistle
#

it describes efficiency in a method

#

yeah that

crude charm
lilac dagger
#

but you can't define how much a method will take in time

#

so that's why you stick to the basic ones like O(1)

#

and n^2

hybrid spoke
crude charm
sleek pond
#

u have an npe

hybrid spoke
#

NPE in line 29 on HouseListener

#

what does it do?

crude charm
#

but I shouldn't

sleek pond
crude charm
#

switch (player.getItemInHand().getItemMeta().getDisplayName()) {

hybrid spoke
#

aaand 52

sleek pond
#

yea

#

lol

hybrid spoke
#

oops

crude charm
#

yeah both are that

sleek pond
#

looking at 2 different errors

crude charm
#

both are that

#

switch (player.getItemInHand().getItemMeta().getDisplayName()) {

hybrid spoke
#

#hasItemMeta - #hasDisplayName

sleek pond
#

i receommend doing it in multiple lines

#

for example ItemMeta meta = ietm.getmeta

crude charm
#

if (event.getItem() == null) return;

sleek pond
#

ok

crude charm
#

if(event.getBlock() == null) return;

sleek pond
#

but the itemmeta can be null

crude charm
sleek pond
#

?

crude charm
#

thats the class

hybrid spoke
#

ohhh wait

#

what is that

sleek pond
#

do it in multiple lines

hybrid spoke
#

i thought its a screenshot

crude charm
#

the class

sleek pond
queen dragonBOT
hybrid spoke
#

but its an actuall class

crude charm
hybrid spoke
#

how did you do that

crude charm
sleek pond
#

bruh

crude charm
#

oops

sleek pond
#

there

sleek pond
#

idk

#

big message

hybrid spoke
#

anyways, just add a item#hasItemMeta && item#hasDisplayName check before your switch

sleek pond
#

let me fix it

#

and make it more readable

crude charm
#

whats wrong with it

hybrid spoke
#

anyways, just add a item#hasItemMeta && item#hasDisplayName check before your switch
the itemmeta and the display name of an item can be null. thats the case here. you have to check, if one or both of these things are null. if so - return.

crude charm
#

ok

hybrid spoke
#

also, little recommendation -> use a for loop

young knoll
#

getItemMeta will only return null if the material returns true for isAir

crude charm
#

if (event.getItem().getItemMeta() == null || event.getItem().getDisplayName() == null) return;

#

like this?

hybrid spoke
#

yeah. you can do it like this.
or you just use the methods which are intended for this purpose -> item#hasItemMeta && item#hasDisplayName

crude charm
#

ok

#

ill do that

sleek pond
#

there

#

use that

young knoll
crude charm
#

I should probs close my 5 twitch streams, music and podcast

#

I can barely think

sleek pond
#

its a bit dirty but im on my phone

untold whale
#

@hybrid spoke can I make a minecraft plugin in lua?

crude charm
#

what was wrong with it

#

why change this player.getInventory().setItemInHand(null);

sleek pond
#

eeeew

crude charm
#

what

#

why did u change that

untold whale
#

Is it gonna use alot of deditated wam?

sleek pond
#

I didn't

crude charm
#

huh

sleek pond
#

I only changed the switch

crude charm
#

how tf did that change

#

idk

cinder thistle
#
BanRepository repo = databaseHandler.getRepository("ban", Ban.class);
...
public <T> Repository<T> getRepository(String key, Class<T> type) {
  return (Repository<T>) this.repositories.get(key);
}

Why is this not working?

#

I have no idea.

weary geyser
#

What's that, spring?

hybrid spoke
#

where do you see spring?

weary geyser
#

Nvm read it wrong

lost matrix
cinder thistle
#

won't even compile

sleek pond
#

lmao bad

#

you have a regular repo

#

but you need a banrepo

hybrid spoke
lost matrix
#

You will get a Repository<Ban> which does not have to be this exact implementation

cinder thistle
#
public class BanRepository extends Repository<Ban> {
#
public abstract class Repository<T> {
#

I'm tired

lost matrix
#

Exactly. But there could also be other repositories who implement Repository<Ban>

#

As soon as you throw away the generic type and use concrete implementations you need to define concrete methods for those implementations.

cinder thistle
#

layman's terms

lost matrix
#
public BanRepository getBanRepository() {
  return (BanRepository) this.repositories.get("ban");
}

But this kind of defeats the purpose of the generic.

cinder thistle
#

sigh

#

So that's the only workaround?

lost matrix
#

no

cinder thistle
#

what's confusing to me

#

is this:

#
    public <T> OxideDAO<T> getDAO(String key, Class<T> type) {
        return (OxideDAO<T>) this.daos.get(key);
    }
    
    public <T> Repository<T> getRepository(String key, Class<T> type) {
        return (Repository<T>) this.repositories.get(key);
    }
#

cba to ?paste

lost matrix
#

You could also work with the generic class instead.
So Repository<Ban> repo = databaseHandler.getRepository("ban", Ban.class);

cinder thistle
#

the first one works fine

#

oh yeah that's fine

#

I'll test that

#

actually that might be an issue

#

I implement some methods in BanRepository but I also have some that I've added

lilac dagger
#

guys, using reflections to access a private class' fields versus writing them to a packetdataserializer and reading them from there

lost matrix
#

BanRepository repo = (BanRepository) databaseHandler.getRepository("ban", Ban.class);
But thats an unsafe cast because there could be other classes returned that implement Repository<Ban>

cinder thistle
#

it'll be fine

#

i explicitly define repos

lost matrix
#

I mean. Then everything you need should be defined in the interface Repository<T>

cinder thistle
#

there's per-type methods

#

for example:

    public List<Ban> getAllByModerator(UUID moderator) {
        return this.dao
                .createQuery()
                .filter("moderator", moderator)
                .asList();
    }
#

I could just get rid of the method and use that query each time but that's less consistent

lost matrix
#

Generic methods can be defined in the interface too.
And if you have type specific functions you need to separate your concerns and write new classes for that.

cinder thistle
#

I suppose

lost matrix
#

But working with generics is always a hustle and will lead to weird casts left and right

cinder thistle
#

just don't feel like dealing an interface per method (or two)

#

yep

lost matrix
cinder thistle
#

I'll probably go with interfaces

sour rampart
cinder thistle
#

Try it and see

weary geyser
cinder thistle
#

Better

lost matrix
weary geyser
#

ik the one i sent is my ripoff site lmao

cinder thistle
#

lol

#

One day someone will send you to ur own site

weary geyser
#

¯_(ツ)_/¯

hybrid spoke
cinder thistle
#

Good question

sharp bough
#

is there some easy way to make this like "case tier NUM - player perform command crafts blaze tier NUM" ?

sleek pond
#

?paste

queen dragonBOT
sleek pond
#

im not gonna download that

hybrid spoke
#

you dont have to

sharp bough
#

wat

#

you can expand now

sleek pond
#

damn

sharp bough
#

here

sleek pond
#

discord really bumping up there coding features

cinder thistle
#

indeed

sleek pond
#

whats ur issue

cinder thistle
#

use a loop my guy

sharp bough
#

yea ik i need to use some loop i just dont know how to make it

#

i get errors when i try to do it

#

dumb ones

hybrid spoke
#
for(int i = 0; i < 12; i++) {

  if(e.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase("Tier " + i) {
  
  // code
  break;

}

}
lost matrix
#

This should not be done with a loop but with a simple HashMap<String, String>

old dock
#

Good day! I don't want to interupt anyone but is there anyone who can help me with my server console log error

lost matrix
#

Nvm... not even with a map. This can be a one liner...

olive lance
#

paste it G

sharp bough
olive lance
#

in a paste bin

lost matrix
sharp bough
#

and ik everything i do can be better

#

but i dont need to do it in 1 line

#

i need it to work

cinder thistle
#

u right

hybrid spoke
#

thats some wise words right here

olive lance
#

add a default case and a null case? i think ?

#

idrk what ur tryna do

hybrid spoke
olive lance
#

@old dock send the code too

old dock
old dock
olive lance
#

onenable

#

"java.lang.NullPointerException: null
at com.gummychewz.powercore.Main.onEnable(Main.java:24) ~[?:?]"

#

that second line is gonna tell you where the error is most of the time

old dock
#

ill send a pastebin

hybrid spoke
#

did you register your "Kill" command in your plugin.yml? is there any chance, that "new Kill()" could be null? lol, brain not working. object instantiation null

old dock
#

Aah thank you that was the only spot i overlooked

#

Alright it's solved then

lost matrix
# sharp bough is there some easy way to make this like "case tier NUM - player perform command...

This is how you could handle any arbitrary number in the String.

  public void dispatchFromItemName(Player player, ItemStack itemStack) {
    if (itemStack == null) {
      return;
    }
    ItemMeta meta = itemStack.getItemMeta();
    if (meta == null) {
      return;
    }
    if (!meta.hasDisplayName()) {
      return;
    }
    String displayName = meta.getDisplayName();
    if (!displayName.startsWith("Tier")) {
      return;
    }
    String numberString = displayName.replace("Bob ", "");
    String commandString = "crafts blaze tier " + numberString;
    Bukkit.dispatchCommand(player, commandString);
  }

Just a new method that takes the Player and the ItemStack.
Then it dispatches the command based on the ItemStacks name.
Thats not a good practice but it should work as long as the name does not contain any color formatting.

olive lance
sharp bough
#

String commandString = "crafts" + type + " tier " + numberString;
Bukkit.dispatchCommand(player, commandString);

olive lance
#

that functionality is from pumpkin heads right

hybrid spoke
olive lance
#

but to show any block on the head

#

its either pumpkin heads or that is some next level packet stuff

hybrid spoke
#

🤔

olive lance
#

yea and what im thinking is its able to do that cause the code for the pumpkin head can just get applied to any block

hybrid spoke
#

more like the normal equip function. you can set any itemstack as the players hat

quaint mantle
#

heres the full code

hybrid spoke
#

and whats your error?

sleek pond
#

its in hekp-server

#

spel

sleek pond
#

you need to return true or it will do that

quaint mantle
#

oohhh

sleek pond
#

and you also need to register the command in the onenable

#

with getCommand whatever

quaint mantle
#

idk im following a tutorial from 2018 so sorry

sleek pond
#

thats decently recent ni coding terms

#

some things are from 2005 and they get plenty of attention

quaint mantle
scarlet path
#

?jd

quaint mantle
#

how do i fix my localhost saying that my plugin is dissabled

#

how to import BungeeCord in maven? P.S. import net.md_5.bungee.api.plugin.Plugin; doesn't work for me

proper notch
#

That shows what you need to add to your pom

#

i lurk 👀

quaint mantle
proper notch
#

Can you send what your pom is currently if that's not working, if that's what you mean by already

quaint mantle
#

import net.md_5.bungee.BungeeCord; - NOT WORKING
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.ChatEvent;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PostLoginEvent;
import net.md_5.bungee.api.event.ServerSwitchEvent;
import net.md_5.bungee.api.plugin.Command;
import net.md_5.bungee.event.EventHandler;

eternal night
#

rip the pom.xml

queen dragonBOT
quaint mantle
#

ok

#

someone help

#

idk how to enable it :(

proper notch
olive lance
#

what happens more often, inventoryclickevent or 5 seconds passing without one occurring

quaint mantle
#

@cinder thistle how do i enable my plugin

sleek pond
#

what does your console say

#

?[aste

#

?paste

queen dragonBOT
sleek pond
#

@quaint mantle

sleek pond
#

full error please

proper notch
quaint mantle
#

@sleek pond

#

this is the full error

sleek pond
#

its not

#

there is more stuff below that

#

and

#

the whole server logs

#

and the start

#

during the startup of the server

#

it should say why it didn't launch correctly

quaint mantle
#

@sleek pond did u take a look

sour sand
#

how do you get that squiggly symbol that makes the text change colour on an english keybored

untold whale
#

hipster

#

only weirdos use mac

#

yeah

sour sand
#

yea

untold whale
#

lol, the gods seem to agree

sour sand
#

y did his messages get removed

cinder thistle
#

fuckin

#

got kicked by automod

untold whale
#

Cause mac is for weirdos

cinder thistle
#

mac is nice

#

macOS*

untold whale
#

sure

cinder thistle
#

macOS and butterfly keyboard are the nice things

#

and that it's primarily laptops

#

but other than that? ffs the pricing

sour sand
#

ok well i will contact your local insane assilum

untold whale
#

^

kindred solar
#

guys

#

need help

cinder thistle
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

kindred solar
#

is something wrong with this if statement? if(player.getWorld().getName().equals("skyblock")){ Location skyblocklobby = new Location(Bukkit.getWorld("skyblock"), 2.31,90.00 ,4.45); player.teleport(skyblocklobby); return; }

kindred solar
sour sand
#

it is the same concept

quaint mantle
#

can someone figure out how to fix my plugin disabling

untold whale
#

enable it

cinder thistle
kindred solar
quaint mantle
#

To get Bukkit.getName() and use an List array on the inventory click item event would this be te best way to get player name across classes ?

ornate heart
#

Is there a way to have blocks disappear for you, but to other player's they're still there.

For instance, there is a wall and for you, that wall has a whole you can walk through but to other players that whole isn't there.

sleek pond
quaint mantle
#

oh

olive lance
#

what happens if you add an identical potion effect to a player, does the duration get summed or is the new duration used

sage swift
#

overrides, i believe

eternal night
#

the effect with longer duration takes priority

sage swift
#

that then

eternal night
#

yeah

fringe folio
#

does anybody know what this means?

[20:03:25 ERROR]: Error occurred while enabling gunWars v1.0 (Is it up to date?)
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.roey.gunwars.Main.getCommand(String)" is null
sage swift
#

tells you right there

#

plugin.yml doesnt have the command that you're getting

eternal night
#

But good on you for java 15+

sage swift
#

but lowercase plugin name

eternal oxide
minor fox
#

I have a private Object object field in my class that I am trying to serialize/deserialize with Gson, but for some reason it won't deserialize, the value is always null

south onyx
#

what event should i use to check if a player picks up an item?

quaint mantle
#

Did you google it?

south onyx
#

yeah

#

the one i found was depricated

#

PlayerPickupItemEvent

eternal night
#

I mean, if even says what event to use instead

south onyx
#

ok thx

quaint mantle
#

damn

#

so fast

zinc saffron
#
    public void onPreLookupProfile(PreLookupProfileEvent event) {
        UUID offlineUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getName()).getBytes(Charsets.UTF_8));
        event.setUUID(offlineUUID);

        event.setProfileProperties(new HashSet<ProfileProperty>());
    }```

That prevents the server from looking up stuff right?
eternal oxide
#

always use the javadocs. It usually tells you right in the deprecated notice what the replacement is.

eternal night
#

never knew that event existed in spigot

#

:>

zinc saffron
#

oh

quaint mantle
eternal oxide
#

No paper here, only us Spigoters

quaint mantle
#

It's funny to me how there is a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork of a fork etc

eternal oxide
#

Posting links to forks is generally frowned upon. I've seen people banned for it.

quaint mantle
#

really?

young knoll
#

They form a ban- aww

eternal oxide
#

Afraid so. Its akin to posting adverts for Wendys in McDonalds

quaint mantle
#

damn

sturdy patrol
#

btw, do you guys know whether there are pull request from paper to spigot sometimes?

hushed patio
#

need help with plugin

somber hull
#

I want to make red leather armor, and then give it meta data

#

But when i do that

#

It overwrites the color data

#
        ItemStack item = new ItemStack(Material.LEATHER_CHESTPLATE);
        LeatherArmorMeta metaLeather = (LeatherArmorMeta) item.getItemMeta();
        metaLeather.setColor(Color.RED);
        ItemMeta meta = item.getItemMeta();
#

if i set the meta to metaLeather

#

then set the meta to meta

young knoll
#

Don’t set it to both?

#

You can do all the stuff you need in leatherMeta

somber hull
#

It overwrites each other

somber hull
sturdy patrol
#

LeatherArmorMeta have the same functions ItemMeta has

young knoll
#

Yes it does

somber hull
#

Oh you know what

#

So i am adding attributes to it

#

And those arent appearing on leather armor

#

but they appear on the helmet im using

#

wich is just a player skull

eternal oxide
#

How are you applying the attributes?

somber hull
#
        meta.addAttributeModifier(Attribute.GENERIC_MAX_HEALTH, helmetHealthModifier);
        meta.addAttributeModifier(Attribute.GENERIC_ARMOR, helmetDamageModifier);
#

holy crap

#

thank you

#

It all on head

#

EquipmentSlot.HEAD

#

I need to change that

#

eyyyy

kindred solar
eternal oxide
#

I'm going to guess you are trying to do this in the death event?

kindred solar
#

yes

eternal oxide
#

You can;t.

#

you have to do it in teh damage event or the respawn event

#

Are you wanting to avoid teh death screen totally?

kindred solar
#

no, i just want to make when the player press the "respawn" button he gets teleported to a specific world

eternal oxide
#

then set a flag (PDC) on the player in the death event, then when the PlayerRespawnEvent fires look for the flag and teleport as you need.

somber hull
#

how do i use this?

#

Is there a seperate API i have to import?

eternal oxide
#

Thats Not spigot

somber hull
#

Would it work on spigot?

young knoll
#

No

eternal oxide
#

Its not spigot so no

elfin pilot
#

i have used that before

somber hull
#

Ok

#

How would i detect if the player is jumping

#

without side effects like if they are flying

#

close to the ground

elfin pilot
#

it can get resource intensive, but something like player.isOnGround() maybe

young knoll
#

StatisticIncrementEvent is the best option

elfin pilot
#

then test if player.isGliding()

eternal oxide
#

check teh isFlying() is false and check their Y velocity

somber hull
#

alright

elfin pilot
#

though you will run into issues with ladders

young knoll
#

That will trigger with a bunch of other stuff

elfin pilot
#

and climables

elfin pilot
#

climbables*

young knoll
#

Even using the StatisticIncrementEvent has some issues with ladders

eternal oxide
#

you can;t trust isOnGround() as thats totally client side adn can be easily faked

somber hull
#

How do you do it?

young knoll
#

Jumping is simply too client sided to detect reliably

elfin pilot
#

so check if the block at their feet is Material.AIR in addition

somber hull
#

ok

#

should i use PlayerMoveEvent?

fading lake
young knoll
#

I still vouch for the StatisticIncrementEvent

somber hull
elfin pilot
#

something like this

public boolean IsJumping(Player player) {
  boolean jumping = false;
  if(!player.isOnGround()) {
    if(!player.isGliding()) {
      if(player.getLocation().getBlock().getType().equals(Material.AIR)) {
        jumping = true
      }
    }
  }
  return jumping;
}
young knoll
#

It handles most of the scenarios for you

#

But will still trigger when getting on ladders

elfin pilot
#

probably not a very good solution but you could add on to it

elfin pilot
dusty herald
#

isn't isOnGround() deprecated?

somber hull
young knoll
dusty herald
#

thought so

#

client can manipulate it iirc

elfin pilot
#

yeah

dusty herald
#

just use paper's PlayerJumpEvent /s

elfin pilot
#

you'd almost certainly need some form of anticheat to go along with this

#

heh

somber hull
dusty herald
#

yes

somber hull
#

welp

#

I can try it

dusty herald
#

I don't use the paper api, but I use paper

#

timings is just 100% easier to read

elfin pilot
#

^

#

there isn't a great way to detect whether the player is jumping

#

but any of the ideas above might be a solution

vernal wagon
#

hey

#

whats damage sound?

#

like when player hits a player

#

what is sound name

#

can smb tell me pls?

outer crane
#

take a look through that

vernal wagon
#

thx

alpine urchin
#

ur pfp

#

LOL

somber hull
#

...

alpine urchin
#

its hard to take u seriously lol

somber hull
fathom timber
#

How do I make a message sent to a client but isn't visible for others

lost matrix
fathom timber
#

God bro

#

I'm actually overcomplicating it lmfao

#

Ty

hasty nimbus
#

hello guys can somebody make a 3x3 pickaxe plugin for me also the pickaxe mine 3x3blocks bc everytime i try some shit errors comes out

eternal oxide
#

Thats not a difficult project. Just take it one step at a time.

zealous silo
#

Hello, I've got a question, is it possible to get the server public IP and the port, the ones a player would use to connect? I can't use Bukkit.getServer().getAddress(), as I have read it returns the IP in server.propreties (returns blank string for me anyways), and the InetAddress way doesn't work either because it returns the local IP...
(it also shouldn't use an external website)
Is there a way to do that with "normal" bukkit?

eternal oxide
#

Bukkit has no routing nor gateway information revealed

zealous silo
#

ok thanks

quaint mantle
eternal oxide
#

He did say he didn;t want to use an external website

quaint mantle
#

too bad!

eternal oxide
#

true

quiet ice
#

You can listen for the Server list ping

quaint mantle
#

not what hes trying to do

quiet ice
#

Yes, but it does return the domain name

quaint mantle
#

server public IP

quiet ice
#

You can resolve the domain name afterwards

quaint mantle
#

"normal" bukkit?

quiet ice
#

It'S java

quaint mantle
#

read the question

quiet ice
#

I. e. listen for SLP, obtain the Server Address field in the handshake packet, then connect to that address via Java API, then obtain the ip address to it

quaint mantle
#

or, just use my solution which is 10x easier

quiet ice
#

It does not use any foreign Websites

quaint mantle
#

idk why he doesnt wanna use an external website

#

sounds unreasonable to me

quiet ice
#

Alternatively on windows you can make use of ipconfig and parse that

#

I think so at least

quaint mantle
#

no reason to do that

quiet ice
#

Using a website is the naive approach, using SLP is the extremely naive approach and lastly using ipconfig or similar is the hacky approach.
Choose what you want

zealous silo
#

yup, that's the conclusion I arrived to and was asking to find out if there is a normal approach

#

thanks everyone 🙂

tribal holly
#
double radianYaw = player.getEyeLocation().getYaw();

if (radianYaw > 180) {
  radianYaw -= 360;
} else if (radianYaw < -180) {
  radianYaw += 360;
}
Bukkit.broadcastMessage(String.valueOf(radianYaw));
radianYaw *= Math.PI / 180.0;

Vector dir = new Vector(-Math.sin(radianYaw) * chargeCoef, yCoef, Math.cos(radianYaw) * chargeCoef);
player.setVelocity(dir);```

Hi ! I'm trying to eject a player to the direction where it look. but there everytime a small gap between where the player watch and where he is eject
#

and i don't know why this gap is present and i don't find solution to correct this

quaint mantle
#

you want to push him in the direction he's looking?

inland totem
#

Hello! I recently added a new plugin to my minecraft server, the name of it is "ShopGUI+", and I would like to translate him to french, is it possible ? Thanks for responses!

quaint mantle
#

set the player's velocity to the direction of their location and then u can adjust that velocity how u want

inland totem
#

thanks and sorry for send this here x)

quaint mantle
#

for example player.setVelocity(player.getLocation().getDirection().multiply(2.0D));

tribal holly
quaint mantle
#

you can adjust the Y to whatever you want after modifying the vector entirely

tribal holly
#

but i wanna understand why my code don't work

#

why is there this small gap

tribal holly
#

however there still the problem

quaint mantle
#

show a gif or video idk what u mean by small gap

tribal holly
#

in red where the player he looking and in blue ejection direction

#

and some times his more important and other less

cold pawn
#

any reason why im getting this error?

sullen marlin
#

yes, a variable you're using on line 26 is null

cold pawn
#

ah i see

empty oyster
#
for (int i = 0; i < MineEvents.mine.size(); i++) {
for (Player spieler : MineEvents.mine.get(i)) {
ActionBarAPI.sendActionBar(spieler, "TEST");
return;
}
}

Why is this not working?? for (Player spieler : MineEvents.mine.get(i)) {

#

Can only iterate over an array or an instance of java.lang.Iterable

sullen marlin
#

Your second for loop makes no sense

#

Use one of the loops, not both

empty oyster
#

Hm ok, thx i tryit

rugged topaz
#
                Bukkit.getScheduler().scheduleSyncRepeatingTask(Lobby.instance, () -> {
                    armorStand.teleport(p.getLocation().add(0D, 2.35D, 0D));
                }, 0, 0);

this armor stand should stay on top of the player's head at all times, however even with 0? (which i can't comprehend the logic behind), let's say 1 tick repeating, it's not perfect. i've seen servers pull this off before so i'm sure it's possible if anybody knows

#

i'm aware the server is behind the player client-side, so there's a sort of latency in that aspect, but i'm talking about other players.

quaint mantle
#

How can I add an ItemStack to a chest? inventory.setContents, inventory.setStorageContents, and inventory.setItem all aren't working out for me. Surely I'm doing something wrong.

Itemstack instantiation:

itemStack  = new ItemStack(Material.RED_STAINED_GLASS_PANE, 1);
itemMeta = itemStack.getItemMeta();
Lore.add("THIS CHEST IS A DISPOSAL CHEST.");
Lore.add("ALL ITEMS PLACED INTO IT ARE FORFEIT.");
itemMeta.setDisplayName("Warning!");
itemMeta.setLore(Lore);
itemStack.setItemMeta(itemMeta);```

Container append:
```java
container = chest.getContainer();
inventory = container.getInventory();
inventory.clear();
item = new ItemStack[container.getInventory().getSize()];
item[0] = itemStack; 
//Tried inventory.setContents, inventory.clear + inventory.setItem, inventory.setStorageContents.
inventory.setStorageContents(item);
container.update(true, false);

No errors are being thrown (It's in a try/catch -> log block). I'm thinking I'm probably doing something wrong with the ItemStack, since clearing the inventory works perfectly fine. All variables are declared out of these blocks just to save space on my already large message.

cloud berry
#

guys how big r object references? .-. i assume 8 bytes on 64bit cpu?

sullen marlin
#

if youre calling .update you need to use getSnapshotInventory

cloud berry
#

greetings master md_5

nova ferry
#

Is it possible to see the "decompiled" code from BuiltTools?

sullen marlin
#

work/decompile folder

nova ferry
#

Alright thanks

ornate heart
#

Is there a way to have blocks disappear for you, but to other player's they're still there.

For instance, there is a wall and for you, that wall has a whole you can walk through but to other players that whole isn't there.

sullen marlin
#

or literally sendBlockUpdate

#

stop. suggesting. packets. or. nms. for. everything.

cloud berry
cloud berry
#

yea this isnt even packets ;-; sry

ornate heart
#

Gotchu. Would the player be able to go through the space that doesn't have the block change if that makes sense or is there sort of a invisible barrier still there?

cloud berry
#

if the block is there in reality but hidden for the player, no the server still knows theres a block there so it'll knock player back

#

idk how to get around that .-.

sullen marlin
#

do the opposite probably

cloud berry
#

yea lol the sample code i posted was for placing imaginary blocks where there were none

ornate heart
#

Gotchu. I'll play around with it. Thanks

cloud berry
#

hav fun sir

rugged topaz
cold pawn
#

Hey I have a medieval based server and I created this plugin that lets players to pick between General chat, RP chat, and Kingdom chat though kingdom chat is not working it has worked before in the past but is no longer working even though the code seems fine, so I was wondering why it isent working.
Code - https://paste.md-5.net/esipazuzox.cs

lost matrix
#

And really respect the character limit.
If your line is more than 130 - 150 chars then there is something seriously wrong with the code style.

#

And prevent single character variables. Thats a bad habit.

rugged topaz
#

hey @lost matrix r u able to comment on my issue?

cold pawn
# lost matrix This is unreadable... I would strongly advise you to clean that up a bit. Create...

I ik I dont really like it either but this plugin was made awhile ago when 1.12 was still relevant, ill do the clean up later but the only code that matters is this

            if (!p.hasEnabledLChat().booleanValue())
                this.msg.sendMessage((CommandSender)pl, (MessageUtil.Messages)MessageUtil.Message.CHAT_LAND_DISABLED);
            e.getRecipients().clear();
            for (Player on : Bukkit.getOnlinePlayers()) {
                DivineCorePlayer online = Main.get().getPlayerManager().getPlayer(on.getUniqueId());
                if (on == pl) {
                    e.getRecipients().add(on);
                    continue;
                }
                for (String land : p.getLanden()) {
                    if (online.hasLand(land) && online.hasEnabledLChat().booleanValue())
                        e.getRecipients().add(on);
                }```
rugged topaz
#

please use three backticks instead of one

#

my eyes

cold pawn
#

srry xD

rugged topaz
#

likewise

cold pawn
#

intellij

rugged topaz
#

the .booleanValue() and the redundant casts should be picked up by intellij

#

yea?

#

telling you that they're unnecessary

lost matrix
#

And not even a cast

rugged topaz
#

(CommandSender)pl

lost matrix
#

Ah you mean that line

left swift
#

hello, how can i lock the instrument in a noteblock? I put a noteblock with a given instrument, but when the block under the noteblock is updated, the instrument changes

lost matrix
#

This kind of looks like it was taken from decompiled code actually

rugged topaz
#

^

cold pawn
#

yeah I said I made it when 1.12 was still relavent im trying to update it to 1.16

lost matrix
rugged topaz
#

do me a favor and send me a screenshot of your ide's pov

cold pawn
rugged topaz
#

hover over all the yellow highlights

#

and fix them

#

hover over the dark gray

#

fix them

cold pawn
#

last time I did that it broke the whole thing

left swift
rugged topaz
#

?

#

it won't break anything

#

it'll ask you to remove .booleanValue() as it's unnecessary, then the new Object[] {, yeah definitely decompiled

#

Boolean.valueOf(false)?

lost matrix
# cold pawn

Everything that is yellow should be resolved. That would be step one to "updating" something from decompiled code.

rugged topaz
#

on is very ambiguous

#

try all or allPlayers

#

for the Player on : Bukkit.getOnlinePlayers()

#

this. is also unnecessary in that context but that's your choice 🤷

lost matrix
rugged topaz
#

Collored is literally spelt wrong in getColloredMSG

#

consider changing pl to -> p or player

#

i can't really help u with this, but reduce nesting with the } else { and if () {'s

#
if (message#startsWith("! ")) {
    // blah
}

if (message#startsWith("# ")) {
    // blah
}```
is better than collapsing it all with `} else {`
lost matrix
#

I would just re-write this to be honest.
With proper object oriented models. Create a ChatChannel class and add/remove users from there.

cold pawn
#

I put it as pl because it smthing else is using p

rugged topaz
#

change Main to a more suitable class name for sure

#

okay what's p?

#

plugin?

cold pawn
#

no its to get the playermanager

white obsidian
#

is there any difference between
Bukkit.getOfflinePlayerIfCached(String)
and
Bukkit.getOfflinePlayer(String)

lost matrix
#

Dont use single or binary length variable names. Its a bad habit.

rugged topaz
#

manager && pm > p

#

for that instance

#

looks like your main class is dubbed as a final ? you should also learn to use that since i'm guessing it wasn't you who put that

#

you should definitely switch to maven/gradle since your plugin's size rn is gonna be looking at 40mb or so

lost matrix
rugged topaz
#

stick to all lowercase for packages

cold pawn
#

nah just 30jmb

rugged topaz
#

that's not a flex

#

either

cold pawn
#

ik

white obsidian
rugged topaz
#

it's sort of weird you went with cokm.trixy.dcv2 and then there's .Json and .Utils, but then .listner which is spelt wrong

#

stick to lower

#

case

#

your sidebar on intellij does not need to be that big either

#

resolve these

#

it also looks like you have several classes inside one another, i'd assume they're not enums so

#

you should also get that checked

#

or maybe they're enums ig

#

all your json stuff should go into utils.json

#

the ambiguity between events and listeners because unless you're creating your own events i don't see why they're not all just under one or the other

cold pawn
#

they are there own events

rugged topaz
#

show me

#

i ran out of things to help u amend anyway

cold pawn
rugged topaz
#

okayyyy

#

that is

#

a mess

#

too much nesting #1

#

fix highlights #2

lost matrix
rugged topaz
#

fix gray text #3

#

press ctrl + alt + L to reformat spacing

cold pawn
#

ok this plugin was made 1 or 2 years ago its not gonna be clean I was still only learnin gback then

rugged topaz
#

admit it it was decompiled

#

why are you surrounding everything with a try { catch }

cold pawn
#

BRO IT IS I MADE IT TO YEARS AGO ON A 1.12 server

rugged topaz
#

two*

cold pawn
#

yeah 2 years ago srry

lost matrix
#

I started 2.5y ago. If i would have to re-write something from more than 6 months ago i would just be like "screw this trash im rewriting everything"

cold pawn
sage swift
#

how can i get the velocity of a projectile and set it to the velocity of another, but change the direction it's going while keeping the speed the same?