#help-archived

1 messages ยท Page 39 of 1

buoyant path
#

Im just gonna restart IntelliJ frostalf

blissful verge
#

What's wrong here?

  {
          //player
          Player player = (Player) sender;
          String name = player.getName();
              player.sendMessage(ChatColor.BLUE + "You have been granted access to play the game.");
  }```
subtle blade
#

Novato... lol

#

we literally just answered you

keen compass
#

ok, but some where in the menus you can invalidate the caches @buoyant path

buoyant path
#
@EventHandler
  public void onPlayerJoin(PlayerJoinEvent event)
    {
            //player
            Player player = event.getPlayer();
            String name = player.getName();
                player.sendMessage(ChatColor.BLUE + "You have been granted access to play the game.");
    }```
#

also

#

there is not a sender lol

subtle blade
#

Was going to mention the same, yea

keen compass
#

I changed that in the code I posted

subtle blade
#

Grab it from the event. You should have a basic understanding of how the language works before writing plugins

#

Pulling variables out of thin air is one of those mistakes you should not be making

keen compass
#

but its suppose to be magic

blissful verge
#

I mean how do I fix this then, i'm trying to change a command to join event

subtle blade
#

Dude we've answered you twice now lol

green lodge
buoyant path
#

I found the invalidate caches thing Frostalf

green lodge
#

Maybe its bungee

blissful verge
#

Dude I don't know how tf to do this

buoyant path
#

the code is literally right there lol

#

just copy paste it over yours

#
@EventHandler
  public void onPlayerJoin(PlayerJoinEvent event)
    {
            //player
            Player player = event.getPlayer();
            String name = player.getName();
                player.sendMessage(ChatColor.BLUE + "You have been granted access to play the game.");
    }```
green lodge
#

You just forgot the actualy playerjoinevent

keen compass
#

personally I don't use IJ, but I hear sometimes you have to do that when something weird is happening in the IDE that can't be explained XD

green lodge
#

homie

buoyant path
#

You use eclipse?

#

or something else?

keen compass
#

NetBeans

green lodge
#

I use intellij

#

works like that

#

can we get your entire code

#

as well then

keen compass
#

NetBeans is comparable to IJ

buoyant path
#

Yeah ig

green lodge
#

I have to use netbeans for school

#

I like IJ but its personal preference

buoyant path
#

I never learned this in school I taught myself lol

green lodge
#

same, but I get college credit for a skill I'm already decent with

buoyant path
#

Oh true

subtle blade
#

Ah, we have another NB user. I thought you were in IJ for some reason, Frostalf

blissful verge
#

But how do I find the god damn name

green lodge
#

hey bruh

blissful verge
green lodge
#

chill

#

lmao

blissful verge
green lodge
#

hover over the error

keen compass
#

I have tried out IJ, just didn't like the feel of it. I don't doubt IJ is good, but I prefer NB

green lodge
#

I love the look of it

#

feels modern

buoyant path
#

I used to use eclipse for like 3 years

green lodge
#

more like visual studios and thats where I came from

keen compass
#

besides netbeans lets me tweak the resources it uses to a degree easily ๐Ÿ™‚

green lodge
#

so its nastolgic

blissful verge
#

What u mean hover over the error

green lodge
#

plus since I'm technically a college student I get intellij ultimate edition free

#

cool plugins

keen compass
#

you need to import the relevant packages that your class is making use of

buoyant path
#
java.lang.NoClassDefFoundError: com/zaxxer/hikari/HikariConfig```
#

im so upset lol

#

I cant get this working jesus christ

keen compass
#

still not shading o.O

#

you will find typing in all CAPS isn't the wisest of things to do

#

nor does it solve your problem any better lol

#

it sounds like you need to learn more in how to use Java

subtle blade
#

Novato, I seriously advise taking time to learn the language instead. These are basic issues you could easily resolve yourself with a few minutes of research or an understanding of the language

buoyant path
#

Choco you good with maven ? lol

subtle blade
#

This is not a Spigot issue, this is a lack of Java knowledge issue

keen compass
#

maybe Choco could help ๐Ÿ™‚

#

he uses IJ

#

XD

subtle blade
#

Eclipse

#

What did we break?

keen compass
#

Oh wow, didn't figure you for an eclipse user lol

subtle blade
#

All day erry day

buoyant path
#

I get NoClassDefFoundError when using HikariCP because my maven wont compile it

keen compass
#

won't shade it

buoyant path
#

^

subtle blade
#

What's your shade plugin look like (probably sent it already, didn't see)

keen compass
#

yes, its way up above probably wise if he just resends the link for it

buoyant path
keen compass
#

Only thing I would probably remove or just comment it out to just try it, is

                                <includes>
                                    <include>com.zaxxer:*:*:*</include>
                                </includes>
                            </artifactSet>```
generally not necessary to have that
buoyant path
#

is that really gonna change the outcome? lol

subtle blade
#

Agreed. By default it will shade anything set to compile scope

keen compass
#

Like I have said earlier only times I have had to set includes or excludes is when I have to deal with transitive dependencies

subtle blade
#

I also don't think :*:*:* is valid

keen compass
#

which is dependencies of the dependencies XD

subtle blade
#

It would just be com.zaxxer:*

buoyant path
#

same error

#

without it

blissful verge
#

Well why doesnt this send a message:

    {
        Player player = event.getPlayer();
            String name = player.getName();
                player.sendMessage(ChatColor.BLUE + "Welcome " + name + "! Use /play to get access to commands. Do /commandsupport to learn more about commands.");
    }```
keen compass
#

first one is group, second is artifact the third is version @subtle blade

buoyant path
#

did you register the event

#

@blissful verge

blissful verge
#

What

buoyant path
#

Can I see your class that extends JavaPlugin

subtle blade
#

Yea but ::: implies 4

#

Not 3

#

Still missing an EventHandler annotation

buoyant path
#

Oh

blissful verge
#

public class Main extends JavaPlugin{

keen compass
#
package to filter on, group id, artifact id, version```
buoyant path
#

Frostalf could I see one of the pom.xmls you have used when using HikariCP before?

keen compass
#

it is correct, but yeah I would try removing the extra *'s though generally doesn't need all that either when using includes

subtle blade
#

It assumes wildcard if not specified anyways

keen compass
#

ah right forgot about that as well

subtle blade
#

But yea, that looks fine to me. Could be that IJ's Maven isn't sync'd with your pom? IDK. IJ does some fucky shit that I really hate

#

If you can refresh your Maven project at all, definitely do that

keen compass
#

he already did that @subtle blade

#

had him invalidate the caches, restart IJ

subtle blade
#

Yea but there's actually an option to refresh your maven project

keen compass
#

oh

subtle blade
#

You have to do it every time you add a dependency

#

(or make any change for that matter)

keen compass
#

interesting, never knew that. That is something in NB you don't have to do as it takes care of that for you XD

subtle blade
#

In Eclipse I can just hit F5 PES_SadShrug

buoyant path
#

Ill try it

keen compass
#

only time I would have to reload a project is if I edited the Pom manually but generally NB detects external changes

#

very rarely do I have to tell NB to do it

buoyant path
#

Build for the 300th time praying that it works lol

subtle blade
#

alright im off to bed. i'm absolutely exhausted. work killed me today lol

buoyant path
#

Gn

#

Same error frostalf

keen compass
#

don't worry I have had to build a project numerous times to get something resolved that just wouldn't work. As I said, I learned all about transitive dependencies especially with shading. I had that problem where a dependency or two kept bringing in the API for shading XD

buoyant path
#

this is so bad

keen compass
#

do you actually have the dependency downloaded?

#

HikariCP that is

#

that is the only thing I can think of, is that maven is trying to pull the dependency in, but isn't fetching it from the right place or at all

#

and just simply skips it

buoyant path
#

Wdym downloaded

#

?

#

downlaod from here?

keen compass
#

is it in your local maven repo?

buoyant path
#

No idek where that is

keen compass
#

it should be in
C:\Users\(user name\.m2

#

if on windows

buoyant path
#

oh

#

i see it

keen compass
#

if the dependency isn't in the local repository then I would manually install the dependency to the local repo

buoyant path
#

it is downloaded in there

#

@keen compass ?

keen compass
#

ok, try this then, navigate to your project directory open a command prompt as admin there

#

run mvn clean package install from the command line

#

if that still doesn't work then I really have no idea why IJ or maven isn't shading that in at all

#

and it wasn't HikariCP that I use as I learned, its BoneCP

raw basin
#

I'm working on a socket application for my plugin so that my client doesnt have to open console or mc to send messages, so I made a thread, that runs a runnable, that runs a Timer, that runs a timertask, to send messages to the socketserver whenever a message is made

#

the timer works well

#

until a message is sent to the socketserver

#
// Timerclass
    public SocketTimer(GUIMC gui) {
          Timer timer = new Timer();
          timer.scheduleAtFixedRate(
                  new TimerTask() {
                      int counting = 0;
                      @Override
                      public void run() {
                          counting++;
                          gui.getConnectedLabel().setText("DEBUG: " + counting);
                          for (String str : new ArrayList<String>(queue)) {
                              if (str == null) continue;
                              gui.getConnectedLabel().setText("sending: " + str);
                              
                                SocketSender.sendMessage(gui.getIP(), gui.getPort(), str);
                          queue.clear();
                          }
                      }
              
          }, 50, 50);
    }```
#
    private static Socket client = null;
    public static boolean initialize(String ip, int port) {
        try {
            client = new Socket(ip, port);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            GUIMC.instance.getConnectedLabel().setText("Failed to write.");

            System.out.println("[Error] Failed to create Writers.");
            return false;
        }
        return true;
    }
    public static boolean sendMessage(String ip, int port, String message) {  
     
        initialize(ip, port);
        try {
     DataOutputStream dOut = new DataOutputStream(client.getOutputStream());
         dOut.writeByte(1);
         dOut.writeUTF(message);
         dOut.flush();
         dOut.close();
        } catch (IOException e) {
            GUIMC.instance.getConnectedLabel().setText("Failed to connect.");
            System.out.println("[Error] Failed to connect to the remote Server.");
            return false;
        }
        return true;
    
 

    }```
#

Not neat

#

i was desperate

keen compass
#

ok and where is the problem?

#

it doesn't connect?

#

also what is counting for?

buoyant path
#

Frostalf

#

do i need these lines

#
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>```
#

something like that?

turbid musk
#

Anyone work with MongoDB..?

keen compass
#

you probably should add it in there @buoyant path as I recall maven picking up the source and target using those as opposed to the ones set in the compiler area.

#

I generally have both

buoyant path
#

why is mvn not a command in my terminal

keen compass
#

that means you don't have maven installed and instead are making use of the one that IJ provides

#

I have maven installed and tell NB to use the maven version I have installed as opposed to using one that it provides

buoyant path
#

Where can I install maven or is that even necessary

keen compass
#

shouldn't be necessary but its quite helpful sometimes in situations like yours because using the command line would eliminate if its IJ just not doing it or it really is a problem with maven

#

you will have to add the variables to the global path in windows though if you choose to install it since it doesn't have an installer

buoyant path
#

Yeah apparently IJ's build artifacts does so independently from maven

keen compass
#

anyways, I will be away for a bit of time. Will be back though.

raw basin
#

it does connect

#

but

#

when it send the message or data to the socket server

#

the timer stops working

buoyant path
#

Im just gonna try to add it as a jar file to my project structure

#

ill get it working with maven later

turbid musk
#

Anyone work with MongoDB..?

neat orbit
#

hey im making a spawn and i'd like to have a phantom spinning around a certain area. how do i make it turn into a "robot" kinda

#

like what plugin,

#

not actually turn it into a robot, but make it do what i tell it to and nothing else

keen compass
#

why are you using a timer for it @raw basin ?

#

if anything should be using a while loop

frigid ember
#

Need help on a hub

frigid ember
#

Hey just a quick one about IntelliJ & maven, can't seem to get libsdisguises to load up

#

On the maven tab, when I go to dependencies and click LisDisguises:LibsDisguises:9.5.1 their protocollib is underlined red (com.comphenix.protocol:ProtocolLib:4.4.0-SNAPSHOT)

#

Any ideas if I can do anything to fix this?

#

Is there a plugin that automatically starts an event ecery few hours and rewards the winner with stuff?

#

like say a fishing event

#

and person who catches most fish wins stufd

fleet crane
#

Yell @edgy sail

frigid ember
#

wat

tiny dagger
#

it wasnt for you

frigid ember
#

ow

#

ok

tiny dagger
#

look on spigot

#

you can use script to script your own event

frigid ember
#

@tiny dagger i dont know how to code much

#

Im a beginner

tiny dagger
#

it's script

#

it's a plugin

frigid ember
#

Link

#

Does it use json files or smth?

#

Just go look lazy jc lol

tiny dagger
#

look thru documentation

#

it's really easy

#

there is even a forum for this

frigid ember
#

Says its likely to have game breaking bugs

tiny dagger
#

ugh

#

why don't you take a search on spigot? ๐Ÿค”

#

you can even type on google to get a popularity sorted result

frigid ember
#

Can u help me make a script?

#

:p

neat orbit
#

how can i make a floating text that says "&e Notice"?

#

/summon ArmorStand ~ ~-2 ~ {Invisible:1b,Invulnerable:1b,NoGravity:1b,CustomName:"Harry's Shop",CustomNameVisible:1}

#

it does not work in 1.15.2

#

anybody know?

frigid ember
#

Can i create variables using skript

#

@tiny dagger

tiny dagger
#

yes

frigid ember
#

and if yes how
i dont see it

tiny dagger
#

i don't fully know, i was using it back when i had a server

#

it was neat

frigid ember
#

bruh

light lily
#

Maybe somthing like int?

tiny dagger
#

there was an entire documentation page on how to use it

frigid ember
#

that would be useful yes

#

But i need to find it on the documentation

#

And i dont know which section variables are under

#

Ye idk which section

tiny dagger
#

i see here something

#

variables last tab

pastel condor
#

when I use Inventory inv = Bukkit.createInventory(player, 36, "test"); it doesn't let players put items in their inventory though the gui works

tiny dagger
#

on join:
set {_player} to player
wait a minute
message "%{_player}%" # the local variable is unchanged no matter how many players joined in the meantime

frigid ember
#

OK so uh

#

I want it to on fish add a count to the player who fished up something

tiny dagger
#

there is a forum for skript people on spigot..

frigid ember
#

So i would need a local variable to have multiple of thar

#

Bur i also need a normal one to keep the highest one in

tiny dagger
#

i haven't used it in like 5 years

frigid ember
#

and call that after 12 hours

#

wheres the forum lol

#

link

tiny dagger
#

wait

#

ask here

#

people that actually use it atm

frigid ember
#

how do you make a tiny armor stand

#

i wanna make hypixels minions

#

as a plugin

#

how do you code suhh cb

#

armorstand.setSmall(true); gets me a nullpointe

#

i am using citizens api btw

#

i created an npc with type armor stand

lusty vortex
#

I think your armorstand is null then lol

#

That's not normal

frigid ember
#

then i cast getEntity to armorstand

#

no its not

#

i can do setHelmet

#

and it works

lusty vortex
#

Idk anything about citizens API ๐Ÿคทโ€โ™‚๏ธ

frigid ember
#

does setSmall make it tiny

#

like hypixwl

#

minions

lusty vortex
#

Why not just spawn a normal armorstand? Does citizens do something neat with it?

frigid ember
#

does setsmall make it tiny

lusty vortex
#

yes

frigid ember
#

ok

#

im making a minion

#

and make it move like an ai

#

nd build

lusty vortex
#

It's just a datawatcher value

frigid ember
#

@lusty vortex

#

I tried setSmall

#

i realized

#

i fixed it

#

but it is still not small

#

i got nullers before because i tried it before spawning it

#

here is my code

#

it is not small

#
NPC npc = CitizensAPI.getNPCRegistry().createNPC(EntityType.ARMOR_STAND, userName);
if (npc.isSpawned()) {
    ArmorStand armorStand = (ArmorStand) npc.getEntity();
    armorStand.setSmall(true);
    armorStand.setHelmet(new ItemStack(Material.GOLD_HELMET));
    p.sendMessage(ChatColor.GREEN + "Successfully spawned " + userName);
}```
#

it is not small

lusty vortex
#

Wtf? Citizen's scammed you

frigid ember
#

the helmet works

#

but its not small

tiny dagger
#

setsmall works tho

#

i used it quiet often too :p

frigid ember
#

well i used it now

#

didnt work

#

ยฏ_(ใƒ„)_/ยฏ

lusty vortex
#

Maybe a bug with the Citizen's plugin. They scammed you

frigid ember
#

im using quite a late version

lusty vortex
#

You should print the class that "npc" is

#

.getClass().getSimpleName(). Something like that

frigid ember
#

i am debugging

lusty vortex
#

Then cast it directly to that class and see if another function exists

frigid ember
#

isSmall()

#

to see if it actually sets

frigid ember
#

wha

#

update in what way

radiant hollow
#

Get the trait and use the setters...?

#

Most of citizens relies on traits.

frigid ember
#

thanks

#

ima test

#

yay it works

#

@radiant hollow thanks

radiant hollow
#

๐Ÿ‘

frigid ember
#

@tiny dagger

#

do you know math

#

like about radius'

#

and stuff

#

i have a more math question

tiny dagger
#

well ask

frigid ember
#

ok so I have an npc

#

it moves around

#

what I did is made it move around in a circle

#

like this

#

(sending a video)

#

..

#

that

#

It moves straight and backwards

#

I want it to turn the amount that is needed

#

by setting yaw, but I need to calculate how much to turn

stiff monolith
#

๐Ÿ˜„

cedar laurel
#

knows anyone this problem?

tiny dagger
#

oh so you want the head to follow the center?

cedar laurel
#

me?

tiny dagger
#

no

#

oh hmm

frigid ember
#

if you need

tiny dagger
#

well what do you do now vector?

frigid ember
#
 private Location getLoc(double angle) {
        double x = center.getX() + radius * Math.cos(angle);
        double z = center.getZ() + radius * Math.sin(angle);
        return new Location(center.getWorld(), x, center.getY(), z);
    }```
#

i want a new yaw

#

to make him look at

tiny dagger
#

use vector :p

frigid ember
#

private double radius;

private static final float SEPARATOR = 2;
private static final float RAD_PER_SEC = 1.5F;
private static final float RAD_PER_TICK = RAD_PER_SEC / 20F;
#

radius is set to 2

tiny dagger
#

vector has rotatearoundaxis

#

and

#

angle

frigid ember
#

Location loc = getLoc(RAD_PER_TICK * tick + SEPARATOR);

tiny dagger
#

but i can help you do it this way wait

frigid ember
#

ok

#

all i do is teleport the npc

#

so if you can help me with the rest

#

it would mean the a lot

tiny dagger
#

wait

#

but the angle is in radians right?

#

why don't you do yaw + Math.toDegree(angle)

#

at location

#

@frigid ember

#

set pitch at 0

frigid ember
#

ok

#

i dont touch the pitch

#

wait

#

thanks

#

ima test

tiny dagger
#

i don't fully know if you need yaw + tho

#

try without it too

frigid ember
#

@tiny dagger

#

not what I want

#

i want him to walk like ahuman

#

he looks where he turns

tiny dagger
#

try without yaw + then

#

i think tick does the job already

frigid ember
#

yay

#

it works

#

@tiny dagger another math question

#

xd

#

can u help me?

#

unrelated

cedar laurel
#

Can anyone help me xd?

tiny dagger
#

no i have to work at something

frigid ember
#

What I want to do, is get the yaw and pitch needed, to look at a player

#

i want to be able to calculate

#

the yaw and pitch needed to look at a given entity

#

like

tiny dagger
#

look at Bukkit's Vector

frigid ember
#

i didnt even learn vecotr math

#

bro

#

in math class

tiny dagger
#

getDirection more exactly

#

i said just look

#

and copy paste from there

#

vector is just a point from a going to b

#

where a in bukkit is a location

#

and b the vector

frigid ember
#

player.getEyeLocation().getDirection()

#

?

tiny dagger
#

yeah

#

open the source

#

look at that

frigid ember
#

of what

#

getDirection()?

tiny dagger
#

of Vector

#

yeah

#

Vector#getDirection()

#

sin cos tag xy for pitch

frigid ember
#

do i look like i learn those

#

LMAO

#

cosine

tiny dagger
#

but you can copy paste right?

#

or do i have to copy paste them for you

frigid ember
#

copy pasta for

#

me

tiny dagger
#

jeez

#

so what do you need?

frigid ember
#

pasta

tiny dagger
#

Location from, to

#

from.substract(to).toVector().normalize().getDirection();

frigid ember
#

i said i want pasta

tiny dagger
#

i don't have time

#

find someone else to bother :p

#

use that

#

you're fine

#

as a side note

#

get direction is already normalized

#

you can remove it i forgot

frigid ember
#

@tiny dagger

#

yo

#

this is what i want

#
public float getPitchToLookAt(Player p, Entity target) {

///code
}```
#

and same for yaw

#

ooh

#

go on your keyboard

#

and click inspect or something

#

there is some key on the top riught

#

that you clicked

#

causing this

#

np

#

insert*

#

yea

#

i meant

#

lmao

#

fr33styler

#

howd o i do what i need

tiny dagger
#

vectorp.angle(vectortarget)

#

is that ez

frigid ember
#

thisis wha ti have currently

#

Vector vec = pLoc.subtract(entityLoc).getDirection();

#

as u sent that

tiny dagger
#

that's not what you need tho

frigid ember
#

ok what

#

whyat is vectorp

tiny dagger
#

you need ploc.toVector()

frigid ember
#

ok

tiny dagger
#

same for entity

frigid ember
#

Vector vecP = pLoc.getDirection();

#

then

#
Vector vecP = pLoc.getDirection();
Vector vecEntity = entityLoc.getDirection();```
tiny dagger
#

no just no

frigid ember
#

ok

#

oh

#

k

#
Vector vecP = pLoc.toVector();
Vector vecEntity = entityLoc.toVector();```
#

then?

tiny dagger
#

stop asking me for every small change

frigid ember
#

vecP.angle()

tiny dagger
#

you'll never learn this way

frigid ember
#

what does that return

#

a float

#

but what is that

tiny dagger
#

an angle

frigid ember
#

i need to know the pitch too

#

for yaw and pitch

tiny dagger
#

just try that

#

first

frigid ember
#

        Vector vecP = pLoc.toVector();
        Vector vecEntity = entityLoc.toVector();

        float angle = vecP.angle(vecEntity);```
red bolt
#

could someone explain to me this method ?

tiny dagger
#

it repeats every 2.5 seconds

#

starting 1 second later

red bolt
#

so this basically runs every 30 minutes right ?

meager lantern
#

No, that will run after 30 minutes

red bolt
#

wrong screenshot

meager lantern
#

And then every 2.5 seconds afterwards

red bolt
meager lantern
#

Yes

red bolt
#

ok ty

#

is there a way to cancel the task ?

meager lantern
#

That will run immediately and then every minute

#

Oh wait sorry every 30 minutes

#

Didn't see the 30

#

Yeah that method returns a BukkitTask

#

Which has got a cancel method

red bolt
#

can i make a task within a task ?

#

and also, what is the method to make a task which provides a method that i can run code at the end of the task ?

#

if that makes sense :p

meager lantern
#

Yeah you just have to call the task method from within your task

#

I mean, you just have to manually call your code that you want to be run when you call the cancel method

#

Or if it's not a repeating task, then you can simply add your code at the end of the run method

remote socket
#
@EventHandler
    public void onPlace(BlockPlaceEvent e) {
        Block block = e.getBlockPlaced();
        Player player = e.getPlayer();
        if (block.getType().equals(Material.MOB_SPAWNER)) {
            for (int x=0; x<=16; x++) {
                for (int y=0; y<=256; y++) {
                    for (int z=0; z<=16; z++) {
                        Block blockInChunk = block.getWorld().getBlockAt(x, y, z);
                        if (blockInChunk.getType().equals(Material.MOB_SPAWNER)) {
                            CreatureSpawner placedSpawner = (CreatureSpawner) block;
                            CreatureSpawner chunkSpawner = (CreatureSpawner) blockInChunk;
                            if (placedSpawner.getSpawnedType().equals(chunkSpawner.getSpawnedType())) {
                                e.setCancelled(true);
                                sendMsg(player, "&cYou may not place more than one identical spawner in a chunk!");
                            }
                        }
                    }
                }
            }
        }
    }

My code currently just checks the first chunk, not the chunk in which the block is being placed in, how can I modify my code for it to operate as intended?

ocean hamlet
#

can anyone explain why dosent the rank "show up" in my tab list

#

I'm using luck perms and rank grant plus

limpid monolith
#

@remote socket use block.getChunk().getBlock(x, y, z) instead

#

also adjust your for loops

for (int x = 0; x < 16; x++) {
    for (int y = 0; y < 256; y++) {
        for (int z = 0; z < 16; z++) {
            // stuff
        }
    }
}
#

because rn, you're checking 17x257x17 blocks instead of 16x256x16

remote socket
#

oops

#
Block blockInChunk = block.getChunk().getBlock(x, y, z);
                        if (blockInChunk.getType().equals(Material.MOB_SPAWNER)) {
                            sendMsg(player, "There's a spawner already in this chunk!");
                            CreatureSpawner placedSpawner = (CreatureSpawner) block;
                            CreatureSpawner chunkSpawner = (CreatureSpawner) blockInChunk;
                            if (placedSpawner.getSpawnedType().equals(chunkSpawner.getSpawnedType())) {
                                e.setCancelled(true);
                                sendMsg(player, "&cYou may not place more than one identical spawner in a chunk!");
                            }
                        }
#

This is sending the There's a spawner already in this chunk! message despite there not being

limpid monolith
#

did you check if there is a vanilla spawner below ground?

remote socket
limpid monolith
#

you can't directly cast the Block to a CreatureSpawner

#

you need to cast Block#getState

#

so in your case

CreatureSpawner placedSpawner = (CreatureSpawner) block.getState();
CreatureSpawner chunkSpawner = (CreatureSpawner) blockInChunk.getState();
remote socket
limpid monolith
#

probably the spawner you placed

remote socket
#

how can i exclude the spawner that is being placed? Get the location of the placed block and block in the chunk and check if they are the same?

limpid monolith
#

you can get a blocks chunk offset coordinates by using the % operator

#

~~```
xOffset = block.getX() % 16;
zOffset = block.getZ() % 16;

#

and then when x == xOffset && y == block.getY() && z == zOffset you can just use continue;

#

actually

#

use bit masking, because this doesn't work properly for negative coordinates

remote socket
#

cant u just do when block.location().equals(chunkblock.location())

limpid monolith
#

yeah, that works

#

I just like to do things more complicated apparently lol

remote socket
#

hehe

stiff monolith
#

?

#

hehe?

frigid ember
#

Hello I am looking for a plugin allowing to put a cooldown enderpearl or another item in a selected region

fickle mountain
#

Who knows a levels progression plugin like PvPLevels?

pale plaza
#

Google????

#

@frigid ember

frigid ember
#

I do not find

green hornet
#

with the crafting events is it possible to change the outcome without using recipes? like say i put two items in my inventory crafting window and want a outcome based on the nbt tags teh first two items have (regardless of if they are a normal recipe)

frigid ember
#

Anybody remember the name of that plugin that lets you spell out your username in particles above your head? No worries if not, can't find it anywhere on Google!

velvet marten
#

Shouldn't upgrading from Java 8 (server) to Java 11 be compatible with all plugins supporting Java 8 ?

hoary parcel
#

99% will work, yes

#

but there is always that one stupid plugin that tries to access a private final field or some bullshit

#

oh right, final only broke with java 13 I think

velvet marten
#

As it happens it is two plugins in my current setup ๐Ÿ˜„ Will try to contact the owners instead. ๐Ÿ™‚ Thanks

paper compass
#

Would a long function/method cause the server to lag? (BlockBreakEvent)

subtle blade
#

Potentially. Depends on what you're doing

paper compass
#

its over 500 lines

wide gate
#

Plugins can also break if they are using javafx, most notabily javafx's Pair class.

subtle blade
#

Well that's just developer stupidity ;P

vernal spruce
#

Quick question boys wich one should i go for to make a interruptable timer,should i cancel a runnable and start it again with the new time or.. create my own timer wich gets updated with a 1sec runnable(x++)

subtle blade
#

?paste the method, OhSry. I'm sure it can be improved

worldly heathBOT
subtle blade
#

Because that event is obviously called every time a block is broken

paper compass
floral raptor
#

hi ๐Ÿ˜„

#

better here xd

subtle blade
#

Oh dear, yea, she's a lengthy one

paper compass
#

Its for custom enchants

subtle blade
#

Though a lot of it can be simplified I'm sure

floral raptor
vernal spruce
#

Checking if block material ends with _ORE then use that to give player the material for once...

subtle blade
#

No. You'd be better off mapping

#

EnumMap Material to IS

#

I'll take a run through it and give you a list of changes you can make to simplify a lot of that

vernal spruce
#

Yeah might be better

paper compass
#

@subtle blade should I do a for loop for the items enchants then do a switch case:
for(Map.Entry<Enchantment, Integer> enchants : item.getEnchantments()) {
switch(enchants.getKey()) {
case(new Oblivion):
//code
break;
}
}

#

Or would that cause more lag

subtle blade
#

1 sec ;P I'll write it down

paper compass
#

kk

floral raptor
#

someone know if its possible to translate this message? and where is allocated? thanks!
@floral raptor pls tag me if some one knows how to do

paper compass
#

What plugin are you using?

floral raptor
#

is a server of mods

paper compass
#

ah

floral raptor
#

this is the message

paper compass
#

Whats the mod called

floral raptor
#

pixelmon

paper compass
#

Any config files?

floral raptor
#

that message is not in the config files

#

so i dont know where came

#

i think its from forge.jar

vernal spruce
#

its the mod warning about forge missing

#

its pretty self explanatory

floral raptor
#

yes but i want to translate

#

because players dont speak english

#

and dont know what is that

vernal spruce
#

its the mod warning usually there is no config about it

#

i also don't add translation in my code warnings

floral raptor
#

and any messagefilter plugin

#

can be useful ?

#

for bungeecord or spigot?

vernal spruce
#

it may do the job

floral raptor
#

okey

vernal spruce
#

best? restarting a runnable with a new timer,or make own timer using a 1 sec runnable?

final verge
#

Also plugins donโ€™t work on forge lol

vernal spruce
#

we need a csgo system

#

where we can download a servers required mods on a click ๐Ÿ˜‚

zenith siren
#

How do I modify the attack speed for items?

subtle blade
#

Here's all that I caught

#

There were some other minor things I didn't really bother mentioning but those were the biggest things that may impact performance and/or readability

vernal spruce
#

@zenith siren you mean the cooldown?

zenith siren
#

Yea

vernal spruce
#

your gonna have to work with attributes in itemmeta

#

or if its easyer for you with nbt

paper compass
#

@subtle blade What do you mean by All this enchantment logic should be handled in the enchantment classes themselves.

dusty topaz
#

Is it necessary to call .toLowerCase() on PermissionAttachmentInfo#getPermission()

subtle blade
#

Your enchantment classes should define a method. Say, onBreakBlock. That method can take any information it needs. The ItemStack, the Block it broke, whatever. Put all your block breaking logic into there. On enable, you should register just a single instance of your enchantments into some Map or something where you can uniquely identify and retrieve them. When you want to call the logic, grab them from that registry, call the onBreakBlock() and boom. Magic!

paper compass
#

How do I create a new Thread again? I forgot

silk bane
#

new Thread()

sturdy oar
#

b r u h

subtle blade
#

lol

paper compass
#

But how do I put something inside?

vernal spruce
#

lmao

sturdy oar
#

learn java

subtle blade
#

You would want to work with the scheduler

vernal spruce
#

he caught it

paper compass
#

ffs

subtle blade
#

Bukkit.getScheduler() or BukkitRunnable

#

Each have runTaskAsync() methods

paper compass
#

Thanks choco, I forgot about that.

sturdy oar
#

my preferred way is using a lambda tbh

paper compass
#

cool

#

woah

#

@subtle blade dms

hoary parcel
#

dont dm ppl, just ask here

whole sigil
#

Hey guys i was wondering if u knew a plugin to disable player volunteer disconnect in a pvp fight in warzone ?

silk bane
#

can't stop people disconnecting but you can punish them for disconnecting

whole sigil
#

Yeah a punish would be great

silk bane
#

they're usually called combat logging or combat tagging plugins

#

there are loads

whole sigil
#

Ho i was missing the keyword

#

thx ill go back on my search

sturdy oar
#

the one I used for a long time , I haven't used recently it because now I have my own, but it should still be great.

whole sigil
#

I think ill go with this one

hidden glade
#

Hey guys got any idea how to cover a string from config as world

dusty topaz
#

Bukkit.getWorld(string);

hidden glade
#

No actually

#

Location loc = new Location (cs.getString("world")....)

#

So it expects World there

#

But provided is a string

#

Is there anyway i make it read the string text as world but not a actual string

dusty topaz
#

Bukkit.getWorld(cs.getString("world")) ?

hidden glade
#

OwO idk i tried this method or no

#

I tried most of em

#

Anyway TY

#

Ill try this one out hope it helps

subtle blade
#

Can return null (if the world doesn't exist). Check this first

hidden glade
#

Yes it was a warp plugin i was working on and ive done those checks i just wanted a way to covert that string to world cuz Location expects actual world ๐Ÿคท

green hornet
#

seems when you do a custom item nbt based recipe using the PrepareItemCraftEvent - the source stack increments in size when over stack size of 1?

paper compass
#

Would anyone here suggest pebblehost?

#

premium 12gb

hidden glade
#

Yes in my opinion pebblehost is better choice

green hornet
#

anyone have an example of 1.14 ItemCraftEvent?

wind dock
#

hey guys

#

on my scoreboard plugin

#

%player_name% doesnt work

#

what else do i use?

paper compass
#

install placeholderapi and do /papi ecloud download player

sturdy oar
#

would not recommend PebbleHost to be honest

#

they had their MySQL Database crash three times in a few months, not to mention downtimes

paper compass
#

Our old host (Shockbyte) went down about 3 times a day

sturdy oar
#

that's why you get a dedicated server

green hornet
#

soyoustart is pretty cheap metal boxes

#

not seen any downtime on 4 years or so

sturdy oar
#

Yeah I think they resell OVH after all

green hornet
#

yeah kimsufi

#

im asking but not seen any responses yet

#

not like it was on irc anyway

#

maybe there should be a seperate api channel

inland meteor
#

yes darth

#

We talk about code in here quite actively ๐Ÿ™‚

turbid musk
#

Anyone here work with MongoDB?

obtuse rose
#

@paper compass Get a dedicated server or VPS and install Pterodactyl ๐Ÿ‘

sacred wave
#

Hi, I have a (hopefully) quick question... I am creating plugin that will count score based on time. As a time source I chose server ticks as I thought would be cleanest solution (Yea, I could use System.currentTimeMillis()). Now the funny part, I thought that World.getFullTime is the thing I wanted - time since first server start. But when I call /time set 1000 in-game, both World.getTime and World.getFullTime are set to 1000. In game, I can run /time query gametime, which seems to be the thing I need. Am I doing something wrong? Or how do I obtain the "gametime" from code? Thank you for any help!

sturdy oar
#

meh VPS usually aren't meant to host game-servers

green hornet
#

seems getTime is used for /time query gametime @sacred wave

sacred wave
#

@green hornet Thanks for answer, unfortunately simple outputting getTime & getFulltime returns numbers described in previous posts... :/

green hornet
#

youd expect time query gametime to return the same

#

getWorld().getTime() % 2147483647L

little crater
#

getFullTime returns the time in the current day. getTime returns the full time % 24000. There is no API that exposes the actual time you are after

green hornet
#

minecraft server has currentTick btw

sacred wave
#

@little crater @green hornet So the correct solution is indeed to use currentTimeMillis()...

little crater
#

if you're going to use nms to get that, might as well use nms to get the time you want ((CraftWorld)world).getHandle().worldData.getTime()

green hornet
#

i think you are wanting to just store the timestamp on plugin start right?

#

I thought that World.getFullTime is the thing I wanted - time since first server start

#

and you are asking if that exists?

sacred wave
#

@green hornet I am storing time since the game I am scoring started, so I can measure score and determine if that is time to end the game... Also I am storing the time on disk, so it will work correctly after server restart...

#

@little crater I will try that, thank you!

dusty topaz
#

Poor Billy Henderson

green hornet
#

hmm seems CraftItemEvent only fires on normal recipes ๐Ÿค”

dusty topaz
#

If you've registered a custom recipe it should surely fire too

#

Called when the recipe of an Item is completed inside a crafting matrix

green hornet
#

my recipe is based on nbt tags of the itemstacks

#

so i dont think i can use recipes for that? would be nice if so

#

so this is never firing to correct the source stacks item amount

sacred wave
#

@little crater That was exactly what I was looking for, thank you once again!

dapper spade
#

Hello, I am not very good at English, t K I am not a native owner of this language - not the point. When it will be possible to send software packages (plugin messages) during the PlayerJoinEvent event and not to put a delay, at the moment I just use my channel on netty

green hornet
#

i think RecipeChoice.ExactChoice will solve my problem, thanks all

inland meteor
#

So i'm using this when someone tries to join and is banned, however instead of displaying the message, it just displays "Failed to connect to server", any idea why?

BaseComponent[] message = TextComponent.fromLegacyText(String.join("\n", convertedBanLines));
e.setCancelReason(message);
e.setCancelled(true);
hoary parcel
#

isnt it setKickMessage?

#

or is that bungee?

wanton delta
#

Yea

#

SetCancelledReason is different

hoary parcel
#

well, I dont use bungee ๐Ÿคท

#

check client log, maybe that will tell you something

inland meteor
#

it's bungee sorry mbmb

wanton delta
#

Oh

#

I misunderstood

#

What u said lol

inland meteor
#

Probably should've explained a lil more

#

using bungee version 1.15-SNAPSHOT and using "LoginEvent"

green hornet
#

hmm is there a limit to the number of recipes?

vernal spruce
#

Me an intelectual spending 15min to figure out getting minutes out of a int

#

private int[] getMinutes(Integer time) {
int remTime = time;
int minutes = 0;
while(remTime>=60) {
remTime-=60;
minutes++;
}
return new int[] {minutes,remTime};
}

hoary parcel
#

well, there is a max packet size

#

and you reached it

green hornet
#

hmm so i cant use CraftItemEvent and i cant use recipes ๐Ÿค”

vernal spruce
#

why you cant use recipes?

green hornet
#

craftitemevent doesnt fire unless its in the recipe list

vernal spruce
#

i mean create one yourself?

sacred wave
#

@vernal spruce I am using following: leadingZero(time / 60) + ":" + leadingZero(time % 60)

green hornet
#

i did, and it gave me that error

vernal spruce
#

@sacred wave im getting 2 ints to check if seconds = 0

#

so i dont have 5 minutes and 0 seconds,more like only 5 minutes

#

show code on how you did the recipe

green hornet
#

i have about 14000 recipes so it seems to be exceeding the packet limit

vernal spruce
#

?paste

worldly heathBOT
sacred wave
#

@vernal spruce time / 60 will return only five minutes, no decimals, since this is integer division...

ashen stirrup
#

I'm trying to check if a Blaze is in water
e.getEntity().getLocation().subtract(0.0, 0.5, 0.0).getBlock().getType().equals(Material.WATER)
This doesn't work, how would I do it

vernal spruce
#

isnt there a method to check if a entity is wet?

green hornet
#

try check the breathing code in spigot source

vernal spruce
#

nvm

sacred wave
#

@vernal spruce @ashen stirrup I guess Blaze.isSwimming is what you are after

vernal spruce
#

try using this for checking the water

green hornet
#

not sure if thats it?

ashen stirrup
#

I guess Blaze.isSwimming is what you are after
Cheers, I'll try it

sacred wave
#

@ashen stirrup but I am not sure whether this will return true for lava or not

#

it probably will though

ashen stirrup
#

I need a 1.8 method

sacred wave
#

@ashen stirrup oh, I see. Another method might be (not sure if it was in game like this in 1.8) wait for entity damage event, since Blazes are damaged in water (at least in 1.15)

vernal spruce
#

They always were

sacred wave
#

not sure what the DamageCause will be, whether suffocation, contact or something else...

subtle blade
#

It might just be GENERIC. I don't see where in NMS blazes take damage from water

#

I know they do, I just don't know where to look to confirm

silk bane
#

probably something dumb like drowning damage

sacred wave
#

yup it is Drowning, just tried ๐Ÿ™‚

silk bane
#

damn you mojang

zenith siren
#

How do I give the tablist multiple columns? Do I need to do it via a packet?

sacred wave
#

@silk bane @subtle blade Isn't that possible that Blazes are implemented that they don't have any bubbles (don't know the api name)? Hence the DROWNING damage...

ashen stirrup
#

What would the DamageCause be? They don't drown do they?

silk bane
#

they take damage in rain

#

which doesn't affect your air

#

mojang just decided to make it drowning

ashen stirrup
#

So it's drowning?

silk bane
#

apparently.

sacred wave
#

@silk bane true, will try what does rain damage returns...

unreal hedge
#

So in my minigame framework, I'm making a generic sorted stats value, for instance kills in a particular arena, deaths in a particular arena etc. I decided to create a class, StatKey for this

public final class StatKey {
    @Getter private final String key;
    @Getter private final String stat;

    public StatKey(final String key, final String stat){
        this.key = key;
        this.stat = stat;
    }

    @Override
    public String toString(){ return key + "." + stat; }
}```

And I've created two Maps (one for global stats, the other for sorted stats)
```java
    private Map<String, Integer> stats = new HashMap<>();
    //StatKey = key, stat, value for instance a particular arena, "kills" being the stat and the value.
    private Map<StatKey, Integer> sortedStats = new HashMap<>();```
I just feel like there's a neater, more readable way to approach this. Any suggestions? (Note that for Stats, I can't use an enum as this is a framework, meaning more type of stats will be added depending on the minigames using this framework).
subtle blade
#

Not sure Mojang has any reason to make it its own damage reason

#

It would have no use

sacred wave
#

@ashen stirrup at least that's what I got...

ashen stirrup
#

Alright

#

I'll give it a try

subtle blade
#

Still curious where the actual call to damage is

#

Couldnโ€™t find it after a quick browse

sacred wave
#

@ashen stirrup imho you can even prevent this damage this way, as EntityDamageEvent is Cancelable

silk bane
#

@unreal hedge just use Map<String, Integer> or maybe Map<StatType, Integer>, where StatType is an enum

unreal hedge
#

I'm not going to make an enum for every possible combination of stat types lol

#

It could be kills, using a particular item or ability

subtle blade
#

Woo! EnumMap!

unreal hedge
#

The reason why they exist, is for challenges.

silk bane
#

use string then

subtle blade
#

Gross

silk bane
#

yeah

boreal tiger
#

yuck

unreal hedge
#

๐Ÿ™„ it's either I use Strings in the framework, or recreate this system every time per minigame with enums for every possible combination, yeh I'll stick with ma strings xD

sacred wave
#

@subtle blade @ashen stirrup Unfortunately it is still DROWNING for rain...

silk bane
#

lol

#

told you, mojang just did it

ashen stirrup
#

I need to check if they're taking damage from water

#

e.g grinders

subtle blade
#

If raining and exposed to the sky, itโ€™s likely rain damage. Else itโ€™s water damage

fleet burrow
silk bane
#

yes.

fleet burrow
subtle blade
#

Oh my god please do

fleet burrow
#

feels like I should use a tree

subtle blade
#

Or just a proper object lol

silk bane
#

feels like you should figure out what you want to do with that data rather than just trying to store it all as it appears

fleet burrow
#

well

#

im stupiud

#

bye

#

time for bed

#

I forgot I made an object for this lol

unreal hedge
#

Multimaps: "Am I a joke to you?"

warped shuttle
#

Thatโ€™s too easy

#

๐Ÿ˜†

turbid musk
#

Anyone here work with MongoDB?

boreal tiger
#

Just ask your question

neat turret
#

Im trying to use ViaVersion and it still only lets 12.2

#

oh nevermind its just something with 1.8

fleet burrow
#

When I call ConfigurationSection#getValues if the value in config is an integer what would be it's type in the map?

subtle blade
#

getValues() returns a Map of keys to values

#

If it's an int, its type will be Integer

fleet burrow
#

๐Ÿ‘Œ Thanks

hoary mountain
#

My server is based on 1.7 with 1.8 support and when 1.8 player joins my 1.7 players are getting kicked for [Proxy] Lost connection to the server. Btw they get kicked only if the 1.8 player is in their view distance. Using Flame Cord btw. And no errors at console.

vernal spruce
#

Not sure if anybody even bothers giving support to 1.7.. its bit too oudated

hoary mountain
#

That sucks, i know a bunch of servers that fixed this just dunno how, maybe i should try viaversion or something else.

fair abyss
#

How can enum be null in runtime can someone tell me?

hoary parcel
#

ChatColor test = null;

fair abyss
#

then tell me

#

can ChatColor.GREEN can be null?

hoary parcel
#

no

fair abyss
#
        Bukkit.getLogger().info("Ahron " + Champion.AHRON);
    }```
#

this returns null

tiny dagger
#

well

subtle blade
#

Not possible

hoary parcel
#

you see "Ahron null" in console?

fair abyss
#

[20:43:35 INFO]: Ahron null
fresh copied from console

hoary parcel
#

show the champion class

tiny dagger
#

is AHRON an enum or a public field? ๐Ÿค”

fair abyss
#

!paste

hoary parcel
#

most likely you have a toString method

subtle blade
#

?paste

worldly heathBOT
subtle blade
#

HJNFahbsdlfa

hoary parcel
#

ninja'd!

fair abyss
subtle blade
#

Don't know what you're talking about, Mini

#

You're constructing that listener within the enum itself

#

It's null at that point

fair abyss
#

...

#

right..

#

๐Ÿคฆ

#

๐Ÿคฎ

tiny dagger
#

lol

hoary parcel
#

interesting, I would expect a not initialized error instead

fair abyss
#

Me too

subtle blade
#

Suppose you could instead pass a Function<Champion, Listener> to construct the listener and build it in the enum's constructor while passing an instance of the enum itself

#

Though really, I think this is a flawed design

pastel condor
#

for some reason if players click a grass block in slot eleven of their inventory, it does the same thing as when a player opens my gui and clicks the 11th slot. Is there anyway I can make it so players can't put a grass block in their inventory and trigger the same thing that the gui triggers?

hoary parcel
#

I would design it like this:
add a Class to the enum instead of the actual listener
have some method somewhere that iterates over Champions.values, gets the listener class, initializes it and registers the event handler

subtle blade
#

Check if the slot number is between 0 and 35. If so, ignore it

silk bane
#

i don't understand why it's null tho

subtle blade
#

Actually, slot numbers might be different

fair abyss
#

simply removed Listeners from enum.
really thanks for tip.

hoary parcel
#

its not constructed yet konsolas

silk bane
#

oh wait its the listener

#

aight cool

pastel condor
#

but I need the block in a higher slot, as my inventory is only 36 slots big

radiant pollen
#

@pastel condor There are a few things you could do. In your GUI code, check that the inventory isn't a player's inventory. Or you could check that the inventory is a specific inventory.

pastel condor
#

It is the players inventory

subtle blade
#

Yea, clicked inventory instanceof PlayerInventory would work fine

radiant pollen
#

^

pastel condor
#

because I don't know what else to use

radiant pollen
#

Wait what?

#

Your GUI menu is the player's inventory?

pastel condor
#

kinda

radiant pollen
#

It can't be kinda

pastel condor
#

Inventory inv = Bukkit.createInventory(player, 36, "Help");

#

so yeah

radiant pollen
#

Change player to null and just use that

#

Then in your GUI code check that the clicked inventory is not an instanceof PlayerInventory

pastel condor
#

oh okay

#

what if I want multiple guis though?

silk bane
#
enum Test {
  TEST(Test.TEST); 
  private final Test test;
  Test(Test test) {
    this.test = test;
  }

  public Test getTest() {
    return test;
  }
}
subtle blade
#

That's a lot of test

radiant pollen
#

Then you'll need to make each of your GUIs implement InventoryHolder and check that the clicked inventory is an instance of that specific GUI. @pastel condor

subtle blade
#

Should theoretically be null though

silk bane
#

til java lets you access enum constants before initialisation

#

exciting

subtle blade
boreal tiger
#

Lmao

subtle blade
#

Very much NOT exciting

dusky herald
#

wat

pastel condor
#

like this? GUI gui = new GUI(); Inventory inv = Bukkit.createInventory(gui, 36, "Help"); then ```public class GUI implements Listener, InventoryHolder {
@EventHandler
public void gui (InventoryClickEvent event) {
SlimePlugin SPlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
SlimeLoader loader = SPlugin.getLoader("file");
final Player player = (Player) event.getWhoClicked();
if (event.getInventory().getHolder() != this) return;
//event.setCancelled(true);
final ItemStack clickedItem = event.getCurrentItem();

    // verify current item is not null
    if (clickedItem == null || clickedItem.getType() == Material.AIR) return;
    final Player p = (Player) event.getWhoClicked();
    // Using slots click is a best option for your inventory click's
    p.sendMessage("You clicked at slot " + event.getRawSlot());
    if (event.getRawSlot() == 11) {
        try {
            if (loader.worldExists(player.getUniqueId().toString())) {
                player.performCommand("fbt tp");
            } else {
                player.performCommand("fbt cw");
            }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        
    }
    
    //more slots

}

@Override
public Inventory getInventory() {
    // TODO Auto-generated method stub
    return null;
}

}

dusky herald
#

is that a joke

pastel condor
#

what?

dusky herald
#

how would you do TEST.test

#

if theres no object initialized

#

lol

#

I heard you like enums, so here's an enum referencing itself in an enum

#

TEST.test.getTest().getTest().getTest().getTest().getTest()...repeat forever

radiant pollen
#

@pastel condor I'm not sure but... I think it should be if (!event.getInventory().getHolder() instanceof GUI) return; instead of != this

silk bane
#
enum Bhoolean {
  TRUE(Bhoolean.FALSE),
  FALSE(Bhoolean.TRUE);

  private final Bhoolean negation;

  Bhoolean(Bhoolean negation) {
    this.negation = negation;
  }

  public Bhoolean getNegation() {
    return negation;
  }
}
dusty topaz
#

yikes

silk bane
#

i'm betting that FALSE.getNegation() will be true but TRUE.getNegation() will be null

pastel condor
#

thanks

#

but shouldn't it be if it's not an instance?

dusky herald
#

Good job making booleans work inversely.

pastel condor
#

it returns @radiant pollen

dusky herald
#

wait

#

tf

#

lol

radiant pollen
#

Yeah that's what I did right?

dusky herald
#

Sure

pastel condor
#

if (!event.getInventory().getHolder() instanceof GUI) return;

dusky herald
#

just stop

pastel condor
#

you did that

dusky herald
#

you're driving me crazy

pastel condor
#

shouldn't it be if (!event.getInventory().getHolder() !instanceof GUI) return;

#

oh

#

I see

#

nm

silk bane
#

what the

pastel condor
#

I didn't see the ! at the start

dusty topaz
#

it should be (!(instanceof here))

pastel condor
#

too many brackets

silk bane
#

honestly !null should be true

pastel condor
#

...

silk bane
#

then Bhooleans would work as trits

radiant pollen
#

Oh yeah, Avro is right lol

pastel condor
#

it's spelled booleans

#

xD

silk bane
#

no it's a Bhoolean

dusky herald
#

should call it Bfooleans

pastel condor
#

.

radiant pollen
#

He's talking about something completely different @pastel condor

pastel condor
#

oh xD

radiant pollen
#

Ignore it. He wasn't talking to you lol

#

What avro said was right

pastel condor
#

yeah

boreal tiger
#

Bhoolean

dusky herald
#
    ONE(Integereger.ONE);
    private Integereger integereger;

    Integereger(Integereger integereger) {
      this.integereger = integereger;
    }

    public Integereger getIntegereger()  {
      return integereger;
    }
}```

am doin it rite?
radiant pollen
#

could you stop

#

this is dumb

silk bane
#

what a language

#

we should all switch to ocaml

pastel condor
#

Now I can steal items from my gui though

warped shuttle
#

h i l a r i o u s

pastel condor
#

how do I stop that?

warped shuttle
#

Cancel the click event?

pastel condor
#

ah

#

it works

#

thanks!

fluid bloom
#

event.setCancelled(true) is a godsend

pastel condor
#

but if I shift click the dirt block it still lets me steal

fluid bloom
#

are you cancelling every click on any item?

pastel condor
#

yeah

fluid bloom
#

it lets you shift click it out of the gui or into the gui

pastel condor
#

out

fluid bloom
#

wait im confused by my own question

#

you can put stuff in the gui?

#

or take stuff out

pastel condor
#

take stuff out

fluid bloom
#

oh

pastel condor
#

though the blocks are very glitchy

#

that you take out

fluid bloom
#

can i see your code?

pastel condor
#

sure

#

import java.io.IOException;

import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;

import com.grinderwolf.swm.api.SlimePlugin;
import com.grinderwolf.swm.api.loaders.SlimeLoader;

public class GUI implements Listener, InventoryHolder {
    @EventHandler
    public void gui (InventoryClickEvent event) {
        SlimePlugin SPlugin = (SlimePlugin) Bukkit.getPluginManager().getPlugin("SlimeWorldManager");
        SlimeLoader loader = SPlugin.getLoader("file");
        final Player player = (Player) event.getWhoClicked();
        if (!(event.getInventory().getHolder() instanceof GUI)) return;
        
        event.setCancelled(true);

        final ItemStack clickedItem = event.getCurrentItem();

        // verify current item is not null
        if (clickedItem == null || clickedItem.getType() == Material.AIR) return;

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

        if (event.getRawSlot() == 11) {
            try {
                if (loader.worldExists(player.getUniqueId().toString())) {
                    player.performCommand("fbt tp");
                } else {
                    player.performCommand("fbt cw");
                }
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            
        }
        
        //more slots
        
        
        
}

    @Override
    public Inventory getInventory() {
        // TODO Auto-generated method stub
        return null;
    }
}    
dusky herald
#

isnt shift clicking

#

an InventoryMoveItemEvent

pastel condor
#

idk

dusky herald
#

so you should have to cancel that out too

pastel condor
#

oh okay

#

thanks

fluid bloom
#

why did you override #getInventory() ?

pastel condor
#

inventory drag event?

#

oh

dusky herald
#
extends Event
implements Cancellable
Called when some entity or block (e.g. hopper) tries to move items directly from one inventory to another.
When this event is called, the initiator may already have removed the item from the source inventory and is ready to move it into the destination inventory.

If this event is cancelled, the items will be returned to the source inventory, if needed.

If this event is not cancelled, the initiator will try to put the ItemStack into the destination inventory. If this is not possible and the ItemStack has not been modified, the source inventory slot will be restored to its former state. Otherwise any additional items will be discarded.```
dusty topaz
#

@fluid bloom he implements inventory holder

fluid bloom
#

oh

dusty topaz
#

which is an interface with that method

pastel condor
#

oh thanks

dusky herald
#

works?

pastel condor
#

but how do I make it so it's not always running on all inventories

#

event.getInventory() dosen't work

tiny dagger
#

guys, inventoryholder shouldn't be implemented....

dusky herald
#

you can add a boolean to verify if the player opened a GUI Inventory

pastel condor
#

eclipse told me to implement it

dusky herald
#

under a custom PlayerData class for example

#

if you have one

pastel condor
#

would this work? public void preventShiftgui (InventoryMoveItemEvent event) { if (!(((HumanEntity) event).getInventory().getHolder() instanceof GUI)) return; event.setCancelled(true); }

dusky herald
#

There is no getInventory() function

pastel condor
#

casting event to HumanEntity

dusky herald
#

not that I see anyways

#

ah nvm I get you

#

well

pastel condor
#

but I need to check if they grabbed the item from my gui or from a chest

#

I shouldn't cancel everthing

dusky herald
#

There is no getHolder() either

#

but

pastel condor
#

yeah

dusky herald
#

there is a getSource()