#help-development

1 messages · Page 2019 of 1

lime jolt
#

like there username

dawn hazel
#
HashMap<UUID, Long> cooldown = new HashMap<>();
if(cooldown.containsKey(sender.getName())) {
    int cooldownTime = 30;
        long timeLeft = (cooldown.get(p.getUniqueId()) + cooldownTime) - System.currentTimeMillis();
        if(timeLeft>0) {
            sender.sendMessage(ChatColor.RED + "Your on cooldown for " + timeLeft + " seconds!");
            return true;
        }
}

cooldown.remove(p.getUniqueId());
cooldown.put(p.getUniqueId(), System.currentTimeMillis());
``` made the code more readable but im still having the same issue
#

wdym

#

in what case

lime jolt
#

like if you type

#

/hello

#

it says hello (username) petar

#

like

#

hello Skygamez

#

is there a way to get the players username

dawn hazel
#

sender.sendmessage("Hello " + sender.getName);

lime jolt
#

aright thanks

#

is there a way to only allow some to tpye the comand once

dawn hazel
lime jolt
#

yes

#

like lets say u can only type it

#

once

#

and then have to wait until someone else types

young knoll
#

Put the latest executor uuid into a variable

lime jolt
#

no clue how

#

like this is what I got so far

#

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

public class HelloCommand implements CommandExecutor{
    
    static int playerCount = 0;

    public HelloCommand(Main plugin) {
        plugin.getCommand("hello").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(!(sender instanceof Player)) {
            sender.sendMessage("Only players may execute this command!");
            return true;
        }
        
        Player p = (Player) sender;
        
        playerCount++;

            p.sendMessage("Hi!");
            Bukkit.broadcastMessage(sender.getName() + " has joined sumo | Player Count: " + playerCount +"/2");
            
            

        
        return true;
    }
    ```
#

and I dont want someone to be able to join more than once

#

but currently they can

dawn hazel
#
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
    if (sender.getName() != "petarpotato") {
        sender.sendMessage("You are not allowed to run this command!");
        return true;
    }

    someLogicHere();
    return true;
}```
lime jolt
#

but then they cant type it the first time around

dawn hazel
#

what do you mean

lime jolt
#

and its specific to petarpotato

#

let me refraze

young knoll
#

When player runs command, set variable to player uuid

lime jolt
#

I only want it to allow you to do the command once

lime jolt
young knoll
#

Also, when player runs command check that the last uuid is either null or not their uuid

#

Cast sender to player (after checking) and use getUniqueID

lime jolt
#

umm, how would I cast a sender to player and then getUniqueId

#

sry I am really new to developing on minecraft

#

new question that will solve all old questions

#

how do I store the players name

#

can I just make an array of strings

#

and store name in it?

young knoll
#

Sure

lime jolt
#

aright

young knoll
#

But I would use uuid

#

And also a hashset for fast .contains

lime jolt
#

for now, I think that might be to advanced, I have no idea what that stuff is, but still thanks though for explaining thought process

pearl ibex
#

is there any way to make a item stored in an itemstack wearable?

fossil lily
#

How can I grab the player who dropped the item?

#

With this method

dawn hazel
#

PlayerPickupItemEvent is deprecated i think

fossil lily
dawn hazel
#

hmm

lime jolt
#

guys does anyone know how I would make multiple comands in one plugin

#

this is what I got so far

#

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;

public class HelloCommand implements CommandExecutor{
    
    static int playerCount = 0;
    static ArrayList<String> array = new ArrayList<String>();

    public HelloCommand(Main plugin) {
        plugin.getCommand("hello").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(!(sender instanceof Player)) {
            sender.sendMessage("Only players may execute this command!");
            return true;
        }
        
        boolean canUJoin = true;
        
        for(int i = 0; i < array.size(); i++) {
            
            if(array.get(i).equals(sender.getName())) {
                canUJoin = false;
            }
            
        }
        
        if(canUJoin) {
        Player p = (Player) sender;
        
        playerCount++;

            Bukkit.broadcastMessage(sender.getName() + " has joined sumo | Player Count: " + playerCount +"/2");
            
        array.add(sender.getName());
        }

        
        return true;
    }
    
}```
#

and it happens when you type hello

dawn hazel
#

put the onCommand in a separate class

lime jolt
#

but if you type like "hi" it would do something els

#

e

lime jolt
#

i understand how to make a diffrent class and all

dawn hazel
#

public class CommandClass implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(!(sender instanceof Player)) {
            sender.sendMessage("Only players may execute this command!");
            return true;
        }
        
        boolean canUJoin = true;
        
        for(int i = 0; i < array.size(); i++) {
            
            if(array.get(i).equals(sender.getName())) {
                canUJoin = false;
            }
            
        }
        
        if(canUJoin) {
        Player p = (Player) sender;
        
        playerCount++;

            Bukkit.broadcastMessage(sender.getName() + " has joined sumo | Player Count: " + playerCount +"/2");
            
        array.add(sender.getName());
        }

        
        return true;
    }
    
}```
#

plugin.getCommand("hello").setExecutor(new CommandClass());

lime jolt
#

?

dawn hazel
#

make a new class

#

and put your onCommand function in it

#

make sure the class implements commandexecutor tho

#

then go to your onEnable() in your main class

#

and replace the command executor line with java plugin.getCommand("hello").setExecutor(new YourClassName());

lime jolt
#

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
        
    @Override
    public void onEnable() {
        
        new HelloCommand(this);
    }
}
#

?

dawn hazel
#

replace new HelloCommand with

#
plugin.getCommand("hello").setExecutor(new HelloCommand(this));```
lime jolt
#

but how would that make it so that a player can type multiple comands in same plugin

dawn hazel
#

then you can make another class

#

implement commandexecutor

#

make a command

#

then

lime jolt
#

add

#

plugin.getCommand("hello").setExecutor(new HelloCommand(this));

#

again?

dawn hazel
#

yeah

lime jolt
#

but change "helloi"

dawn hazel
#

however change HelloCommand to your new class

lime jolt
#

to soemthing elkse

dawn hazel
#

yeah

lime jolt
#

why do I need this

#

plugin.getCommand("hello").setExecutor(new HelloCommand(this));

#

instead of

#

what I had before

#

new HelloCommand(this);

#

ohhh is it because the "hello" and the "other thing" is diffrent

dawn hazel
#

that tells the server that when you do /hello to execute the code from HelloCommand

lime jolt
#

OHHH

#

okay, and do I need to change my yml in someway?

dawn hazel
#

if you dont already have the command defined in plugin.yml

#

youll have to do that

lime jolt
#

aright

dawn hazel
#

otherwise it will throw an error on enable

pearl ibex
#

is there any way to make a item stored in an itemstack wearable?

lime jolt
#

would it be like

#

commands:
hello:
unjoin:

#

oh also, it says there is no "plugin" defined in my Main

dawn hazel
#

yeah

#

plugin isnt defined

#

youll have to replace plugin with "this"

sharp flare
#

show main class and plugin.yml

dawn hazel
#

instead of plugin.getCommand("hello").setExecutor(new HelloCommand(this));

#

do this.getCommand("hello").setExecutor(new HelloCommand(this));

dawn hazel
lime jolt
#

oh okay

lime jolt
dawn hazel
#

you have to do

commands:
  hello:
    description: something description
  unjoin:
    description: something description```
quaint mantle
#

no you dojnt

lime jolt
#

do u need discibtopn

quaint mantle
#

who told you that

quaint mantle
lime jolt
#

oh

quaint mantle
lime jolt
#

oh ok

dawn hazel
quaint mantle
#

do it again

dawn hazel
#

if i just define the command and no description or anything

#

doesnt work

quaint mantle
#

it does

dawn hazel
#

odd

fossil lily
#

What would I do if I wanted to make it so that only the player that dropped the item can pick it up? As in I dont want other players picking up other people's items.

dawn hazel
#

check if the person thats picking it up is the same person that dropped it

#

if not

#

cancel the event

fossil lily
#

But I cant figure out how to check who dropped it

maiden thicket
#

how would i change the player's nametag?

#

(if i have to use nms im ok w that xd)

fossil lily
#

I guess I can set a PCD

#

On the item

dawn hazel
#

ig you could detect for when the item is dropped and then store a hashmap variable for the item and who dropped it

#

then when an item is picked up compare the person who dropped it to the person who picked it up

lime jolt
#

commands no longer work

#

does anyone know why this code no work ._.

#

import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin{
        
    @Override
    public void onEnable() {
        
        this.getCommand("join").setExecutor(new HelloCommand(this));
        this.getCommand("leave").setExecutor(new UnJoin(this));

    }
}
#

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;

public class HelloCommand implements CommandExecutor{
    
    static int playerCount = 0;
    static ArrayList<String> array = new ArrayList<String>();

    public HelloCommand(Main plugin) {
        plugin.getCommand("join").setExecutor(this);
    }
    
    public HelloCommand() {
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        if(!(sender instanceof Player)) {
            sender.sendMessage("Only players may execute this command!");
            return true;
        }
        
        boolean canUJoin = true;
        
        for(int i = 0; i < array.size(); i++) {
            
            if(array.get(i).equals(sender.getName())) {
                canUJoin = false;
            }
            
        }
        
        if(canUJoin) {
        Player p = (Player) sender;
        
        playerCount++;

            Bukkit.broadcastMessage(sender.getName() + " has joined sumo | Player Count: " + playerCount +"/2");
            
        array.add(sender.getName());
        }

        
        return true;
    }
    
    public ArrayList<String> getPlayers(){
        
        return array;
        
    }
public void lousePlayer(){
        
        playerCount--;
        
    }
    
}```
#

import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.util.ArrayList;

public class UnJoin implements CommandExecutor{
    
    static int playerCount = 0;
    static ArrayList<String> array = new ArrayList<String>();

    public UnJoin(Main plugin) {
        plugin.getCommand("leave").setExecutor(this);
    }
    
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        
        HelloCommand data = new HelloCommand();
        
        ArrayList<String> array = data.getPlayers();
        
        boolean isPlayerThere = false;
        
        for(int i = 0; i < array.size(); i++) {
        if(sender.getName().equals(array.get(i))) {
            isPlayerThere = true;
            
        }
        }
        
        if(isPlayerThere == true) {
            data.lousePlayer();
        }
        else {
            sender.sendMessage("You Must Join To Leave!");
        }
        
        
        
        
        
        return true;
    }
    
}```
#

cant do any commands >_<

dawn hazel
dawn hazel
#

And did you get any errors in console

lime jolt
#

name: MyPlugin
version: 1.0
main: org.potatocode.Main

commands:
join:
leave:

lime jolt
dawn hazel
#

commands:
join:
description: some description

lime jolt
#

ado you know what the link was to send logs

#

do*

dawn hazel
#

Also you have HelloCommand defined twice

lime jolt
#

explain

dawn hazel
#

public HelloCommand(Main plugin) {
plugin.getCommand("join").setExecutor(this);
}

public HelloCommand() {
}
lime jolt
#

that is because I needed an overloaded constructor

#

in my UnJoin.java

#

so I could access some variables

#

without having to create stuff

#

or run the other stuff

dawn hazel
#

You don’t need the second hello command

maiden thicket
#

does anyone know how i could change a player's nametag?

dawn hazel
#

And you don’t need to define the join command outside of the main class

#

Make the variables you want to be accessed from other classes static

lime jolt
#

oh yeah totaly forgot, they are static

#

but they are already public

#

so I dont need acessors or setters

dawn hazel
#

public means is that it can be accessed if the class is instantiated

#

if a variable is private it cant be accessed outside of the class at all

dawn hazel
# lime jolt where

you dont need to do plugin.getCommand("join").setExecutor(this); in a class that isnt the main class

lime jolt
#

Could not load 'plugins/HelloWorld.jar' in folder 'plugins'

#

thats what it says in logs

dawn hazel
#

do you have duplicate jars?

lime jolt
#

no

dawn hazel
#

hmm

lime jolt
#

I have not tried the discibtion thing one sec

dawn hazel
#

check your plugin folder and closely check to make sure you do not have a duplicate jar

lime jolt
#

100% sure dont have dulipcate

dawn hazel
#

did you check?

#

and did you make sure there isnt any HelloWorld (1).jars?

lime jolt
#

nope

#

there is like only 6 files

dawn hazel
#

you should check then

lime jolt
#

I did, and there is none

#

only 1

dawn hazel
#

hmm

#

can you send the full stacktrace?

lime jolt
#

what is stacktrace?

dawn hazel
#

the error it sends

#

?stacktrace

#

damn

lime jolt
#

?

#

wait

#

U ARE A GENIUS

#

it worked the diciption

#

I changed that and it worked

#

it could have been something else

#

but it worke

#

d

dawn hazel
#

huh

lime jolt
#

idk how

#

BUT IT DID

dawn hazel
#

whats diciption

lime jolt
#

join:

#

disrbtion: dhaiujndksa

#

in the yml

dawn hazel
#

description?

lime jolt
#

yes

#

english

#

spelling

dawn hazel
#

yeah

lime jolt
#

my code is bad but the command WORKS

#

less gooo

dawn hazel
#

👍

fossil lily
#

Can I force the hashmap to add a new value instead of overriding a different one? I want to have multiple with the same UUID

vocal cloud
sharp flare
#

UUID and use list as value?

fossil lily
#

Nevermind

quaint mantle
lime jolt
#

does anyone know how to tp the player into a specific x and y coordinante when they type the command

quaint mantle
#

or do you mean XYZ

lime jolt
#

yes

#

sry

quaint mantle
#

use Location, also make sure to search up things before you ask questions here @lime jolt

lime jolt
#

oh wait sry my question was worded terribly

#

how do I make it so that they cant move from that position

#

like they are sutck

#

stuck

#

or, I will just spam teliport them

tall dragon
lime jolt
#

okokok

#

also does anyone know what the term is used for display something to someones screen

#

like a hello message

#

but not in the chat

earnest forum
#

or cancel the player move event

quaint mantle
#

event.SetCancelled(true)

lime jolt
#

and on there screen

lime jolt
quaint mantle
lime jolt
#

if thats what it is called

earnest forum
tall dragon
#

title is big text in middle of screen

lime jolt
#

yes

#

how could. make that display on specific players screen

earnest forum
#

title and subtitle is a string

#

and the 3 numbers are integers

#

in ticks

#

so if u put 20 for stay it wil stay for a second

lime jolt
#

aright thanks

lime jolt
#

can I add the username instead/

earnest forum
#

thats the instance of the player

#

no not username

#

the instance of the Player object

lime jolt
#

is there any way to make it go to a specific username

tall dragon
#

for what reason?

river oracle
#

yea Bukkit#getPlayer(String name)

earnest forum
#

an event?

quaint mantle
#

Any way to set an items NBT tag?

#

doesnt seem that I can

tall dragon
#

why not use pdc tho

lime jolt
tall dragon
#

ur using 1.8?

river oracle
earnest forum
lime jolt
quaint mantle
quaint mantle
#

wanna set it to that

lime jolt
#

idk ;-;

river oracle
tall dragon
quaint mantle
river oracle
tall dragon
lime jolt
#

idk I am new to this stuff started like 5 hours ago

river oracle
#

it should say lol

#

like PlayerInteractEvent

lime jolt
#

where

river oracle
#

in the event handler you made?

#

if an event is the trigger your the one who specified the event

lime jolt
#

umm, okay I dont think it is an event

river oracle
#

a command maybe

lime jolt
#

command

#

yes

#

essentialy 2 people are typing a comand

#

that queues them in game

#

and now I am making count down

river oracle
#

in that case it'd be if sender instance of player logic

lime jolt
#

appear on only there screen

earnest forum
#

do you have a CommandSender object?

lime jolt
#

but it is not just the sender

#

it is the other guy 2

tall dragon
# quaint mantle SkullMeta doesnt support that?
public static ItemStack setSkullOwnerNMS(ItemStack is, String url) {
        return setSkullOwnerNMS(is, url, UUID.randomUUID());
    }


    public static ItemStack setSkullOwnerNMS(ItemStack is, String url, UUID uuid) {
        try {
            byte[] decodedBytes = Base64.getDecoder().decode(url.getBytes(StandardCharsets.UTF_8));

            String decoded = new String(decodedBytes).replace("{\"textures\":{\"SKIN\":{\"url\":\"", "").replace("\"}}}", "");

            SkullMeta headMeta = (SkullMeta) is.getItemMeta();
            GameProfile profile = new GameProfile(uuid, null);
            byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", decoded).getBytes());
            profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
            Field profileField;
            try {
                profileField = headMeta.getClass().getDeclaredField("profile");
                profileField.setAccessible(true);
                profileField.set(headMeta, profile);
            } catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
                e.printStackTrace();
            }
            is.setItemMeta(headMeta);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return is;
    }
earnest forum
river oracle
earnest forum
#

./testcommand (player)

lime jolt
#

I store all my players

#

in a string of arrays

#

array of strings

earnest forum
#

no

#

do an array of players

lime jolt
#

I have the usernames

tall dragon
#

@quaint mantle this will take the value in section 'Other, Value:' as input

earnest forum
#

why would u do string?

river oracle
#

all playes?

#

why

#

store UUID if anything

#

though storing every player online is a bit much

lime jolt
#

how would I use Player objects

#

how would I store it

tall dragon
#

you dont

lime jolt
#

Player[] array = new Player[10];

#

array[0] = player?

tall dragon
#

no

lime jolt
#

?!?!?!

tall dragon
#

dont store player objects

river oracle
#

don't store players lol

tall dragon
#

only in very specific scenerio's you can

lime jolt
#

I am storining there names in a string

tall dragon
#

not this case

river oracle
#

you shouldn't even store every player on your server in strings

earnest forum
lime jolt
#

its not every player

#

its 2

tall dragon
#

if you want to remember a player use their uuid

lime jolt
earnest forum
quaint mantle
earnest forum
tender shard
river oracle
lime jolt
#

alright thanks, ima try all of this stuff out

tender shard
#

you can access textures etc with API

quaint mantle
lime jolt
tender shard
lime jolt
#

ima just try making an array of Player

river oracle
earnest forum
quaint mantle
#

by getting its NBT tag data

lime jolt
earnest forum
#

player is fine for a temporary queue

lime jolt
#

alright

quaint mantle
#

{
"function": "set_nbt",
"tag": "{display:{Name:"Chest"},SkullOwner:{Id:"f565f047-aef7-436c-b0d6-5b7e95edd8e4",Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGNkM2M0NWQ3YjgzODRlOGExOTYzZTRkYTBhZTZiMmRhZWIyYTNlOTdhYzdhMjhmOWViM2QzOTU5NzI1Nzk5ZiJ9fX0="}]}}}"
}

quaint mantle
#

Its a URL that generates it

young knoll
#

You can easily make a skull from the texture url with the PlayerProfile API

tender shard
hybrid spoke
young knoll
#

Idk why you’d clone them

#

But yeah

hybrid spoke
tender shard
tall dragon
#

my code takes the base64 encoded data and creates a skull out of it. but this indeed was for 1.8

lime jolt
#

guys do you know if I can do Player p = (Player) sender;

#

and then do

#

p.getName();

young knoll
#

Yes

tender shard
lime jolt
#

alright thanks

crystal magnet
#

you probably want to check instanceof first

young knoll
#

Assuming the sender is a player

lime jolt
#

indeed they will be, thanks for all the help

young knoll
#

Is it bad practice to use a Boolean for something that isn’t true/false

#

Like day/night

quaint mantle
#

@tender shard Again, GameProfile doesnt exist for me

#

Nor does @NotNull

young knoll
#

Figured enums would be better

hybrid spoke
young knoll
#

GameProfile is part of NMS

quaint mantle
#

NMS?

young knoll
#

NotNull is a jetbrains annotation

tender shard
tall dragon
young knoll
#

I mean technically it’s not NMS, but it’s part of the raw server

tender shard
#

then you don't have to mess with NMS stuff

tender shard
young knoll
#

Mhm

#

It’s open source

tender shard
#

and one would have to manually install it to the maven repo

tall dragon
#

but for recent versions i recommend looking at mfnalex's skullutils

young knoll
#

Did he update it to not be legacy

tender shard
#

my SkullUtils uses the GameProfile things

young knoll
#

Booo

#

Fix it

tender shard
#

I only discovered the PlayerProfile API 2 hours ago

young knoll
#

TL;DR you’ll want to use Bukkit.create(Player?)Profile and PlayerProfile.setTexture

tender shard
#

(however my SkullUtils also has methods to set skull blocks into the world so it'd be useless to change to the API methods anway, since I still need GameProfiles ayway)

young knoll
#

The profile API works for skulls too

quaint mantle
#

How do I install buildtools into my plugin?

#

Cause clearly thats a requirement

young knoll
#

Lol

#

No

#

Run buildtools

tall dragon
quaint mantle
#

Wdym run buildtools

tall dragon
#

read dis

young knoll
#

For the version you are using

tender shard
tender shard
#

buuut

lime jolt
#

does anyone know what "yaw" and "pitch" are in positioning

tall dragon
#

yes

tender shard
#

there's still need for my "legacy" way: which is base64 textures

young knoll
#

Why’s that

tender shard
#

the API only allows to use a URL

#

not a raw base64 string

lime jolt
young knoll
#

You’ll never guess what that base64 decodes too

tall dragon
tender shard
lime jolt
#

coooool

hybrid spoke
lime jolt
#

so by what does it go up by

young knoll
lime jolt
#

like is 1 = 1 pixel

tender shard
quaint mantle
tall dragon
#

in any folder

tender shard
quaint mantle
#

Okay..

earnest forum
young knoll
#

Send me a head base64 string

tall dragon
#

i got it on my desktop in a folder for example

earnest forum
#

same

#

easy access to the jar

tender shard
#

noobs

#

I have it at /c/mctest/buildtools

tall dragon
tender shard
#

boons!

hybrid spoke
#

:(

tender shard
#

lol

#

god actually changed the pfp

hybrid spoke
#

im a man of my word

tender shard
#

discord is slow

hybrid spoke
#

its only for this server

lime jolt
#

does anyone know why this is getting mad at me

#

Location loc = new Location(Bukkit.getWorld("world"), -16.5, 67, -22.5, 0, 0);

tender shard
#

oh ok

young knoll
#

Gotta parse it a bit but that’s fine

tender shard
#

that's awesome

young knoll
#

Who’s the boon now

#

:p

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

tender shard
young knoll
#

Mines in a folder on my desktop

#

Does that count

tender shard
#

yes

#

boon

lime jolt
tender shard
#

then use the proper imports

#

the correct import is inside org.bukkit

young knoll
#

Ugh I have to compile something that uses Lombok

tender shard
#

where's the problem

lime jolt
young knoll
#

I have to install Lombok

tender shard
young knoll
#

Gross

tender shard
tall dragon
tender shard
#

you don't have to install anything

sharp flare
#

Any website that shows block data if its orientable or implements directional

tender shard
#

if it's in the pom.xml, just do "mvn install" and done

tall dragon
#

org.bukkit.Location

tender shard
#

lombok does not require anything to be installed

lime jolt
#

but where can u see all the imports

lime jolt
#

is there a site?

tender shard
#

yes there's a site:

tall dragon
#

i mean most people just know

tender shard
#

?jd

lime jolt
#

i see

young knoll
#

My IDE doesn’t support it from maven

tender shard
#

IDE are you using

young knoll
#

Eclipse

tender shard
#

eclipse 100% supports it

#

the example video on the lombok website was made in eclipse

young knoll
#

Didn’t seem to like it when I did it the other day

#

Hmm

tender shard
#

lombok also works fine without any IDE

young knoll
#

True

#

Why am I opening the project in an ide

#

Why am I slow

tender shard
#

sometimes people think lombok hacks into the IDE or similar, but that's just not true, lombok is awesome and works just fine directly with javac :3

young knoll
#

How

#

Surly it must do something so the IDE recognizes the methods that don’t exist before compiling

tall dragon
#

pretty sure the ide just adds support for lombok

tender shard
#

yeah that's normal annotation processing

tall dragon
#

not the other way arround

tender shard
#

I wanted to say - lombok does not REQUIRE any intellij plugins so that it compiles

#

but sure, intelliJ must process the lombo annotations to understand there are the generated methods

#

but even if you wouldn't have any lombok plugin, it would compile from within intellij

young knoll
#

Huh

tender shard
#

or whereever

young knoll
#

Guess I need to stop huffing gas

tender shard
#

lol

young knoll
#

But yeah I can just compile from command line

#

Am not smort

tender shard
#

lombok is awesome just because of the logo

quaint mantle
#

done downloading buildtools

#

now what?

tender shard
#

?bt

undone axleBOT
quaint mantle
earnest forum
#

1 sec

quaint mantle
#

It doesnt tell me how to install it on the plugin

young knoll
#

Oh FFS

earnest forum
#

Spigot->Spigot-API->target

#

and then add the "shaded" jar

tender shard
earnest forum
#

as your dependency

quaint mantle
young knoll
#

I can't compile it still because it needs a signature

#

sdgdsfgdf

tender shard
#

it builds the spigot etc source code and .jar files for you

earnest forum
tender shard
#

what signature?

quaint mantle
#

In my plugin or

earnest forum
#

and then add the shaded jar

#

yes

#

as a dependency

quaint mantle
#

@earnest forum implimentation or compileOnly

earnest forum
#

what does that mean

tender shard
#

compileOnly

earnest forum
#

what ide are u using

quaint mantle
#

Like this?

tender shard
quaint mantle
#
compileOnly 'spigot-api-1.18.1-R0.1-SNAPSHOT-shaded'
earnest forum
tender shard
#

compileOnly = provided

#

while implementation basically means <scope>compile</scope>

#

so it also gets shaded

quaint mantle
#

It states that its an invalid module notation

#

Was I suppost to place the file somewhere?

young knoll
# tender shard a signature?

Make sure you're using Java16 JDK in your PATH.
Compile main-project without signature by using debug profile: mvn install -Pdebug

tender shard
quaint mantle
#

soo how do I set it properly?

tender shard
#

you have to add com.mojang.authlib to your dependencies

quaint mantle
#

just add it manually again

#

as an implementation

#

or

tender shard
#

I have no idea about gradle

#

in maven it works like this:

#
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>3.2.38</version>
            <scope>provided</scope>
        </dependency>
#

but gradle, no idea

young knoll
#

If the jar isn't signed it won't run without a JVM argument

#

And the server I am doing it for has a shitty host that doesn't allow custom JVM args

sharp flare
#

does a tag for terracotta blocks exist

tender shard
#

I have no idea about that

#

I have never signed any .jar files

young knoll
#

Blah

#

Quickshop is pissing me off

tender shard
young knoll
#

They pushed an update for 1.18.2 a week ago, it's not on SpigotMc, it's not on BukkitDev

#

Their jenkins is a 404

#

And I can't compile it locally

tender shard
#

hm let me see

tall dragon
sharp flare
#

Aight imma make an enum for it instead

young knoll
#

Just make an EnumSet

sharp flare
#

added only in 1.18?

tender shard
#

no idea

sharp flare
#

My spigot jar is 1.17.1 rn

young knoll
#

Let me look

#

NVM the site I use doesn't have 1.18

sharp flare
#

Appreciate yall

young knoll
#

Nope no terracotta tag on 1.17

tender shard
#

more like SlowShop

sharp flare
#

Aight thanks, imma make an enum for it along side other blocks that implements directional, bisected or orientable

quaint mantle
#

@tender shard figured it out lol

#
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT-shaded'
#

had to search here

#

for the correct repo

#

@tender shard question: is maven better than gradle?

#

starting to see more ppl using maven than gradle

maiden thicket
#

i've seen more people switch to gradle than use maven

young knoll
#

Honestly I'd say its preference

hasty prawn
#

^

young knoll
#

Gradle can do more though apparently, which is why paper moved to it

hasty prawn
#

Gradle is more complicated, but it's less verbose and more powerful

young knoll
#

But I doubt you have to worry about that for a plugin

hasty prawn
#

I do enjoy not having my dependencies be like 7 lines each though peepoGiggles

quaint mantle
#

compileOnly 'com.mojang:authlib:1.5.21'

#

am I compiling this right?

#

Its not working

#

*i cant access com.mojang.authlib

hasty prawn
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

hasty prawn
#

Refresh gradle

quaint mantle
#

k

#

@hasty prawn nothing

#

nvm

hasty prawn
#

Lol

#

The little elephant with 2 arrows button Prayge

young knoll
#

Do you have the repo for authlib

#

Idk if it's on central

maiden thicket
#

kms for using reflections to change a players nametag

#

😢

young knoll
#

Appears to be the repo for authlib

tender shard
#

both are equally good

#

imho gradle is way more complicated

#

both can do the same things

young knoll
#

I prefer gradle for the less verbose build file

#

But I agree that it can be a bit complex to use

#

And documentation is pain to find

tender shard
#

yeah gradle files are shorter, but also much more complicated to read etc

#

but as said, both are totally fine and neither is better than the other

#

it's like BMW vs Mercedes or Canon vs Nikon or Ubuntu vs Debian etc etc etc

warm light
#
if(event.getRightClicked().getType().equals(EntityType.VILLAGER)){
e.setCancelled(true);
}

this should disable villager trading right?

warm light
#

PlayerInteractAtEntityEvent

young knoll
#

Hmm I think I do exactly that

#

Let me check

tender shard
#

but you should rather use == instead of equals()

young knoll
#

Yep I do that

#

I use the PlayerInteractEntityEvent tho

#

Idk if it makes a difference

quaint mantle
#

implementation 'de.jeff_media:JeffLib:7.7.0-20220309.181717-13@jar'

#

Any reason why this dependancy may not load?

tender shard
warm light
tender shard
#

add some messages

#

one message above your if statement, and one inside

#

to see if that code actually runs and if yes, whether the if statement returns true

ancient jackal
#

is it registered

tender shard
#

just because it is registered doesn't mean it'll run in this case

#

for example, it might be the wrong event

ancient jackal
#

that's true but I have spent half of a night debugging to figure out why something wasnt running

#

and it just wasnt registered

tender shard
#

I thought you wrote "it is registered"

#

and not "is it registered"

warm light
#

Event working and I registered it. but its not canceling

tender shard
#

and those get printed?

warm light
#

Yes

ancient jackal
#

try using the parent class PlayerInteractEntityEvent

tender shard
#

everytime you right click a villager?

tender shard
warm light
ancient jackal
#

true, but there's this note Note that the client may sometimes spuriously send this packet in addition to PlayerInteractEntityEvent. Users are advised to listen to this (parent) class unless specifically required.

warm light
#

alr

ancient jackal
#

so maybte you would have to cancel the parent one

#

maybe it'll work,maybe it wont

tender shard
warm light
#

oh yes. its working now

ancient jackal
#

true but maybe something is wrong and you cant cancel from the child

tender shard
ancient jackal
#

that's a problem for md_5 someday then, can't cancel event from InteractEntityAt whatever it's caleld

#

PlayerInteractAtEntityEvent

tender shard
#

I have just checked

#

right clicking a villager does NOT call the child event

#

so the statement that you have added debug messages and they were printed cannot be true

young knoll
#

wait

tender shard
#

right clicking a villager does NOT call PlayerInteractatEntityEvent

ancient jackal
young knoll
#

Have we determined which is the child finally

#

Woo we have

#

The At version is for armorstands btw

ancient jackal
#

the child event says Represents an event that is called when a player right clicks an entity that also contains the location where the entity was clicked., I'd still never use it and just do e.getRightClicked().getLocation();

young knoll
#

No no

ancient jackal
#

yes yes I would

young knoll
#

Not that location

#

The point on the entity where the player clicked

ancient jackal
#

oh that's very niche

young knoll
#

Used for armorstands since they have different functions depending on what part you click

wet breach
#

I am not sure why the API docs were confusing, was pretty straight forward

amber marsh
#

hey, how is it going. I am back with more questions XD. I am trying to add to a list of strings from config string list, but it keeps giving me, what looks like, a null error??

wet breach
#

?paste

undone axleBOT
wet breach
#

also, are you sure the data you are trying to get from the config is indeed of a list type?

wet breach
#

yaml has a specific requirement in how it must be formatted for it to be consided a list

amber marsh
#

it looks like this

#

7MSD_class:

  • Undead
  • Madness
wet breach
#

alright, then its something with your code

tender shard
#

noone can help if you don't show your code

wet breach
#

give them time

amber marsh
#

I dropped the whole main script in the hastebin

#

yes, my code is smelly, please no hate

wet breach
#

hit the save button and then give updated link

amber marsh
tender shard
#

send the full stacktrace too pls

amber marsh
#

no idea what that is

tender shard
#

the error message

amber marsh
tender shard
#

the error doesn't come from the code you sent

quaint mantle
#

Any reason why this dependancy wont load?

implementation 'de.jeff_media:JeffLib:7.7.0-20220307.093638-1'

This is the repository:

maven {
        name = 'jeff-media-public'
        url = 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/'
    }
tender shard
#

the error happened in line Main 246

#

but your code doesn't go to line 246

quaint mantle
amber marsh
#

give me 10 minutes.

#

thank you so much for helping me!

tender shard
#

e.g. if you do stuff like List<String> = getConfig().getStringList("..."), you can't add something to it, as it seems

#

you'll have to create a new list

#

at least that's my guess, we gotta see a matching code/error to tell more 🙂

#

as said, the code you sent can't be the same as the one that caused the error message because the line numbers don't match up

wet breach
#

according to that unsupportedoperationexception

#

unless there is a class we are not seeing

tender shard
#

they use .add on a list that is immutable

amber marsh
#

back, the error didn't change, the thing I thought would fix it didn't

tender shard
#

you do config.getStringList

#

that returns an unchangable list

#

you must do it like this:

#
List<String> myList = new ArrayList(config.getStringList("..."));
#

now you can freely manipulate myList

amber marsh
#

TY!

tender shard
#

np

wet breach
#

anyways, that should fix their problem if that is indeed the issue

amber marsh
#

I really really hope it does fix it

#

you are all really amazing, and I appreciate you to no end

tender shard
#

np 🙂

young knoll
#

Yeah idk why it’s immutable

#

Weird

amber marsh
#

it didn't do the thing. I did a workaround

quaint mantle
#

@tender shard I figured out how to make the skull!

#
public static ItemStack getCustomSkull(String url) {
        ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
        if (url.isEmpty()) return head;

        SkullMeta skullMeta = (SkullMeta) head.getItemMeta();
        GameProfile profile = new GameProfile(UUID.randomUUID(), null);

        profile.getProperties().put("textures", new Property("textures", url));

        try {
            Method mtd = skullMeta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
            mtd.setAccessible(true);
            mtd.invoke(skullMeta, profile);
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
            ex.printStackTrace();
        }

        head.setItemMeta(skullMeta);
        return head;
    }
amber marsh
#

WOOT! Skull!

tender shard
quaint mantle
#
package me.emerald.emeraldsplugin;

import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.UUID;

public class PluginFuncs{
    public static void sendGlobalMessage(String msg){
        Bukkit.getOnlinePlayers().forEach(sender -> sender.sendMessage(msg));
    }

    public static ItemStack getCustomSkull(String url) {
        ItemStack head = new ItemStack(Material.PLAYER_HEAD, 1);
        if (url.isEmpty()) return head;

        SkullMeta skullMeta = (SkullMeta) head.getItemMeta();
        GameProfile profile = new GameProfile(UUID.randomUUID(), null);

        profile.getProperties().put("textures", new Property("textures", url));

        try {
            Method mtd = skullMeta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
            mtd.setAccessible(true);
            mtd.invoke(skullMeta, profile);
        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
            ex.printStackTrace();
        }

        head.setItemMeta(skullMeta);
        return head;
    }
}
#
  • I couldnt load ur lib
#

sadly

wet breach
sharp flare
#

method is just transferred to a new class

quaint mantle
amber marsh
#

i hate codeing

wet breach
# sharp flare method is just transferred to a new class

While technically true if this code is on a repo, its not obviously apparent where it came from. It is frowned upon to claim code as your making if you didn't come up with it. In these cases, a simple comment at the top usually suffices of where it came from AKA giving credit where it belongs

amber marsh
#

I spend a solid 20 minutes wondering why my armor stand was not showing its name. I did textArmorstand.setCustomNameVisible(false);, and not textArmorstand.setCustomNameVisible(true);

wet breach
#

I don't care if people borrow code from my projects, but it is always nice for people to attribute credit if they have done so 🙂

sharp flare
#

yeah I mean he just copy pasted the method so a credit must be given

#

just my chat is incomplete leading to misconception xD

wet breach
#

lol

warm trout
#

Does anyone know how I would add a blockbench model onto an entity? I have the resourcepack created by ModelEngine, but I'm not sure how to actually spawn the model

young knoll
#

Put it on their head

#

Only works for entities that render head items

quaint mantle
#
getCommand("specialgive").setExecutor(new SpecialGiveCommand());
        getCommand("challenge").setExecutor(new ChallangeCommand());
        getCommand("tospawn").setExecutor(new ToSpawnCommand());
        getCommand("crates").setExecutor(new CratesCommand());
        getCommand("balance").setExecutor(new BalanceCommand());
        getCommand("shop").setExecutor(new ShopCommand());

        getServer().getPluginManager().registerEvents(new InteractionEvent(), this);
        getServer().getPluginManager().registerEvents(new OnPlayerChatEvent(), this);
        getServer().getPluginManager().registerEvents(new PlaceBlockEvent(), this);
        getServer().getPluginManager().registerEvents(new InvClickEvent(), this);
        getServer().getPluginManager().registerEvents(new BreakBlockEvent(), this);
        getServer().getPluginManager().registerEvents(new PlayerJoin(), this);
        getServer().getPluginManager().registerEvents(new PrepItemCraftEvent(), this);
        getServer().getPluginManager().registerEvents(new InteractEntityEvent(), this);
        getServer().getPluginManager().registerEvents(new EntityDamage(), this);
#

Can I make this smaller?

young knoll
#

Hmm

#

I’d just split it up

#

registerCommands and registerEvents

drowsy helm
#

make a function that takes varargs for registering events

#

makes it look nicer

young knoll
#

Yeah I was gonna suggest that too

earnest forum
#
PluginManager pm = getServer().getPluginManager();

pm.registerEvents(new InteractionEvent(), this);

young knoll
#

ps?

earnest forum
#

pm

#

anyone know how i can give a player permanent potion effect?

young knoll
#

Set the time to Integer.MAX_VALUE

earnest forum
#

thanks

earnest forum
#

does PlayerAnimationEvent run every tick while holding down left click on a block?

waxen plinth
#

I never even knew that was a thing

#

?jd

waxen plinth
#

And there's only one animation it covers lol

earnest forum
#

is there a way to check if a player is swinging?

solar sable
#

swinging?

#

like a sword swinging animation?

#

@earnest forum

earnest forum
#

ye

#

like if im starting a runnable when the player hits a block

#

im checking if they are still breakin git

kindred valley
#

?learnjava

undone axleBOT
solar sable
#

player click a block

young knoll
#

There’s an event for starting to break a block

#

And there’s one for cancelling and one finishing

#

So making use of those you can tell when they are breaking a block

earnest forum
#

which ones cancelling?

opal bridge
#

Can I add github url to recourse page?

tardy delta
#

I saw other People doing that

opal bridge
tardy delta
#

I guess no

opal bridge
#

ok

young knoll
#

Yeah it even has a spot for it

young knoll
opal bridge
#

How can I change recourse icon?

young knoll
#

Edit icon on the sidebar

#

Iirc

opal bridge
#

a the option is small

carmine pecan
#

Hi guys! Need some help with a timer that counts time between block place and pressure plate click. Right now I'm listening for the normal BlockPlaceEvent and then save the current time as an Instant. When the player later presses the pressure plate, the time difference is calculated and shown to the player. My problem is that this server-sided approach makes the timer prone to high ping/notwork lag. I was thinking that this might be solved by listening for client packets instead. Anyone here who can help me?

rough drift
#

you realize listening to client packets is the same right?

#

you will have the same latency issues

carmine pecan
#

Yeah I was thinking that too, but I've heard rumours it's possible to bypass/improve it by using packets. Here's what another dev said:

midnight quarry
#

hello, I want to spawn a block right next to a player in the direction where player is looking at

#

can anyone help with me how to get proper direction

#

I'm aware of getRelative() method but that won't work in this case

#

Player#getLocation().getDirection() ?

#

that will return a vector

#

how do I get the block though

#

I think if add x and z with the sign of the direction unit vector coordinates it might work

carmine pecan
#

A developer on one of the leading training servers

vocal cloud
#

I assume this is for something like speed bridging timing?

midnight quarry
#

it worked

vocal cloud
#

I'm confused. If you want the most accurate time you'd use the client of course but clients can spoof stuff. Unless you're mentioning when the server receives packets from the client but I can't imagine that you'd get huge differences between that and the events.

rough drift
#

^

smoky oak
#

how do i import javadoc using maven?

#

no like

#

i have the javadoc in .m2

#

but its not loading for some reason

#

where do i execute that?

#

the terminal is just running an instance of cmd.exe

#

(intelliJ user)

carmine pecan
carmine pecan
vocal cloud
#

You want the clients stuff? You don't want the clients stuff. You should only use what the server has.

dire marsh
#

What are you trying to do here?

#

what is the problem?

#

oh I think I understand

carmine pecan
dire marsh
#

lower? I thought the opposite

vocal cloud
#

It's probably because they can queue a bunch of packets and then all at once send them to the server thus giving them a head-start advantage.

hybrid spoke
#

you wont get the exact times the client sent smth except you are listening clientside

vocal cloud
#

There is really no good solution besides invalidating anyone who seemingly uses lag to their advantage

hybrid spoke
#

closest you can get, like mentioned yesterday, is (packet sent time in ms - ping)

vocal cloud
#

That looks 100% like a server-side issue not client-side

#

if the client was lagging they would be rubber-banding like mad.

dire marsh
#

Why are you using block placements?

hybrid spoke
#

the timer is not affected by client lags

#

how would it be

carmine pecan
#

On these videos our moved-wrongly-threshold and moved-too-quickly-threshold was set to 100/200, so I think rubber-banding was more or less disabled

#

TPS is also consistently 20 and it only happens for individual players, not the whole server at once

vocal cloud
#

So players are allowed to lag out and the solution for that has been disabled -> ?

carmine pecan
#

It seems to have improved it, but the issue still persists

hybrid spoke
#

what exactly is the issue? the timer going crazy? or is there literally a big advantage?

dire marsh
#

the time seems to be about right in that video though (18s)? They started at 2s in the video, landed on the pressure plate at 20s. That's 18s?

vocal cloud
#

Yeah the timer seems to be right

#

if anything they actually lost time due to the lag

carmine pecan
hybrid spoke
#

it started late, but how is that a client problem?

#

i could imagine that he was lagging at the start and his connection got better while bridging.. but that shouldn't affect it, or?

dire marsh
#

that looks like the server started the timer at the incorrect block place, server started at around 00:04, he landed at 00:09, that gives the 5 seconds.

#

are you sure your logic is not broken somewhere?

#

you may also want to get a client to simulate network lag so you can test yourself

vocal cloud
#

The issue here is even if this is a client issue, the solution cannot be to rely on the client for information. You can use this application to create artificial lag and see for yourself https://www.netlimiter.com/.

carmine pecan
#

Here's my logic inside the BlockPlaceEvent @dire marsh:

@EventHandler
        public void onPlace(BlockPlaceEvent event) {
            Player player = event.getPlayer();

            if (BridgeSession.this.player != event.getPlayer()) { return; }

            Location location = event.getBlock().getLocation();
            placedBlocks.add(location);

            boolean inRangeX = ((xMax == xMin || location.getBlockX() > xMin + 2) && location.getBlockX() < xMax - 2);
            boolean inRangeY = (location.getBlockY() < yMax);
            boolean inRangeZ = (location.getBlockZ() > zMin + 2 && location.getBlockZ() < zMax - 2);

            if (!inRangeX || !inRangeY || !inRangeZ) {
                event.setCancelled(true);
            } else {
                BridgeSession.this.blockLoc = location;

                if (!count) {
                    BridgeSession.this.time = BigDecimal.ZERO;
                    start = Instant.now();
                    count = true;
                    replayID = player.getUniqueId() + "_" + Instant.now().toEpochMilli();
                    ReplayAPI.getInstance().recordReplay(replayID, player, location, player);
                }
                blocks ++;
                if (player.getItemInHand().getAmount() <= 15) {
                    refill();
                }
            }
        }```
dire marsh
#

can you put that in a code block

hybrid spoke
#

?paste

undone axleBOT
vocal cloud
#

You could always check for an unnaturally large amount of block place events within a timeframe

dire marsh
#

three ` then java and 3 at the endd

vocal cloud
#

That would indicate some sort of lag

carmine pecan
vocal cloud
#

It's probably a hiccup with the server. If it's not then you've got either a client issue or a plugin issue.

dire marsh
#

if (BridgeSession.this.player != event.getPlayer()) { return; }
first, this seems sus

carmine pecan
#

We're also recording replays every time a player bridges, and looking at the ones experiencing timer lag, all blocks are instantly placed when the replay starts (using AdvancedReplay)

carmine pecan
dire marsh
#

you should be using equals there

#

not !=

#

as you are comparing an object

hybrid spoke
#

comparing the adress seems fine if it have to be that exact player object

vocal cloud
#

Record the time between block placements and look for sandwiching of when the server receives them.

vocal cloud
#

There is plenty of network limiting software out there to test with. I'd recommend a lag switch to see if that can duplicate it. If that's not the issue then the plugin/server are the problem here

dire marsh
#

if anything, I would expect a laggy player to have a disadvantage, as the landing and hitting the pressure plate will have a delay until it reaches the server... at least, that's what I've always experienced when I lag on these sorts of things

carmine pecan
#

It's set to false when the reset() method is called, which is every time a player joins or quits the course, or when the player falls or presses the pressure plate

hybrid spoke
#

so every listener is per-player?

carmine pecan
#

Only set to true inside the BlockPlaceEvent

carmine pecan
hybrid spoke
#

weird structure

vocal cloud
#

Assuming it's someone trying to cheat the system and not general lag

carmine pecan
carmine pecan
dire marsh
#

I don't see how it can be cheated like that though, cause surely your code should be detecting the first block they place, then calculating the time between that and activating the pressure plate?

#

unless the client is ahead on movement, and behind on block placements somehow?

#

which should just be impossible?

carmine pecan
dire marsh
#

to me it seems they're lagging, they catch up and all the block placements get done, but somehow your code is only detecting the last in that block placement, and thus the time is wrong

carmine pecan
hybrid spoke
#

couldn't you just check if they didn't started yet and cancel if so?

dire marsh
#

I'll have a think about it for a bit

carmine pecan
carmine pecan
dire marsh
#

@carmine pecan can you confirm how many times the code within if(!count) executes after a lagspike like shown in the videos?

carmine pecan
dire marsh
#

yeah that's why I suggest getting something that allows you to reproduce the issue

desert tinsel
#

I have this code:

@EventHandler
    public void BlockBreakEvent(BlockBreakEvent e){
        Block b = e.getBlock();
        Player p = e.getPlayer();
        if (!(plugin.blocks.get(p) == null)){
            if (b.getType().equals(Material.STONE)){
                plugin.blocks.put(p, plugin.blocks.get(p)+1);
                EconomyResponse response = economy.depositPlayer(p, 1.0);
            }
        }else{
            if (b.getType().equals(Material.STONE)){
                plugin.blocks.put(p, 0);
                EconomyResponse response = economy.depositPlayer(p, 1.0);

            }
        }
        if (plugin.getTokenMiner().getInt("Player."+p.getName()) == 0){
            Random r = new Random();
            Integer rr = r.nextInt(5);
            if (rr == 1){
                plugin.tokens.put(p, plugin.tokens.get(p)+1);
            }
            p.sendMessage("1");
        }else{
            Integer level = plugin.getTokenMiner().getInt("Player."+p.getName());
            if (level <= 250){
                Random r = new Random();
                Integer rr = r.nextInt(TokenMic(level));
                if (rr == 1){
                    plugin.tokens.put(p, plugin.tokens.get(p)+1);
                }
                p.sendMessage("2");
            }else{
                plugin.tokens.put(p, plugin.tokens.get(p)+TokenMare(level));
                p.sendMessage("3");
            }
        }
    }```
everything works perfectly, just up to ``p.sendMessage("1");`` in .yml file, i have:
```yml
Player:
  xSenny_: 1000```
Why it doesn't work?
tender shard
#

p.sendMessage("1") is the last statement in your if block

#

so if this line is true:

if (plugin.getTokenMiner().getInt("Player."+p.getName()) == 0){

then p.sendMessage("1") is the last statement that gets executed

#

that's the whole idea of if/else

desert tinsel
#

plugin.getTokenMiner().getInt("Player."+p.getName() = 1000

#

so the plugin need to do:

                plugin.tokens.put(p, plugin.tokens.get(p)+TokenMare(level));
                p.sendMessage("3");
            }``` i guess
#

cause the plugin.getTokenMiner().getInt("Player."+p.getName() isn't equal with 0, and isn't less or equal with 250

#

is this right?

desert tinsel
#

?

lime jolt
#

guys

#

does anyone know whats wrong with this line

#

array.get(0).sendTitle("Hello!", "This is a test.", 1, 20, 1);

#

the arraylist is made of players

#

and there is a player at array.get(0)

#

it says

#

The method sendTitle(String, String) in the type Player is not applicable for the arguments (String, String, int, int, int)

#

but then how would I fade it out

#

and do all those other paremiters

young knoll
#

It’s takes 5 in modern mav

#

What version are you on

lime jolt
#

1.8.8

#

._.

young knoll
#

That’s why

lime jolt
#

dam

#

is there any work around

young knoll
#

Update or figure it out yourself

#

1.8.8 isn’t supported

lime jolt
#

dãng ok

desert tinsel
#

can some1 help me?

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

desert tinsel
#

i do not have any error

#

everything works perfectly, just up to p.sendMessage("1");

young knoll
#

What do you expect

#

That’s the end of the code block

wet breach
#

if you were instead wanting to output what is in your config instead

#

you should fetch the strings from there

desert tinsel
# wet breach what exactly were you expecting to happen by using those numbers?
Integer TokenMic(Integer level){
        int sansa = 0;
        if (level <= 50){
            sansa = 5;
        }else if ((level <= 100) && (level >= 51)){
            sansa = 4;
        }else if ((level <= 150) && (level >= 101)){
            sansa = 3;
        }else if ((level <=200) && (level >= 151)){
            sansa  = 2;
        }else if ((level <= 250) && (level >= 201)){
            sansa = 1;
        }

        return sansa;
    }

    Integer TokenMare(Integer level){
        int multi = 10;
        if ((level <= 300) && (level >= 251)){
            multi = 2;
        }else if ((level <= 350)&&(level >= 301)){
            multi = 3;
        }else if ((level <= 400) && (level >= 351)){
            multi = 4;
        }else if ((level <= 450) && (level >= 401)){
            multi = 5;
        }else if ((level <= 500) && (level >= 451)){
            multi = 6;
        }else if ((level <= 550) && level >= 501){
            multi = 7;
        }else if ((level <= 600) && (level >= 551)){
            multi = 8;
        }else if ((level <= 650) && (level >= 601)){
            multi = 9;
        }else if ((level <= 700) && (level >= 651)){
            multi = 10;
        }else if ((level <= 750) && (level >= 701)){
            multi = 11;
        }else if ((level <= 800) && (level >= 751)){
            multi = 12;
        }else if ((level <= 850)&&(level >= 801)){
            multi = 13;
        }else if ((level <= 900)&&(level >= 851)){
            multi = 14;
        }else if ((level <= 950) && (level >= 901)){
            multi = 15;
        }else if ((level <= 1000)&&(level >= 951)){
            multi = 16;
        }else if ((level <= 1150)&&(level>= 1001)){
            multi = 18;
        }else if ((level <= 1300)&&(level >= 1151)){
            multi = 20;
        }else if ((level <= 1500)&&(level >= 1301)){
            multi = 25;
        }


        return multi;
    }```
wet breach
#

I see you have a misunderstanding in how strings work.

desert tinsel
#

i put the strings for show you how far the code goes

carmine pecan
dire marsh
young knoll
#

You have if else blocks

young knoll
#

Of course only 1 can trigger

wet breach
rotund pond
#

Why is there a capital letter on the first char of these methods ?

desert tinsel
#

but i do not have a problem with strings

#

i have one with the if else blocks

wet breach
young knoll
#

They are standards

rotund pond
wet breach
#

Convention or more better known as style

rotund pond
#

Conventions have to be rules so every codes are based on the same things

#

But w/e