#help-development

1 messages ยท Page 1471 of 1

candid galleon
#

it's an invalid plugin jar

north field
#

how can i fix it?

candid galleon
#

is it your plugin?

#

oh it is

#

make sure you're building/exporting it properly

north field
#

im using intellij and im building artifacts to my server/plugins folder

tardy delta
candid galleon
#

can we see your project structure?

north field
#

yeah sure

#

modules is just 1.8.8 spigot and artifacts has the compile output

tardy delta
#

Sure that your plugin.yml is valid? ^^

#

Or that it is inside the resources part?

north field
candid galleon
#

what's in the plugin jar?

north field
#

in terms of classes?

tardy delta
#

just take a screenshot ._.

north field
#

i cant post images here

severe folio
north field
severe folio
#

Your plugin.yml is placed inside of a package

north field
#

where is it meant to be?

severe folio
#

Root of the source folder preferably

north field
#

alright, i'll try that

#

it worked! thank you sm

summer scroll
#

If I have PlayerData object and store them in a Map and I modify the value inside the object, would the value on the Map changed aswell?

mortal hare
#

HashMap stores only object references. That is why, it is impossible to use primitive data types like double or int.

summer scroll
#

ah, basically I'm trying to store the last saved data and compare them on save.

#

If the value is different, then save the data.

mortal hare
#

unless you change the object itself

#

then it won't

#

every created object in java have a hashcode which used in Maps

#

if memory address doesn't match it means objects are not the same

#

== compares memory address of the primitive data type or object

#
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1 == s2);
#

for example this would output false

#

since two String object's memory addresses are different on heap

#

if you do
s1.equals(s2) then it would return true, because it doesn't check the memory address but the content of object itself

#

equals() method can be overriden by class if you want to create your custom equality method.

summer scroll
#
private final Map<UUID, PlayerData> map1 = new HashMap<>();
private final Map<UUID, PlayerData> map2 = new HashMap<>();

// On Join
PlayerData playerData = new PlayerData(uuid);
map1.put(uuid, playerData);
map2.put(uuid, playerData);

// On Move
map1.get(uuid).addCoins(1);

// Will the value will be the same?
broadcast(map1.get(uuid).getCoins());
broadcast(map2.get(uuid).getCoins());
#

something like this

mortal hare
#

should be

#

test it

#

its the same object

summer scroll
#

yeah i'm about to test it

mortal hare
#

it should return properly for both

#

unless its on separate threads

#

since its undefined behaviour if the two threads access the same object, thread caches need to be synchronised, because we don't know when the value will be updated in the another thread

#

but in single thread enviroment this would work fine

summer scroll
#

i think it's pretty clear if the map only holds the reference not the copy

tardy delta
#

is there a way to lock minecraft doors?

visual tide
#

boolean or Boolean?

#

im confused

obtuse anchor
#

How do I fix "your sending too many packets!" even after its been set to -1 in the .yml file
in the spigot.yml file
if someone has the answer to my question ^^
please reply or @obtuse anchor1550

visual tide
#

set it to int limit

obtuse anchor
#

which is?

obtuse anchor
visual tide
#

2147483648

obtuse anchor
#

thanks

eternal oxide
#

I saw no borders

lapis heath
#

same on bedrock just different texture

quaint mantle
#

Please help me, how create a minecraft launcher and connect the launcher with minecraft server?

keen kelp
#

how do I fix the bug of the player receiving a very weird amount when they take damage from poison, fall damage etc?

eternal oxide
keen kelp
#

the like reason why being on fire/poisoned can make your jump longer

lapis heath
visual tide
#

why does intelliJ tell me "Method invocation 'setExecutor' may produce 'NullPointerException'" for getCommand("mycommand").setExecutor(new myCommand());

keen kelp
#

tell intellij to ignore this warning

visual tide
#

ok

eternal oxide
quaint mantle
eternal oxide
#

MainCMD.java:51

quaint mantle
#

Yeah I know. I'm just not sure what's wrong there?

keen kelp
#

hey ElgarL

quaint mantle
#

as I don't see any errors there

eternal oxide
#

what is line 51?

quaint mantle
#

this.ArenaManager.setLobbyLocation(player, player.getLocation());

#

lemme try soemthing really quick

keen kelp
#

Is there a way to circumvent the wierd velocity that fall damage/poison/fall damage gives?

quaint mantle
#

yeah line 51, It doesn't seem to work

keen kelp
#

Vanilla doesn't do this and the bug has been here ever since the beginning of time

eternal oxide
keen kelp
#

well can we fix this?

visual tide
#

not sure

#

maybe custom poison or fall dmg

eternal oxide
#

also this.ArenaManager is a field so should be this.arenaManager

quaint mantle
#

oh

#

That doesn't seem to work as I'm somewhat sure it's supposed to be ArenaManager

eternal oxide
#

Only a class would be called that. You set it as a field so it shoudl be arenaManager. But its null, you are never setting it

quaint mantle
#

ait I changed it all now but I still get an error with this line arenaManager.setLobbyLocation(player, player.getLocation());

obtuse anchor
#

How do I fix "your sending too many packets!" even after its been set to -1 in the .yml file for viaversion
in the config.yml file
if someone has the answer to my question ^^
please reply or @obtuse anchor

#

i already tried making it -1

#

and the inf number it still did it

eternal oxide
quaint mantle
#

Yeah I know, and I literally don't see how it's null

#

want me to send the classes and stuff?

worldly ingot
#

wait... send your arena manager again? o.O

quaint mantle
worldly ingot
#

and the command?

keen kelp
#

is it possible to damage player without the velocity being
0
-0.0784000015258789
0

eternal oxide
#

Just send yoru main class

keen kelp
#

It's a bukkit bug iirc?

worldly ingot
#
    this.getCommand("timv").setExecutor(new MainCMD(arenaManager));

    ArenaConfig arenaConfig = new ArenaConfig();
    this.arenaManager = new ArenaManager(arenaConfig, this);
#

Ordering

keen kelp
#

Hey choco

quaint mantle
#

oh I had those two under the command :(

keen kelp
#

is there a solution to the unwanted velocity?

worldly ingot
#

I don't know. I'm not sure I'd even consider it a bug because that's just vanilla functionality

keen kelp
#

is it>

#

cause I tested it in singleplayer and it doesn't seem to be the case

obtuse anchor
#

How do I fix "your sending too many packets!" even after its been set to -1 in the .yml file for viaversion
in the config.yml file
if someone has the answer to my question ^^
please reply or @obtuse anchor
i already tried making it -1
and the inf number it still did it

quaint mantle
keen kelp
tardy delta
#

how can i get the amount of blocks a player has mined?
the api says player.getStatistic(Statistic.MINE_BLOCK) but it says it requires an additional parameter do i really need to add all the blocks :/

summer scroll
#

player.getStatistic(Statistic.MINE_BLOCK); works fine

tardy delta
#

it gives an IllegalArgumentException and says it needs an additional paramater :/

#

console dont lies

wraith rapids
#

yeah statistics aren't tracked globally, only per-block

#

same issue as with the deaths statistic

tardy delta
#

huh

summer scroll
#

ah true

tardy delta
#

you mean deaths are tracker per player?

wraith rapids
#

nevermind

summer scroll
#

guess you need to do that using for loop

#

to get total mined blocks

tardy delta
#

or maybe i can specify an array with the blocks that needs to be counted

wraith rapids
#

use an enumset

summer scroll
#

sure

tardy delta
#

okay

#

or something like this

#

Material[] blocks_mined = {Material.STONE, Material.ANDESITE};

summer scroll
#
EnumSet<Material> materials = EnumSet.of(
  Material.STONE,
  Material.ANDESITE
);
maiden briar
#

If I add this --add-opens java.base/java.lang.reflect=ALL-UNNAMED, I have access to reflection, but how to automatically add this? So people don't have to start up their server with this line

tardy delta
summer scroll
#

by looping the set

#
public void getTotalMinedBlocks(Player player){
  int total = 0;
  for(Material material : materialSet){
    total += player.getStatistic(Statistic.MINE_BLOCK, material);
  }
  return total;
}
#

if you want to get all materials, just change materialSet to Material.values()

wraith rapids
#

@maiden briar you don't

maiden briar
#

Ok ๐Ÿ˜ฆ

eternal oxide
#

Blocked by teh Security manager?

maiden briar
#

That could be possible

eternal oxide
#

simple question, is your error thrown when you setAccessible?

quaint mantle
#

hi there. How i can cancel moving item in offhand with F hotkey? InventoryMoveItemEvent, InventoryClickEvent and InventoryDragEvent don't helps

quaint mantle
eternal oxide
#

explain "Does not work"

#

You simply asked how to prevent moving an item in offhand

quaint mantle
quaint mantle
near crypt
#

how much ticks is one second in minecraft?

keen kelp
#

how do I prevent players from using the offhand

odd thicket
quaint mantle
near crypt
#

okay thx

keen kelp
#

what about putting in the off hand in the inventory

quaint mantle
#

check slit

quaint mantle
summer scroll
#

using libs like that ig

quaint mantle
#

There are only 2

#

one outdated

#

other bad

near crypt
#

how can i send a countig down 3, 2, 1 title?

summer scroll
quaint mantle
#

or scheduler

candid galleon
#

titles wouldn't be Player.Spigot

#

that's just Player#sendTitle

near crypt
#

yes player.sendTitle("")

quaint mantle
#

that's for actionbar

#

sry

eternal oxide
#

not action bar, player.sendTitle

odd thicket
eternal oxide
#

In a BukkitRunnable that self cancels once done

quaint mantle
candid galleon
#

for equipping armor in hand

#

ie right clicking with it

quaint mantle
#

thx

odd thicket
#

If you right click with a armor piece in hand, you equip it

wraith rapids
#

you will also equip armor if a dispenser fires at you

quaint mantle
#

fuk

#

i need to fix this all

#

i can't fix it without paper?

odd thicket
#

There it would need an EntityPickupItemEvent

#

or cancel the BlockDispenseArmorEvent

quaint mantle
#

PlayerPickupItemEvent works too

odd thicket
#

That's deprecated

quaint mantle
#

k

odd thicket
#

at least for me

quaint mantle
#

i'm going to realize it

eternal oxide
#

its entity now

wraith rapids
#

as if deprecations meant anything

#

you can still use the ages-ago-deprecated sync chat event

odd thicket
#

I thought MOVE_TO_OTHER_INVENTORY would solve that

quaint mantle
wraith rapids
#

basically just check the slots each tick

#

that's what most people do

quaint mantle
#

will it be optimized?

wraith rapids
#

@quaint mantle if you were concerned about being optimized, you'd be using paper

#

but, it's not that heavy unless your server has armor items with super large itemmeta

#

and lots of players wearing armor

quaint mantle
wraith rapids
#

sounds dubious, but i won't debate that here

odd thicket
#

You could test if it's a Shiftclick on armor

wraith rapids
#

or you could use redlib which has an armor change event

odd thicket
#

Is there a way to reload a world after unloading it using Bukkit.unloadWorld that is not restarting the server?

near crypt
#

?paste

queen dragonBOT
wraith rapids
#

worldcreator or something, I don't remember

near crypt
wraith rapids
#

don't cast without checking

#

use plugin.yml for permissions

near crypt
#

ik but except the permission?

wraith rapids
#

use the bukkit scheduler instead of the bukkit runnable

#

use english variable names

quaint mantle
wraith rapids
#

other than that it's fine

near crypt
#

okay

keen kelp
#

help I can't prevent players from placing items onto their off hand

#

if(event.getRawSlot() == 45 && event.getSlot() == 40)
{
event.setCancelled(true);
}

#

I did this but if they click at anything above like 4cps it goes in anyway

odd thicket
near crypt
#

is there a good tutorial for the BukkitSheduler?

wraith rapids
#

yes, the documentation and the wiki

#

also using bukkitrunnable instead of bukkit scheduler here is the least of your worries

#

at present your command will explode if used from console

keen kelp
#

yo NNY

#

is there any good solution on preventing any offhand usage?

wraith rapids
#

call updateInventory or whatever

near crypt
#

but you cant send the command from the console in my code

wraith rapids
#

sure you can

#

and then it explodes

near crypt
#

no i check if the sender is a Player

wraith rapids
#

no you don't

#

you just cast to player

#

Player player = (Player) sender;
this explodes if sender is not a Player

keen kelp
#

and if it isn't it dies lol

wraith rapids
#

you are not checking whether it's a Player before casting

near crypt
#

oh yes okay

keen kelp
#

?paste

queen dragonBOT
keen kelp
wraith rapids
#

call player.updateinventory or something

keen kelp
#

ppl can still place item in off hand by spam clicking

#

how do I even get the player from InvetoryClickEvent

wraith rapids
#

see the docs

#

who do you think is doing the clicking?

keen kelp
#

The closest is HumanEntity which doesn't allow updateinvetory

wraith rapids
#

check and cast

quaint mantle
#

Cast it

keen kelp
#

HumanEntity extends Player?

wraith rapids
#

Player extends HumanEntity

keen kelp
#

oh

#

:P

wraith rapids
#

if HumanEntity extended Player, you wouldn't need to cast

#

because HumanEntity is a Player

keen kelp
#

oh dats right

near crypt
#

dats xD

quaint mantle
#

k, PlayerChangedArmorEvent from RedLib haven't e.setCancelled() method. I'm going to make crutches.

summer scroll
#

Anyone know what is the safest way to use premium resource placeholder?

keen kelp
#

still

#

@wraith rapids

near crypt
#

how can i clear built blocks from a player?

quaint mantle
#

how i can delete item from player inventory in PlayerChangedArmorEvent? item.setType(Material.AIR); doesn't works

quaint mantle
near crypt
#

woooow

#

really? xD

quaint mantle
#

yes

#

check placing

near crypt
#

k

quaint mantle
maiden briar
keen kelp
#

You got the Inventory and ItemStack object yes?

quaint mantle
#

yup

grim jewel
#

Hello. I want to ask. How can i try/catch this error. Caused by: java.lang.AssertionError: TRAP. I look on internet for what it means and i find out that if item is removed from inventory when player just interacted with it. So i want to ask how i can try/catch it. I tried everything to try/catch but still.

keen kelp
#

then just Inv.remove(Item)

quaint mantle
keen kelp
#

it removes all of ItemStack item from Inventory Inv

quaint mantle
#

removeItem is exists

#

i'll try that

grim jewel
keen kelp
#

use remove

grim jewel
#

So I have 2 classes. 1st is for joining into arena and 2nd is for leaving it. So in 1st class is that ItemStack that leaves player from arena.

keen kelp
#

so you want to give player an ItemStack when then join the arena and remove it when they leave?

quaint mantle
keen kelp
#

oh

#

it didn't do what I thought it would XD

grim jewel
#

When they interact with bed to leave it clears inventory their inventory and that error happends

keen kelp
#

why not Inventory.clear()

grim jewel
#

when i use that i got that error.

#
PlayerInventory playerinv = player.getInventory();
                playerinv.clear();
keen kelp
grim jewel
#

And my friend tells me that it might me server problem.

quaint mantle
#

And use Inventory

keen kelp
#

it's Inventory playerinv

grim jewel
#

uh it's up to me how i call it

keen kelp
#

no

#

the first argument is the data type

grim jewel
#

No i want to get player inventory

keen kelp
#

it's not up to you

grim jewel
#

and clear that

keen kelp
#

yes but Player's inventory is still an Inventory

#

just try it man

#

can't hurt you

#

PlayerInventory just does stuff with their hands and armor

#

not useful for you

grim jewel
#

same error.

keen kelp
#

well at least we know it doesn't make a difference

#

did you do Inventory.clear when the player is in bed?

#

or just when they click the bed

#

what event did you use

quaint mantle
#

nothing changes

eternal oxide
quaint mantle
#

ah, i have an error

keen kelp
#

did you use the correct slot

#

also why would you need whatever that lib is anyway

#

just use the InventoryInteractEvent or whatever it's called

quaint mantle
quaint mantle
keen kelp
#

cancel and delete is different

quaint mantle
grim jewel
#

Thanks for help. My friend helped me and it worked.

keen kelp
#

why drop

grim jewel
#

i just need to stop event.

keen kelp
#

and not just put it back

quaint mantle
#

i now need to clear this item

#

but it wanna not

keen kelp
#

what

#

just put it back in the player's inventory

#

Im confused at your motive

quaint mantle
#

IT IS NOT CLEARED

maiden briar
# eternal oxide No clue then

VarHandle MODIFIERS = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup()).findVarHandle(Field.class, "modifiers", int.class); the problem is at this line, no clue how to solve

eternal oxide
maiden briar
tired spoke
#

how can i add 1.8 support to a 1.12 plugin?

maiden briar
#

If I force this argument to the compiler --add-opens java.base/java.lang.reflect=ALL-UNNAMED I don't get any errors

eternal oxide
#

wrap in an Access controller and see if it still fails

maiden briar
#

How to wrap in it?

maiden briar
#

Oh this one, let's try

keen kelp
#

hi elgarl save me

eternal oxide
#
        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                // code here
                return resultl;
            }
        }```
keen kelp
#

I can't prevent player from placing item in their offhand slot

eternal oxide
#

that is only going to stop very specific actions

#

Your raw is different to your slot, so its only if you have an inventory open

keen kelp
#

raw 45 is 40

#

being the offhand slot

maiden briar
#
AccessController.doPrivileged(new PrivilegedAction()
        {
            public Object run()
            {
                try
                {
                    return MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup()).findVarHandle(Field.class, "modifiers", int.class);
                }
                catch(NoSuchFieldException | IllegalAccessException e)
                {
                    e.printStackTrace();
                    return null;
                }
            }
        });```
How can I set the field then? Or do I need to do it inside the run()? `private static VarHandle MODIFIERS;`
eternal oxide
#

have you debuged that?

keen kelp
#

yes

#

Raw slot: 45 Slot:40 Slot type:QUICKBAR

maiden briar
#

Ok

keen kelp
#

I have confirmed 45 is 40

eternal oxide
#

Does it ever prevent the placement?

keen kelp
#

it does until the player spam clicks

eternal oxide
#

try calling an inventory update after teh cancel

keen kelp
#

tried it

eternal oxide
#

so delay the update 1 tick

keen kelp
#

how do I do that

eternal oxide
#

a runnable/scheduler

#

new BukkitRunnable

maiden briar
#

java.lang.IllegalAccessException: module java.base does not open java.lang.reflect to unnamed module @aeb947a

private static VarHandle MODIFIERS;

    static
    {
        AccessController.doPrivileged(new PrivilegedAction<VarHandle>()
        {
            public VarHandle run()
            {
                try
                {
                    MODIFIERS = MethodHandles.privateLookupIn(Field.class, MethodHandles.lookup()).findVarHandle(Field.class, "modifiers", int.class); //HERE
                    return MODIFIERS;
                }
                catch(NoSuchFieldException | IllegalAccessException e)
                {
                    e.printStackTrace();
                    return null;
                }
            }
        });
    }
ivory sleet
#

What r u trying to do?

keen kelp
#

like this?

maiden briar
eternal oxide
ivory sleet
#

Cant you use unsafe for that or no?

keen kelp
eternal oxide
keen kelp
#

final Player p = (Player) event.getWhoClicked();

#

final Player p = (Player) event.getWhoClicked();
new BukkitRunnable() {
@Override
public void run() {
p.updateInventory();
}
};

eternal oxide
#

and after the } on the BukkitRunnable. type .runTaskLater

maiden briar
eternal oxide
#

auto complete to see the method

keen kelp
#

what would be the plugin

#

main?

eternal oxide
#

yes

ivory sleet
keen kelp
#

so I need to do the dependency injection thing again

maiden briar
#

Ok

keen kelp
#

I need to cast main to plugin?

eternal oxide
#

no

keen kelp
#

it asks for a plugin so

eternal oxide
#

the instance of yoru plugin

keen kelp
#

wait wat

eternal oxide
#

your instance extends JavaPlugin which extends Plugin

keen kelp
#

so Main

wraith rapids
#

not just Main, but an instance of Main

eternal oxide
#

the instance of your Main, via DI

keen kelp
#

oh....

#

for some reason my main was un-capitilised

#

which made me reference the wrong main

eternal oxide
#

yes, it shoudl be

keen kelp
#

I did capitalize it

#

prolly cause of a git rollback

eternal oxide
#

a Class is Capitolised, a field is camelCase

keen kelp
#

there we go

#

if(event.getWhoClicked() instanceof Player)
{
final Player p = (Player) event.getWhoClicked();
new BukkitRunnable() {
@Override
public void run() {
p.updateInventory();
}
}.runTaskLater(main, 1);
}

maiden briar
keen kelp
#

final int Number = 1;

ivory sleet
#

I donโ€™t think it matters whether the field is final or not

maiden briar
#

Ok

eternal oxide
ivory sleet
#

If itโ€™s an instance variable it definitely doesnโ€™t matter for unsafe

keen kelp
#

oh

ivory sleet
#

True constants (static final) wonโ€™t get affected

keen kelp
eternal oxide
#

yes

keen kelp
#

k

#

@eternal oxide

maiden briar
#

And static final fields?

keen kelp
#

it didn't work

#

now it doesn't even attempt to cancel it

eternal oxide
keen kelp
#

no

eternal oxide
#

di dyou even canel it?

keen kelp
#

doesn't even try

#

@EventHandler
public void OnClickOffhand(InventoryClickEvent event)
{
if(event.getRawSlot() == 45 && event.getSlot() == 40)
{
event.setCancelled(true);
if(event.getWhoClicked() instanceof Player)
{
final Player p = (Player) event.getWhoClicked();
new BukkitRunnable() {
@Override
public void run() {
p.updateInventory();
}
}.runTaskLater(main, 1);
}
}
}

eternal oxide
#

You are supposed to cancel it still, but then in yoru runnable update the inventory 1 tick later

keen kelp
#

now I dont even it to spam clic

#

wait wat

#

ok weird shits

eternal oxide
#

you will likely need to also cancel in teh inventory drag event

keen kelp
#
  1. It doesn't attempt to stop it if Im not placing in a full stack
eternal oxide
#

so scrap all the runnable

keen kelp
#
  1. spam click is still fine
#
  1. I can shift click things that defaults to the offhand slot into it
#

it there a better way man

maiden briar
#
java.lang.IllegalArgumentException
[15:25:38 WARN]:     at java.base/jdk.internal.misc.Unsafe.objectFieldOffset0(Native Method)
[15:25:38 WARN]:     at java.base/jdk.internal.misc.Unsafe.objectFieldOffset(Unsafe.java:1066)
[15:25:38 WARN]:     at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:650)
[15:25:38 WARN]:     at me.tvhee.tvheeapi.api.reflection.Reflection.setStaticField(Reflection.java:282)
[15:25:38 WARN]:     at me.tvhee.tvheeapi.api.reflection.Reflection.setStaticField(Reflection.java:270)
[15:25:38 WARN]:     at me.tvhee.tvheeapi.spigot.core.BukkitPluginLoader.onLoad(BukkitPluginLoader.java:34)
[15:25:38 WARN]:     at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:394)
[15:25:38 WARN]:     at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:251)
[15:25:38 WARN]:     at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065)
[15:25:38 WARN]:     at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289)
[15:25:38 WARN]:     at java.base/java.lang.Thread.run(Thread.java:831)```
Keeps going over, had to force stop the server

`unsafe.putObject(null, unsafe.objectFieldOffset(reflectedField), object);` static
`unsafe.putObject(this.object, unsafe.objectFieldOffset(reflectedField), object);` normal
eternal oxide
#

You will need to cancel both click event and the drag event.

#

The click event is the one that happens dropping an item in. The drag is if you are spam clicking in the box and you accidentally move the mouse as you click

keen kelp
#

is there not a better way

#

like inventory change event or smth

eternal oxide
#

no

keen kelp
#

oh god I need to cover so much

#

why is it so haaaard

eternal oxide
#

just remember a Class should have a specific task. So if you want to prevent that specific slot being used, you put all the events for that in one class.

keen kelp
#

yeah ik

eternal oxide
#

You can have teh same events in other classes for other objectives.

keen kelp
#

the class is named BanOffhand

#

I know but it just feels "Unclean"

#

I feel like it's not done cleanly

eternal oxide
#

Clean/tidy comes with experience

keen kelp
#

:/

wary harness
#

๐Ÿ˜

quaint mantle
#

what the...

#

paper doesn't fix that

#

how i can fix that?

drowsy helm
#

looks like a plugin

#

not a server issue

wary harness
river hearth
#

hey I'm having a problem building my plugin

#

Error: Failed to execute goal on project APTurrets: Could not resolve dependencies for project snowleapord.github.com:APTurrets:jar:2.5.a: Failed to collect dependencies at org.spigotmc:spigot-api:jar:1.14.4-R0.1-SNAPSHOT -> net.md-5:bungeecord-chat:jar:1.13-SNAPSHOT: Failed to read artifact descriptor for net.md-5:bungeecord-chat:jar:1.13-SNAPSHOT: Could not find artifact net.md-5:bungeecord-parent:pom:1.13-20190406.085510-73 in spigot-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/) -> [Help 1]

#

anyone know what is up with that?

eternal oxide
#
logger.setUseParentHandlers(false);
handler = new LoggerHandler();
logger.addHandler(handler);```<https://github.com/ElgarL/GroupManager/blob/master/src/org/anjocaido/groupmanager/utils/GMLoggerHandler.java>
elfin minnow
#

Am I able to change my already existing plugin to a premium plugin?

tardy delta
#

why cant i lock a door?

#

it has his own persistent data container right?

eternal oxide
#

no

tardy delta
#

well there is a server that has a plugin who's able to lock doors

#

so i was wondering how to do it then

eternal oxide
#

you track doors in some form of DB

#

or on the chunk PDC

#

validate the data on chunk load

stark canyon
#

Is there a way to have more colors in one line of lore?

eternal oxide
#

add more colors

stark canyon
#

THanks

#

I've been trying for 30 minutes with lore.add and I don't know how

eternal oxide
#

the same way you would add colors to any chat

#

using ChatColor

quaint mantle
#

or just use ChatColor#translateAlternateColorCodes

noble spire
#

I haven't done spigot for months and I've been doing too much pure java, how do you print to console (I'm pretty sure you're not meant to System.out.println(String msg))

quaint mantle
#

well, you can, but using the logger is better

#

you can use the logger to print messages

noble spire
#

oh yeah, getLogger().info(); thanks

tardy delta
lusty cipher
#

database

tardy delta
#

well how do i validata the data on chunk load? ๐Ÿ˜‚

eternal oxide
#

You read the data you have stored there, and check it corresponds to actual doors in the chunk

tardy delta
#

uhh okay

#

can you give me an example?

eternal oxide
#

no

tardy delta
#

oh wauw

#

i see something as if chunk.contains(block)

eternal oxide
#

Its exactly as you are currently doing in teh TileEntity PDC, but you store a map of that data against location keys in the chunk PDC

tardy delta
#

hmmm

stark canyon
#

turns out I just had to put + between different colors for the lore

tardy delta
#

so a hashmap?

#

with some data and a location

#

I'm wondering how to add this on my existing piece of code

#

so i have this now

Player p = event.getPlayer();
Location l = p.getLocation();
        Chunk c = l.getChunk();
eternal oxide
#

don;t use teh players location for the chunk, use teh block location

tardy delta
#

ok

eternal oxide
#

player could be stood in a different chunk

tardy delta
#

like this
Chunk c = block.getLocation().getChunk();

#

PersistentDataContainer chunkContainer = c.getPersistentDataContainer();

jagged badge
#

is there a known way to freeze a player at a position, but he can still look around (change his yaw and pitch)

eternal oxide
#

cancel move event if x.y or z change

tardy delta
#

i made something like that

#
@EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {

        if (MagmaBuildNetwork.getFrozenPlayerList().contains(event.getPlayer().getUniqueId())) {
            if (event.getTo().getBlockX() != event.getFrom().getBlockX() || event.getTo().getBlockY() != event.getFrom().getBlockY() || event.getTo().getBlockZ() != event.getFrom().getBlockZ()) {
                event.setCancelled(true);
            }
        }

where MagmaBuildNetwork.getFrozenPlayerList() returns a set of players uuids who are 'frozen'

eternal oxide
#

you change how you are creating your keys

tardy delta
#

but if the block is a tileState it converts to tilestate but how can i check if it's a door, fencegate etc?

#

class Openable I assume

eternal oxide
#

yes

tardy delta
#

well something that i found myself ๐Ÿคฃ

eternal oxide
#

javadocs are excellent when you learn to use them ๐Ÿ™‚

tardy delta
#

uhu

quaint mantle
#

is it a good idea to use CraftPersistentDataContainer to create an new instance PersistantDataContainer ?

eternal oxide
#

You should never create a new instance.

quaint mantle
#

y ?

tardy delta
# eternal oxide yes

something like this?

if (!(blockState instanceof TileState) || (!(blockState instanceof Lockable) || (!(blockState instanceof Openable)))) return;
        if (blockState instanceof Openable) {
            TileState tileState = (TileState) blockState;
            PersistentDataContainer container = tileState.getPersistentDataContainer();
        }
eternal oxide
#

Why would you ever want to create a new one? and why are you using Craft items?

tardy delta
#

I'm probably doing it wrong

eternal oxide
tardy delta
#

wdy mean?

eternal oxide
#

once it gets past this java if (!(blockState instanceof TileState) || (!(blockState instanceof Lockable) || (!(blockState instanceof Openable)))) return;You know its lockable for you.

#

It doesn;t matter what the block is beyond that

tardy delta
#

but what about moving that data to the chunk?

eternal oxide
#

just create your key plugin, blockX + "|" + blockY + "|" + blockZ

#

store your UUID under that key on the chunk PDC

#

any block you want to check if its locked you generate a key like that and see if the PDC has an entry

tardy delta
#

so what here?

#

just the blocks position and an uuid?

eternal oxide
#

blockX + "|" + blockY + "|" + blockZ

tardy delta
#

uninstall

#

just remove them out of the plugin folder

vital swift
#

which one lags more?
getting data from mysql without async
or setting data in mysql without async?

#

i want to know because i have few things

eternal oxide
#

both lag to hell and could crash out your server

cobalt blaze
#

The lag comes from the delay between the 2 servers

vital swift
cobalt blaze
#

Writing

#

But

eternal oxide
#

it will alwasy vary

cobalt blaze
#

It doesnt matter

vital swift
#

oke

tardy delta
#
String s = block.getX() + "|" + block.getY() + "|" + block.getZ();
        NamespacedKey chunkOwnerKey = new NamespacedKey(MagmaBuildNetwork.getPlugin(), s);
vital swift
#

i just wanted to know which one actually makes more

eternal oxide
#

The time between will vary so much there is no "which is worse"

vital swift
#

oke

cobalt blaze
#

The SQL part is quick usually, it's the request having to travel between servers which is the lag

#

If there are millions of records it might be slow though

vital swift
#

so i got the data and it didn't lag
and i had another code does the same but lags

cobalt blaze
#

If you are working with a database on your pc you wont notice it unless SQL hangs somewhere

eternal oxide
#

or it hits the HD

wet breach
#

if you use java 16 with native unix sockets and the mysql server is on the same host, you won't have much of a delay depending on hardware and resources.

tardy delta
#

@eternal oxide how do i use that key in this case?

eternal oxide
#

you use that to store the UUID that is locking the block in the chunk PDC

tardy delta
#

but you were talking about locations, what was that then?

eternal oxide
#

the x,y,z you just built the key from

#

thats the reference for that specific block

shy wolf
#

some one know how to remove hologram?

eternal oxide
#

destroy the armor stand

gilded seal
eternal oxide
#

pretty sure I gave you that command a few days ago

shy wolf
#

?paste

queen dragonBOT
eternal oxide
shy wolf
tardy delta
eternal oxide
tardy delta
#

dont really understand sorry

eternal oxide
#

you already store the UUID under a key, this is just changing the key to use the blocks location

tardy delta
#

ok

#

so i set the key with the location in the pdc of the block?

eternal oxide
#

as you are storing the uuid on teh chunk and not teh blocks TileEntity, you have to use a key that represents the block

lapis sphinx
#

how to make an server chat message again i forgot

lapis sphinx
#

like uhh it like speaks in the chat kinda. im probably explaining it weird

tardy delta
#

well but how can i check if the player has access to that (for example door)?

eternal oxide
#

you built a key for a block

#

you build the key again and check if it exists in the PDC

eternal oxide
gilded seal
#

how do I get them from the sword in the recipe

#

that's where im stuck xD

tardy delta
#

mmm

eternal oxide
#

inventory slot

gilded seal
#

confusion D:

eternal oxide
#

get the ItemStack in the slot

gilded seal
#

oki, lemme figure out how to do that

#

im hella new to bukkit so my head is just imploding

eternal oxide
#

There are two events, prepareCraftItemEvent and a craft event

tardy delta
#

so if the key with the location exists in the pdc?

gilded seal
#

thank you good sir

eternal oxide
#

you get the entry and check the UUID

tardy delta
#

how can i get the uuid of it isnt stored :/

eternal oxide
#

Its exactly as you are doing now, but not on the block so you have to use the location

#

You store it as I said earler

#

You seem to be not understanding what a key is and what the value is

gilded seal
tardy delta
eternal oxide
tardy delta
#

something like this?

String s = block.getX() + "|" + block.getY() + "|" + block.getZ();
        NamespacedKey chunkOwnerKey = new NamespacedKey(MagmaBuildNetwork.getPlugin(), s);

AND 

container.set(chunkOwnerKey, PersistentDataType.STRING, p.getUniqueId().toString());```
tired spoke
#

how can i add 1.8 support to a 1.12.2 plugin?

tardy delta
#

but i'm stucked how to implement it in the code i already have

eternal oxide
#

?paste

queen dragonBOT
shy wolf
#

help

eternal oxide
eternal oxide
#

afk for 10

shy wolf
#

oof

tardy delta
eternal oxide
tardy delta
#

how?

wraith rapids
#

get the pdc of the chunk

#

write the owner's uuid there

#

done

eternal oxide
# tardy delta how?

Thats not quite so easy as you have locations stored in teh keys. Sec and I'll show you.

wraith rapids
#

is declaring an owner for a specific, entire chunk not what he wants?

#

i didn't read any of the conversation

eternal oxide
#

nah, he's storign lock data on specific blocks

wraith rapids
#

you'll want a singular key then with a Set<Block> or Map<Block, UUID> value

eternal oxide
#

He's concat x,y,z in teh key

wraith rapids
#

yeah, don't do that

eternal oxide
#

its fine for his first attempt

wraith rapids
#

i suppose

eternal oxide
#

Not tested it, but that should remove any locks in the PDC that do not have a corresponding block that you want to lock.

#

ie, someone breaks a locked chest or door, when that chunk unloads that lock data gets removed.

#

or the server runs (for some reason) without your plugin loaded for a while.

wraith rapids
#

iirc there have been some arcane issues with accessing blocks in the chunk unload event

#

but my memory about that is very foggy and I think it had more to do with neighbors than just directly accessing the chunk

#

also what are we doing? why are we storing this in the chunk?

eternal oxide
#

he wanted to lock things other than things that had TielEntities

wraith rapids
#

uh

#

like doors?

eternal oxide
#

yep

wraith rapids
#

dealing with TE's might be redundant then

eternal oxide
#

I'd just do ```java
private boolean canLock(BlockState state) {

    return (state instanceof TileState || state instanceof Lockable || state instanceof Openable);
}```
wraith rapids
#

since you'll be using some sort of a transient in-memory blockkey -> data map anyway

#

is openable even related to state? isn't that data

eternal oxide
#

and yes, I told him to not bother with anything on the TileEntities

#

um, I'll check

wraith rapids
#

i vaguely remember it being blockdata rather than blockstate

eternal oxide
#

yeah, block data ๐Ÿ˜ฆ

#

not a problem

wraith rapids
#

myeah just grab data and instanceof

eternal oxide
#

return (state instanceof TileState || state instanceof Lockable || state.getBlockData() instanceof Openable);

worldly ingot
#

Just BlockState instance Lockable would achieve that, no?

#

It encompasses all of these

wraith rapids
#

doors aren't Lockable

worldly ingot
#

Yeah by design

eternal oxide
#

Door, gate and hatch are not

#

he want sdoor, gate and hatch so

worldly ingot
#

The Lockable interface represents objects that have the Lock NBT tag in vanilla ;p

wraith rapids
#

but yeah I suppose the tilestate check could be removed as we don't really care about things being tiles anymore

worldly ingot
#

TileState is a more specific BlockState

#

So yeah

wraith rapids
#

not that anything could be Lockable without being a Tile but iirc the api doesn't reflect that

eternal oxide
wraith rapids
#

what are the semantics of the chunk unload event again?

eternal oxide
#

semantics?

wraith rapids
#

i remember someone having issues with cyclic/recursive chunk loads caused by getting the contents of a chunk during the chunk unload event

eternal oxide
#

No clue, I've never used it, but it seemed the most sensible place to put the cleanup code

wraith rapids
#

might've been caused by them calling World::getChunk rather than ChunkUnloadEvent::getChunk

eternal oxide
#

possibly

wraith rapids
#

i remember there was some noob trap there that makes shit explode

#

does it make sense that an entity is valid but not in a loaded chunk?

eternal oxide
#

For a short time, yes

wraith rapids
#

define short time

eternal oxide
#

till cleanup after it moved into an unloaded chunk

wraith rapids
#

wdym cleanup

eternal oxide
#

I'm guessing Entities get cleaned up seperate to chunks unloading

wraith rapids
#

the new chunk system is a headache

#

i'm pretty sure the entities get invalidated and serialized with the chunk when it unloads

indigo iron
#

    @EventHandler
       public void onHit(EntityDamageByEntityEvent event) {
        
        if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
        
        Player hurt = (Player) event.getEntity();
        Player dealer = (Player) event.getDamager();        
         
             if (hurt instanceof Player) {
                      
                if (dealer.getInventory().getItemInMainHand().hasItemMeta() && dealer.getInventory().getItemInMainHand().getItemMeta().getLore().contains(ChatColor.GREEN + "- Blinding")) {
                    hurt.removePotionEffect(PotionEffectType.BLINDNESS);
                    hurt.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100, 2, false, true));
    //when player is not wearing a helmet this line here always sends an error                 
                    if (hurt.getInventory().getHelmet().hasItemMeta() && hurt.getInventory().getHelmet().getItemMeta().getLore().contains(ChatColor.GREEN + "- True Sight")) { 
                        hurt.removePotionEffect(PotionEffectType.BLINDNESS);
}
                }
             }
        }
    }
}``` I am always getting any error sent to console when the player is not wearing any helmets why is that? can someone please help
wraith rapids
#

but when a chunk actually unloads is different from when the api considers it to unload

#

because under the hood there are like different load levels and shit

#

and the api doesn't reflect that

queen dragonBOT
wraith rapids
#

it's all just ugh

eternal oxide
#

CounterEffects.java:27 Something is null there

indigo iron
#

no

eternal oxide
#

If he has no helmet you can't call .getItemMeta() on it

wraith rapids
#

no

#

lol

indigo iron
#

do you know a way i can fix that please?

wraith rapids
#

don't call a method on a null variable

#

ez

eternal oxide
#

test if he has a helmet first

wraith rapids
#

in other words

#

learn java

eternal oxide
#

?jd The javadocs are your friend. Always test anything that can be null.

indigo iron
#

so i am checking if the player is wearing a helmet first before running the code?

eternal oxide
#

yes

indigo iron
#

ok thank you

#

imma try that

wraith rapids
#

right, yeah, mystery solved

#

it was caused by load levels

#

apparently the api doesn't consider chunks with a load level below entity activation as loaded

#

however entities in such chunks are still valid

indigo iron
eternal oxide
#

how are you checking?

indigo iron
eternal oxide
#

you can;t getType

wraith rapids
#

getType will never be null

#

getHelmet may be null

#

if getHelmet is null, then the value you're calling getType on has nothing to be called on

#

which throws a nullpointerexception

indigo iron
#

alright I will try removing the get type

wraith rapids
#

you should try learning java

eternal oxide
#

He's close

wraith rapids
#

no really, look up a tutorial somewhere, you'll have a much easier time

eternal oxide
#

A lot of people have trouble understanding null

wraith rapids
#

a lot of people should gb2 the tutorials

indigo iron
eternal oxide
#

null is an odd concept it doesn't really exist in most languages.

coral sparrow
indigo iron
#

    @EventHandler
       public void onHit(EntityDamageByEntityEvent event) {
        
        if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
        
        Player hurt = (Player) event.getEntity();
        Player dealer = (Player) event.getDamager();    
         
             if (hurt instanceof Player) {
                
                if (hurt.getInventory().getHelmet() != null && hurt.getInventory().getHelmet().getType() != Material.AIR) {
                    return;
                    
                } else {                
                
                    if (hurt.getInventory().getHelmet() != null && hurt.getInventory().getHelmet().getType() != Material.DIAMOND_HELMET && hurt.getInventory().getHelmet().hasItemMeta() && hurt.getInventory().getHelmet().getItemMeta().getLore().contains(ChatColor.GREEN + "- True Sight")) {
                        hurt.removePotionEffect(PotionEffectType.BLINDNESS);
}
                }
             }
        }
    }
    
    }

I stopped getting the error but however when the player is wearing that helmet they still get blindness

indigo iron
coral sparrow
#

What error

indigo iron
coral sparrow
coral sparrow
#

CounterEffects class

indigo iron
#

    @EventHandler
       public void onHit(EntityDamageByEntityEvent event) {
        
        if (event.getEntity() instanceof Player && event.getDamager() instanceof Player) {
        
        Player hurt = (Player) event.getEntity();
        Player dealer = (Player) event.getDamager();        
         
             if (hurt instanceof Player) {
                      
                if (dealer.getInventory().getItemInMainHand().hasItemMeta() && dealer.getInventory().getItemInMainHand().getItemMeta().getLore().contains(ChatColor.GREEN + "- Blinding")) {
                    hurt.removePotionEffect(PotionEffectType.BLINDNESS);
                    hurt.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 100, 2, false, true));
    //when player is not wearing a helmet this line here always sends an error                 
                    if (hurt.getInventory().getHelmet().hasItemMeta() && hurt.getInventory().getHelmet().getItemMeta().getLore().contains(ChatColor.GREEN + "- True Sight")) { 
                        hurt.removePotionEffect(PotionEffectType.BLINDNESS);
}
                }
             }
        }
    }
}```
the error was from this code but then i changed it to the one u just saw
coral sparrow
#

um could you provide the line 27

#

btw why are you casting (hurt instanceof Player)

#

hurt is an entity right

indigo iron
#

yes

coral sparrow
#

ah nvm

coral sparrow
indigo iron
spark finch
#

How to save and set someones inventory?

I know this example is very simple, but wouldn't it be like this?

#

Doesn't work

opal juniper
#

As far as I knew it did

tardy delta
#

oh here im again

grim sage
#

I think when you do : Inventory inv = player.getInventory() the method will return the class not a copy of the inventory so when you clean the player inventory, inv will also become empty, so when you will set inv to a player inventory nothing will be put because inv is empty

wraith rapids
#

saving the player's inventory
this doesn't do what you expect it to do

grim sage
#

Yes

wraith rapids
#

what you are doing here is not copying the player inventory, nor are you copying its contents

grim sage
#

I think you have to save the content

wraith rapids
#

what you are doing is copying the reference

#

you then call clear() on the original reference, which tells the object that it refers to to clear its contents

#

your copied reference, however, also points at this same object

grim sage
#

Better explained than me haha

wraith rapids
#

so using the copied reference 'inv' to access the contents gives the same results as with the original player.getInventory() reference; empty

visual tide
#

is .isItem false for stuff like "potatoes" and "carrots"

sage swift
#

yes

wraith rapids
#

depends

visual tide
#

ok ty

sage swift
#

those are the crops

#

physical

wraith rapids
#

carrots block or potatoes block

sage swift
#

ageable

wraith rapids
#

never remember which one is the item and which is the block

sage swift
#

potato is item

visual tide
#

yes im trying to filter out all items that arent actually items from material#values

sage swift
#

potatoes is block

#
Material.values().stream()
.filter(Material::isItem)
.collect(Collectors.toSet());```
wraith rapids
#

sssttreeeeammms

spark finch
#

it works! Basically using ItemStack[]

wraith rapids
#

yes, retrieving the ItemStack[] returns a clone

#

as does almost any other itemstack related operation in bukkit

sage swift
visual tide
sage swift
#

.filter again

visual tide
#

ok ty!

wraith rapids
#

just don't do it all of the time

#

the material enum is enermous and streams aren't super fast to begin with

sage swift
#

filter(Material::isItem) is the same as filter(m -> m.isItem())

wraith rapids
#

which is the same as filter(new Predicate() {@Override public boolean test(Material m) { return m.isItem();}})

visual tide
#

yes but a lambda is nicer for the eyes

wraith rapids
#

a lambda is also cheaper than an anonymous local class

visual tide
#

is Arrays.stream(Material.values()) and Material.values().stream() the same?

sage swift
#

oh right values returns an array

#

Stream.of

tardy delta
#

so to store the lock on the chunks pdc what do i have to do?

eternal oxide
#

did you not look at my last paste?

tardy delta
#

im testing it

wraith rapids
#

you should read it and understand it instead of testing it

eternal oxide
eternal oxide
#

no

#

unless

#

you don;t need the data to persist between logins

tardy delta
#

error in the console

#

?paste

queen dragonBOT
sage swift
#

bet you're on a version < 1.14 lmao

tardy delta
#

ow it has something to do with an enum

#

nothing with lock thing

#

wtf is this

eternal oxide
#

No idea, you haven't posted anything

tardy delta
#

i think its this

#

|| (!(blockState instanceof Openable)))) return;

eternal oxide
#

blockState.getBlockData()

tardy delta
#

would that cause it?

#

it gives no errors so i think its just a return

eternal oxide
#

Cause what? You've been rambling about something but posted nothing.

tardy delta
#

ow it just does nothing

eternal oxide
#

line 52

tardy delta
#

do i need to set an api version?

Fatal error trying to convert MagmaBuildNetwork v1.0:io/github/FourteenBrush/MagmaBuildNetwork/PluginCommandExecutor.class
org.bukkit.plugin.AuthorNagException: No legacy enum constant for ANDESITE. Did you forget to define a modern (1.13+) api-version in your plugin.yml?
eternal oxide
#

are you building for a specific version?

tardy delta
#

nope

eternal oxide
#

Do you intend this to run on any version or only x+

tardy delta
#

this stupid thing

#
EnumSet<Material> materials = EnumSet.of(
            Material.STONE,
            Material.ANDESITE,
            Material.COBBLESTONE,
            Material.DIORITE,
            Material.GRANITE
    );

    public int getTotalMinedBlocks(Player p){
        int total = 0;
        for (Material m : materials) {
            total += p.getStatistic(Statistic.MINE_BLOCK, m);
        }
        return total;
    }
eternal oxide
#

set an api version in your plugin.yml

tardy delta
#

ke

warm galleon
#

how do i get the block the projectile hit in a projhitevent?

tardy delta
#

lock thing is going like brr again

hoary knoll
#

how does ChatColor#getByChar work?

eternal oxide
#

Shoo

warm galleon
#

wait nvm

#

im so dumb

tardy delta
#

think it gives early return

warm galleon
tardy delta
#

or it doesnt access the chunks pdc

#

can i get the chunk's data with /data?

eternal oxide
#

ah ok invalid key]

#

replace | with _

#

I forgot about the limited characters

indigo iron
#

@eternal oxide bro I am so sorry for pinging you, i just wanted to let you know that I fixed the code i had == & != mixed up, thank you for your help

summer lily
#

Hello, I am having issues with this line of code:
if (ChatColor.translateAlternateColorCodes('&', e.getClickedInventory().getTitle()).equals(ChatColor.GREEN + "Main Menu")) {
It just doesn't work. And it also says .gettitle is deprecated, what's the replacement then?
What I am trying to do is cancel inventoryclickevent on a custom gui. Thanks!

young knoll
#

getView

summer lily
#

How Would I implement that?

eternal oxide
#

event.getView()

summer lily
#

if (ChatColor.translateAlternateColorCodes('&', e.getView.getTitle()).equals(ChatColor.GREEN + "Main Menu")) {
like that?

#

Yup. It works

#

Thanks!

sage swift
#

please dont find your GODDAMN CUSTOM INVENTORY BY ITS NAME AAAA

summer lily
#

How do you reccomend me to find it?

sage swift
#

store something in the backend

#

what if someone renames a chest to that and places it down and opens it?

#

it'll have the same name.

summer lily
#

With color codes? Nah, plus the clicked items is also custom

#

Thanks though! I'll take it

sage swift
#

it's very possible if the server has a plugin for renaming items with colors; mine does.

#

strongly recommend finding it via something not accessible by the user

summer lily
#

Allright, thanks

tardy delta
#

not doing anything

#

oh what

#

[20:38:10] [Server thread/INFO]: FourteenBrush issued server command: /lock set
[20:38:12] [Server thread/INFO]: No Lock exists for this block!

eternal oxide
#

Store teh view when they open the GUI. you can then simply compare the instance

tardy delta
#

if if not exists set one ._.

sage swift
#

but not via the name

tardy delta
#

its maybe some strange code but i think it can work

#

i'm only wondering how to get the data of the uuid ingame

#

something with /data prob

eternal oxide
tardy delta
#

and it cant get removed the lock when the chunk unloads for example?

eternal oxide
#

no

sage swift
eternal oxide
#

no, nothing is stored on the block, its on the chunk PDC

tardy delta
#

hmm

sage swift
#

ah

#

i see

tardy delta
#

i'll take a better look at it tomorrow

#

goodnight people

eternal oxide
#

night

sage swift
#

people, lol

tardy delta
#

uhh

sage swift
#

lizard people

tardy delta
#

goodnight chicks

#

better?

sage swift
#

tf

tardy delta
#

neh

sage swift
#

neigh?

#

person, chicken, or horse? make up your mind

#

or better yet, gecko

tardy delta
#

gecko sounds great

#

bye

noble spire
#

I'm getting a list of all the materials with Material.values(), then adding it to another list if if (c != null && c != Material.BARRIER && c != Material.BEDROCK) {, basically any non survival obtainable block. I'm using 1.8.8, and I'm pretty sure there's some other invalid items, for example Item entity 16163 has no item?!

Is there a clean way of getting all the survival obtainable items (as a Material[])?

Material 1.8.8 docs: https://helpch.at/docs/1.8/org/bukkit/Material.html

young knoll
#

isItem isn't in 1.8

#

rip you

sage swift
#

kek

noble spire
#

yup

young knoll
#

Well, you also need to exclude air

#

End portal frames

#

Portal blocks

noble spire
#

yeah, but then there are quite a few items that have no value, but aren't null

eternal oxide
#

spawneggs

young knoll
#

Air has a value

noble spire
#

Are the item id's in order?

young knoll
#

No material in the array will be null

noble spire
#

Could all id's < 20000 be valid items

#

idk how 1.8 works

young knoll
#

With mods, maybe

#

But spigot doesn't support those

noble spire
#

hmm not sure

opal juniper
#

is there, and this is a longshot, a way to call like getBlocks or something on a chunk

#

to get all solid blocks

young knoll
#

Nested loops

opal juniper
#

Ahh ok

#

but no method

#
for (int y = 0; y <= 255; y++) {
    for (int x = 0; x <= 15; x++) {
        for (int z = 0; z <= 15; z++) {
            world.getBlockAt(x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16)).setType(Material.AIR, false);
        }
    }
}

like this? ^^

sage swift
#

<= 15 and 255 looks wack

#

just use < 16/256

opal juniper
#

fair enough

#

but i like it like that ๐Ÿ˜Ž

sage swift
#

i bet you do

opal juniper
#

yeah

#

i do

sage swift
#

i bet you do

opal juniper
#

what is the way to destroy block + tile entities and stuff

sage swift
#

Bukkit.shutdown()

opal juniper
#

really cool

#

but like instead of just setting the material

eternal oxide
#

set to Air and it will remove any TileEntity

#

if you set to any other type the TE may not be removed, or be the wrong type

opal juniper
#

Okay

#
    @EventHandler
    public void onChunkLoad(ChunkLoadEvent event){
        if (!event.isNewChunk()) return;
        Chunk chunk = event.getChunk();
        World world = chunk.getWorld();
        if (chunk.getZ() == 0) return;
        if (chunk.getZ() == -1 || chunk.getZ() == 1) return;
        
        for (int y = 0; y <= 255; y++) {
            for (int x = 0; x <= 15; x++) {
                for (int z = 0; z <= 15; z++) {
                    world.getBlockAt(x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16)).setType(Material.AIR, false);
                }
            }
        }
        for (Entity entity : chunk.getEntities()) {
            entity.remove();
        }
    }

This code is causing some real issues

[20:13:29] [Server thread/WARN]: Tried to load a DUMMY block entity @ BlockPosition{x=-683, y=45, z=79} but found not block entity block Block{minecraft:air} at location
[20:13:29] [Server thread/WARN]: Tried to load a block entity for block Block{minecraft:air} but failed at location BlockPosition{x=-683, y=45, z=79}

Ig it is because they would be filled once the chunk is generated... anyone know how to stop this?

sage swift
#

it's telling you that you're a dummy

opal juniper
#

im gonna laugh

sage swift
#

do it

opal juniper
#

BWAHAHAHAHAHHAHAHHA

eternal oxide
#

it has to be forced to wipe the old TE

opal juniper
eternal oxide
#

yes

opal juniper
#

ok, ill give it a shot

eternal oxide
#

no

#

sec

#

you need to update from teh state you got and changed the type on

opal juniper
#

so store the state?

eternal oxide
#
state = block.getState();
state.setType(Material.AIR);
state.update(true, false);```
#

added a false if you want no physics

opal juniper
#

hmm

eternal oxide
#

um, what the heck are you doing to get that?

formal ferry
#

how would i loop all the bungeecord servers in a for loop?

opal juniper
#

probs like getServers() or something

eternal oxide
opal juniper
formal ferry
eternal oxide
#

oh my

opal juniper
#

yeah

eternal oxide
#

Yeah good luck with that. I'd run it a tick after it loads

#

changing it during load is going to be problematic

#

as during that event its not yet loaded and you makign changes will try to reload it

opal juniper
#

Can i just supress the warnings? ๐Ÿ™ƒ

visual tide
#

is there a better way to do this

List<String> allBlockStrings = new ArrayList<>();
                        for (Material block : allBlocks) {
                            allBlockStrings.add(block.toString());
                        }