#help-development

1 messages ยท Page 1349 of 1

sage swift
#

getOrDefault*

abstract relic
#

^^

#

i would probably just go with a player object though

wet breach
#

it might be better if you did the addition outside of the constructor so as for it to be less confusing and less things to go wrong.

quaint mantle
#

yeah same

formal ferry
#

how to copy config.yml from resources/config.yml and paste it to config.yml in the plugins folder (bungee)

formal ferry
#

doesn't say anything

dusty herald
#

wym?

eternal oxide
#

saveDefaultConfig()

dusty herald
#

this is bungee

eternal oxide
#

ah

formal ferry
#

want to copy and paste file

dusty herald
#

what

formal ferry
#

so

#

basically

#

i have a premade config.yml

#

and i want to paste that to the folder of the plugin

dusty herald
#

that link will show you how to do that with a pre-existing file..?

#

what

fathom timber
#

@heavy mason

#

ignore my code

#

very bad 100%

dusty herald
#

what is the issue

quaint mantle
#

yes

dusty herald
#
            e.printStackTrace();
        }``` ![monkaSHOOT](https://cdn.discordapp.com/emojis/543614811200815144.webp?size=128 "monkaSHOOT")
heavy mason
#

Yes

#

Because why not

fathom timber
#

syhhh

#

anyways

#

this is my error

heavy mason
#

Are you opped?

fathom timber
#

ye

heavy mason
#

Your plugin probably didnt load then

dusty herald
#

let me see your plugin.yml and latest.log

heavy mason
#

Does it shown in /pl?

quaint mantle
#

do /pl

#

is your thing red or green

#

or even shows up

dusty herald
#

or is it even there

fathom timber
#

it isnt poppin up

#

You're right

dusty herald
#

show latest.log

heavy mason
#

Yeah it didnt load then

quaint mantle
#

error in the console when it loads?

heavy mason
quaint mantle
#

yea

#

I'm guessing api-version: is missing

fathom timber
#

?paste

queen dragonBOT
fathom timber
dusty herald
#

you put fact

#

not Fact

#

๐Ÿ‘€

fathom timber
#

SHH

dusty herald
#

me.ujiou.factoid.fact
vvvvvvvvvvvvvvvvvv
me.ujiou.factoid.Fact

heavy mason
#

๐Ÿ˜‚ ๐Ÿ˜‚ ๐Ÿ˜‚

quaint mantle
#

unfortunate

heavy mason
#

Ajajjajajja

quaint mantle
#

xd

fathom timber
#

SHHHHHH

quaint mantle
#

yea xd

carmine ivy
#

How do I send players to a different world

dusty herald
#

Player#teleport

quaint mantle
#

teleport

carmine ivy
#

How

dense kestrel
#

@carmine ivy Create a new location then teleport them to it

quaint mantle
#

he just said

dense kestrel
#

isnt there player.setLocation()?

quaint mantle
#

Player#teleport(world, coords)

dusty herald
#

Entity#teleport technically more correct DogKek

carmine ivy
fathom timber
#

@dusty herald

quaint mantle
#

si senor

fathom timber
#

fr

#

fr tho

dusty herald
#

yes?

fathom timber
#

i changed the class name bc im stupid and named it factoid.factoid

#

smh

#

lmfao

quaint mantle
#

factual factoid

fathom timber
#

shhh

heavy mason
#

God that sounds so wrong

#

Player#setLocation

#

Idk

dusty herald
#

it's evil

dense kestrel
carmine ivy
#

So would this work?

Location newLoc = p.getLocation().setWorld(World world_nether);
dusty herald
#

what

#

no

heavy mason
#

Uh no

quaint mantle
#

what

#

the

dusty herald
#

setWorld is a void

quaint mantle
#

fuck

carmine ivy
#

Oh lmao

dusty herald
#

just p.getLocation()

outer crane
#

How would i teleport a player while ignoring pitch and yaw?

dusty herald
#

just teleport the player normally

#

should work just fine

quaint mantle
#

pitch and yaw is just an rotation of head

outer crane
#

but their view gets lagged back

dense kestrel
#

I just checked, the p.setLocation() is part of the Factions Fork i have to work with 24/7, my bad didnt mean to confuse them XD

quaint mantle
#

get their pitch and yaw

#

and set it as well

#

yea

#

if that's what you want

heavy mason
#

Curious

dusty herald
#

๐Ÿค” give it a shot

quaint mantle
#

no cluie

outer crane
#

doing that makes the pitch and yaw lag back, if the player's fps isnt exactly synchronised with the server's tps it will lag their view back

quaint mantle
#

might just give you the same effect

dusty herald
fathom timber
#
player.setBedSpawnLocation(player.getLocation(), true);
#

best thing fr ^

dusty herald
#

omg that's

#

wtf

fathom timber
#

lmfao

quaint mantle
#

or just do player.teleport(null);

#

good too

#

xd

fathom timber
#

Joch even better

dusty herald
#

watch them disintegrate

fathom timber
#
player.setBedSpawnLocation(player.getEyeLocation(), true);
quaint mantle
#

omg

#

thats better

fathom timber
#

fr fr

dusty herald
#

Entity#setOp(true);

#

you can make a pig OP

fathom timber
#

damn

heavy mason
#

Lmaooo

dusty herald
#

you can straight make a pig run commands too

heavy mason
#

Wait

quaint mantle
#

sick

quaint mantle
#

kill the pig for the op

heavy mason
#

Pig with /ban

dusty herald
#

yes.

#

you hit the pig, the pig /bans your ass

heavy mason
#

LMAOOO

dense kestrel
#

Hey, at least a pig wont abuse :/

fathom timber
#

BRo

#

i wanna jump off a bridge

dusty herald
round finch
#

achievement unlock helped someone with code

dusty herald
#

I commissioned from that someone while back

dense kestrel
#

๐Ÿ˜ฎ

heavy mason
#

That dog needs a bonk

dense kestrel
#

i wanna be that dog

fathom timber
#
        Entity pig = new Pig;
        Entity villager = new Villager;
        
        villager.setCustomName("Flo Rida");
        villager.setCustomNameVisible(true);
        pig.addPassenger(villager);
dusty herald
#

bruh

fathom timber
#

ez

dusty herald
heavy mason
#

Thats so jank lmaoo

round finch
#

poor dog if she farts

fathom timber
#

lmfao

dense kestrel
#

XD

fathom timber
#

#IllCallPeta

#

Peta? Pita?

heavy mason
#

Puta

fathom timber
#

fr fr

heavy mason
#

๐Ÿ‘

round finch
#

SP

round finch
fathom timber
#
        @EventHandler
        public void onPlayerJoin(PlayerJoinEvent event)
        {
            Player player = event.getPlayer();
            Entity pig = new Pig;
            Location piggy = pig.getLocation();
            player.setBedSpawnLocation(piggy);
            // wait(0.5) be like
            pig.eject();
        }
}
#

why this no work ๐Ÿ˜ฆ

#

lmfao ||its a joke JOCH||

dusty herald
#

you need to create the pig dummy

round finch
#

gimme your baguette @fathom timber

fathom timber
#

lmfao

#

im a minor

#

SUS

round finch
#

i'm staving spigot plugin isn't enough for me to live off

fathom timber
#

@dusty herald but fr tho how do I fix my issue?

round finch
#

xd

fathom timber
#

Like register my plugin?

dusty herald
#

im sorry what

fathom timber
#

my thing

#

/pl

#

:/

dusty herald
#

show me your plugin.yml

dusty herald
#

the entire thing

fathom timber
#

oh

#

so remember when it was factoid.fact

dusty herald
#

oh my god

#

I am gonna slap you

fathom timber
#

it was really factoid.factoid and i was embarressed so I changed it to factoid.factoid

#
name: Factoid
version: 1
main: me.ujiou.factoid.factoid
api-version: 1.16
authors: [ Ujiou ]
commands:
  fact:
    description: Display a fact.
#

ez

dusty herald
#

ok now show code

fathom timber
#

Also

#

so I replaced my Event with the a command to see if i could fix the error

#

so the commands class is Events 10/10

#

?paste

queen dragonBOT
fathom timber
dusty herald
#

public class Fact

#

main: me.ujiou.factoid.factoid

#

๐Ÿ‘it๐Ÿ‘has๐Ÿ‘to๐Ÿ‘have๐Ÿ‘the๐Ÿ‘main๐Ÿ‘class๐Ÿ‘too

fathom timber
#

STFU

#

:OK:

round finch
#

Classic mistake ๐Ÿ˜†

sharp bough
#

is there some kind of clock running on the background that i can call, add 30 seconds , save this new number and check every 1 second to allow a player to use a command for 30 seconds?

round finch
#

hashmap?

sharp bough
#

but i was hoping i could do my thing

#

like in python that you have a background timer that you can check

round finch
#

HashMap<UUID, Integer> Player_Coolown = new HashMap<UUID, Integer>();

dusty herald
#

ExpiringMaps DogKek

sharp bough
#

but would expiring map reset if i stop the server?

#

becuase i though since we have an sql, add to all players a flyTimeLeft in seconds so every 1 second i check if their time is up

#

but idk if that would make lag

dusty herald
#

yes

sharp bough
#

maybe every 1 minute?

round finch
#

@rotund ravine uh? did i mistake?

dusty herald
#

it would reset if you stop the server

sharp bough
#

i really dont want that

dusty herald
#

I mean you could just remove it if they shouldn't have it onJoin

sharp bough
#

could i use that for weekly perms?

#

what about 1 month?

wide galleon
#

How can I spawn a random entity?

worldly ice
#

u can create an array with all of the entities and grab a random one

#

unless theres a method for that, which i dont think there is

wide galleon
worldly ice
#

EntityType[] entities = { EntityType.ZOMBIE, EntityType.SKELETON ... }

#

if i remember correctly thats how u make it

wide galleon
#

okay ty

worldly ice
#

np

dusty herald
wide galleon
worldly ice
#

where?

wide galleon
#

in the {}

sharp bough
worldly ice
#

yes

wide galleon
round finch
#

just don't typ every entity out that would be poor programming rather do a loop just saying

if you did thought to typ every entity then jikes xD

eternal oxide
#

@sharp bough use a permission plugin. GroupManager has timed permissions (min of 1 minute) not sure about others.

sharp bough
#

nah its fine

#

thanks tho

wide galleon
mortal cedar
#

how can i check if an advancement is a recipe?

opal sluice
#

Hi, can we use model data (or tags) on mobs to change their models?

opal sluice
#

๐Ÿ˜ข

lost matrix
#

Only using optifine or some trickery with armor stands and textured custom items

opal sluice
#

With optifine you could do that ?

#

Cause it's not a big problem to use optifine since 95% of the players use it anyway

sharp bough
#

is there some kind of player.removePermission or player.setPermission("test", false) or soemthing like that?

#

cant find it on google

lost matrix
sharp bough
#

no wait nvm i can use LP

opal sluice
sleek pond
#

anybody know a way to get deobfuscated mc client code?

sleek pond
#

it's like optifine

#

but it works with sodium

lost matrix
rapid vigil
#
        if (sender instanceof Player) {
            Player p = (Player) sender;
            if (p.getWorld().getName().equalsIgnoreCase("spawn")) {
                Location spawn = new Location(Bukkit.getWorld("spawn"), -1075d, 80d, 96d, 179.5f, -4.2f);
                if (label.equalsIgnoreCase("kill"))
                    p.teleport(spawn);
                p.setHealth(20);
                p.setFoodLevel(20);
                p.getInventory().clear();
                p.removePotionEffect(PotionEffectType.SPEED);
            }
        } else {
            sender.sendMessage(ChatColor.RED + "/spawn is only allowed in " + ChatColor.YELLOW + "Spawn" + ChatColor.RED + ".");

        }
    return false;}
}``` It doesn't send the message "/spawn is only allowed in spawn" if player is not in the world spawn... It just sends nothing...
opal sluice
#

Well, I looked into optifine and the only thing we can change are the textures based on the monster name

sleek pond
#

what did you want to do?

opal sluice
#

Change an actual model

#

by name or tag

sleek pond
#

well

sleek pond
#

monster name is the name of the mob

#

im pretty sure

opal sluice
#

yeah, but it change the texture

#

not the model ^^

chrome beacon
#

You can change the model with optifine

#

I've done that

opal sluice
#

Doesn't it overwrite the original model ?

chrome beacon
#

Ah you don't want that..

opal sluice
#

yeah ^^' that was the point of having something dynamically showing the model from the name or a tag on the mob

chrome beacon
opal sluice
#

We can do it with items and custom model datas but not with monster unfortunately

lyric grove
#

how would i optimise this?

#

i spammed clicked the sign, anyway would i be able to make it more light weight?

sleek pond
tacit drift
#

trying to compile a plugin off github

#

Duplicated tag: 'resources' (position: START_TAG seen ...</plugins>\n\t\t<resources>... @83:14)

sick ravine
lyric grove
#

i did

sick ravine
#

-. -

lost matrix
# lyric grove i spammed clicked the sign, anyway would i be able to make it more light weight?

Sure.

  1. remove the block != null condition.
  2. Create an EnumSet<Material> that contains all sign materials. Then you call contains(...) on that instead of checking all the materials one by one
  3. Read the String from your config once in your onEnable or in the constructor of your class and call equals on that
  4. Same goes for the command. Read it once from your config when the plugin loads and execute the saved String variable
lyric grove
#

oh thank you โค๏ธ

chrome beacon
#

And maybe add a cooldown you might not want that to be fired many times in a row

heavy mason
#

Anyone have any experience using ACF? I'm mainly interested in things like efficiency as compared to using the usual CommandManager -> Subcommand format

lost matrix
# lyric grove

The heaviest part of your code are the String operations and the command that is being executed.
So you could gain some more performance by not reading the first line of the sign but to use a tag that gets created when the sign is being written.

lost matrix
heavy mason
#

Good to know

#

Thanks ๐Ÿ‘

#

Would you prefer using it in simple cases or more just for bigger plugins?

fathom timber
#

Url to a decompiler?

#

I need one

wet breach
sleek pond
#

yes

lyric grove
#

yeah it definitely did, even while spamming it

fathom timber
#

Is Sound.Click the button sound?

lyric grove
#

yeah

somber hull
#
[14:47:02 ERROR]: Error occurred while enabling BossSpawn v0.1.1 (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins\BossTest.jar
        at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:195) ~[server.jar:git-Spigot-79a30d7-acbc348]
        at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:182) ~[server.jar:git-Spigot-79a30d7-acbc348]
        at me.silentprogram.bossmob.Main.onEnable(Main.java:19) ~[?:?]
#

but

#

there is very muhc a config.yml

sick ravine
#

config.yml

#

in src

somber hull
#

awwww

#

im dumb

#

thanks

sick ravine
#

luzik

somber hull
#

cant figure it out

#

this is line 25

#

spawner.spawnCheck();

daring sierra
#

?paste

queen dragonBOT
somber hull
#

Oh ok

daring sierra
#

Get the full logs 0.o

somber hull
daring sierra
#

Oki

somber hull
#

Its a small log

#

but thats the whole thing

quiet hearth
#
        else if(cmd.getName().equalsIgnoreCase("farmtime")) {
            if (args.length >= 2) {
                try {
                    EntityType entity = EntityType.valueOf(args[0].toUpperCase());
                    int amount = Integer.parseInt(args[1]);
                    for (int i = 0; i < amount; i++) {
                        player.getWorld().spawnEntity(player.getLocation(), entity);
                    }
                } catch (IllegalArgumentException e) {
                    player.sendMessage(ChatColor.YELLOW + " (!) That is not  valid entity");
                }
            }
            else {
                player.sendMessage(ChatColor.RED + "/farmtime <mob> <amount>");
            }
        }```
daring sierra
#

what's task 2

somber hull
#

task 2?

daring sierra
#

ye

somber hull
#

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

quiet hearth
somber hull
#
        Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                spawner.spawnCheck();
            }
        }, 0, 40/*600*/);
#

im using this

daring sierra
#

It's the thing causing the error

eternal oxide
#

null pointer Main.java:25

somber hull
#

spawner.spawncheck is line 25

eternal oxide
#

then spawner is null

somber hull
#

public BossSpawn spawner;

#

at the top of the class

eternal oxide
#

thats null

somber hull
#

oh shit

eternal oxide
#

you define it but never initialize it

somber hull
#

i have to do new Bossspawn();

#

woops

quiet hearth
#
        else if(cmd.getName().equalsIgnoreCase("farmtime")) {
            if (args.length >= 2) {
                try {
                    EntityType entity = EntityType.valueOf(args[0].toUpperCase());
                    int amount = Integer.parseInt(args[1]);
                    for (int i = 0; i < amount; i++) {
                        player.getWorld().spawnEntity(player.getLocation(), entity);
                    }
                } catch (IllegalArgumentException e) {
                    player.sendMessage(ChatColor.YELLOW + " (!) That is not  valid entity");
                }
            }
            else {
                player.sendMessage(ChatColor.RED + "/farmtime <mob> <amount>");
            }
        }``` Can someone help me with this. It says out of date with version 1.16.5 spigot
somber hull
#
    public void spawnCheck() {
        
        
        if(!plugin.data.getConfig().contains("lastbossspawn")) {
            plugin.data.getConfig().set("lastbossspawn", 0);
            plugin.data.saveConfig();
            return;
        }
        if (plugin.data.getConfig().getInt("lastbossspawn") > System.currentTimeMillis() + (plugin.getConfig().getInt("secondsuntilspawn") * 1000)) {
            SpawnBoss();
            return;
        }
        
        
    }
#

this is being called every 30 seconds

#

but nothing happens

#

SpawnBoss just prints to the console rn

#
    private void SpawnBoss() {
        plugin.getLogger().log(Level.SEVERE, "Spawn!!");
        
    }
#

And nothing happens..

#

in the console

#

Its doing something as it freezes the server evry time it runs

eternal oxide
#

@quiet hearth there is nothing in that code to say out of date

quiet hearth
#

well the console ouputs it being out of date

#

ill send the console info one second

eternal oxide
#

@somber hull show your runnable

somber hull
#
        Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                spawner.spawnCheck();
            }
        }, 0, 600);
kindred solar
#

guys, why this is not working:

faint snow
quiet hearth
#

Error occurred while enabling Tutorial v1.0 (Is it up to date?) java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "me.chewie.Tutorial.Main.getCommand(String)" is null at me.chewie.Tutorial.Main.onEnable(Main.java:16) ~[?:?] at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-570] at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-570] at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-570] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-570] at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-570] at

#

net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:580) ~[patched_1.16.5.jar:git-Paper-570] at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:280) ~[patched_1.16.5.jar:git-Paper-570] at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1055) ~[patched_1.16.5.jar:git-Paper-570] at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-570] at java.lang.Thread.run(Thread.java:832) [?:?]

kindred solar
#
    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent evento){
       evento.setJoinMessage(evento.getPlayer().getName() + " entrou no servidor!");
       evento.getPlayer().getInventory().addItem(new ItemStack(Material.COMPASS));
    }
faint snow
eternal oxide
#

@somber hull you set teh lastbossspawn to zero. its never going to pass in teh next test. its always zero

subtle eagle
#

(outdated-server:
outdated-client:)

what is the difference between

somber hull
eternal oxide
#

@quiet hearth Your command is not correctly added tro your plugin.yml

eternal oxide
somber hull
#

oh shit

#

ill set it to the current time +1

kindred solar
viscid cave
somber hull
#

?paste

queen dragonBOT
somber hull
#

now im getting this...

eternal oxide
#

Is it annotated @brave glenhandler

#

it it registered as a Listener and the class implements Listener

quiet hearth
quiet hearth
#

thank you

kindred solar
eternal oxide
#

@faint snow you can;t have a class inside another class and have it work like that

round finch
#

how will i make a animated Title on a Custom Inventory?
packets? or mns?

#

i got no clue

somber hull
eternal oxide
somber hull
#

So what do i do instead?

#

If i want to access the main classes methods

fathom timber
#

How would I do the magic converter to like basic text like magic -> letter and unravels if that makes sense

eternal oxide
#

you pass teh instance when you create your BossSpawn class

somber hull
#

.

#

how?

eternal oxide
kindred solar
eternal oxide
# somber hull how?

in your Main class when you create your bossSpawn you do new BossSpawn(this);

#

and store that in teh constructor of BossSpawn

somber hull
#

I dont think it has a constructor?

#

Im still learning what constructors are lol

#
package me.silentprogram.bossmob.files;


import java.util.logging.Level;

import me.silentprogram.bossmob.Main;

public class BossSpawn {
    Main plugin = new Main();
    
    public void spawnCheck() {
        
        
        if(!plugin.data.getConfig().contains("lastbossspawn")) {
            plugin.data.getConfig().set("lastbossspawn", System.currentTimeMillis() + 1);
            plugin.data.saveConfig();
            return;
        }
        if (plugin.data.getConfig().getInt("lastbossspawn") > System.currentTimeMillis() + (plugin.getConfig().getInt("secondsuntilspawn") * 1000)) {
            SpawnBoss();
            return;
        }
        
        
    }

    private void SpawnBoss() {
        plugin.getLogger().log(Level.SEVERE, "Spawn!!");
        
    }
    
    
}

#

what would the constructor be?

eternal oxide
#
public BossSpawn(JavaPlugin plugin) {
  this.plugin = plugin;
}```
faint snow
wide galleon
#

How can I enable and disable events with a command?

eternal oxide
#

yes Hyper

#

add that to your BossSpawn class

somber hull
#

I figured it out thank you ๐Ÿ˜„

eternal oxide
#

@wide galleon you can register and deregister Listeners, but its not really advised to do so if you can avoid it

kindred solar
somber hull
#

hmmm @eternal oxide it still just does nothing, and lags the server every few seconds...

eternal oxide
#

it will lag due to you saving yoru config every 30 seconds

somber hull
#

ahhh

#

so

#

why isnt it settings the config

eternal oxide
#

To register a listener class getServer().getPluginManager().registerEvents(listener, instance);

fathom timber
#

How would I overwrite the default join message?

somber hull
#
        if(!plugin.data.getConfig().contains("lastbossspawn")) {
            plugin.data.getConfig().set("lastbossspawn", System.currentTimeMillis() + 1);
            plugin.data.saveConfig();
            return;
        }
#

shouldnt that set it to the current time +1 and never run again?

fathom timber
#

would I just use the default join event and then return null?

kindred solar
fathom timber
#

event.setJoinMessage(null);

eternal oxide
#

yes in onenable

rugged topaz
#

does getOfflinePlayer return a usable and proper uuid if the player is real/online?

kindred solar
eternal oxide
#

Hyper, yes that woudl set it to current time +1 and save teh config

kindred solar
#

like this?

somber hull
eternal oxide
#

is your Listener class called onPlayerJoin?

somber hull
#

oh

#

wait

final fog
#

quick question

somber hull
#

it is

final fog
#

Why the hell

faint snow
final fog
#

can I do this java event.getPlayer().getPlayer().getPlayer();

eternal oxide
#

@rugged topaz yes

rugged topaz
#

if it's deprecated, what's the alternative?

eternal oxide
#

its deprecated because it can perform a blocking lookup

rugged topaz
#

meaning what exactly

eternal oxide
#

if the player is online, why do you want an offline object?

kindred solar
rugged topaz
#

wouldn't know if the player is online or not

#

because it's a command run by a player

wide galleon
#

How can I enable and disable events with a command?

rugged topaz
#

getPlayer returns a null object when the player goes offline

#

getOnlinePlayer only online

#

so

#

getOfflinePlayer seems to be the only one that looks favorable towards both

eternal oxide
#

Yes you can use the getOfflinePlayer, then check if getName() is null. If its null the player is unknown

faint snow
kindred solar
eternal oxide
#

you would also need to implement LIstener

#

so extends JavaPlugin implements Listener, PluginMessageListener

kindred solar
#

my onEnable event```java
@Override
public void onEnable() {
getLogger().info("Plugin iniciado com sucesso!");
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}

eternal oxide
#

so long as your event handler is in your main class, yes

kindred solar
#

'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(me.f1nndev.my1stproj.craftplugin, me.f1nndev.my1stproj.craftplugin)'

#

then i get this error

somber hull
#
        Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
            @Override
            public void run() {
                spawner.spawnCheck();
            }
        }, 0, 600);
#

this is just completely lagging the server

eternal oxide
somber hull
#

Even though the delay is 600

kindred solar
eternal oxide
#

you are not implementing Listener

kindred solar
#

do i need to write @brave glenHandler?

eternal oxide
#

on the event yes

#

and yoru class has to implement Listener

kindred solar
#

instead of @override or above

eternal oxide
#

?paste your code

queen dragonBOT
kindred solar
eternal oxide
#

you are still not implementing Listener

kindred solar
#

oh right

kindred solar
eternal oxide
#

no

kindred solar
#

so, where?

eternal oxide
#

public class craftplugin extends JavaPlugin implements Listener{

kindred solar
#

Cannot resolve symbol 'Listener'

faint snow
eternal oxide
#

um, sec

eternal oxide
kindred solar
#

so what isnt correct in my code?

final fog
#

If I want to run something every hour in the console do I use a BukkitRunnable, or a Scheduler?

#

Should I*

eternal oxide
kindred solar
#

for now its working

#

now i iil test at the server

queen dragonBOT
eternal oxide
#

Just remember its not going to be completely accurate due to tick rate

rugged topaz
quaint mantle
#

Is there a way to get selectors? like {"selector":"@e"}

kindred solar
#

working! tysm @eternal oxide

eternal oxide
#

@rugged topaz Run all your searching code Async and compile a list of blocks you need to set to air. Then call a sync method to set them

rugged topaz
#

i'll attempt that and lyk for feedback

#

curious, by looking at it

#

it's bad or no?

eternal oxide
#

you could also just for loop over teh BlockFace Enum

#

rather than getting individual blocks for each and adding to an array

#
for (BlockFace face : BlockFace.values()) {
    Block relative = block.getRelative(face);```etc
wide galleon
#

How can I code a plugin that gives you a random status effect whenever you enter a new chunk

#

yes

eternal oxide
#

second.

#

Do you know how to use teh PlayerMoveEvent?

wide galleon
#

yea

#

well kinda

eternal oxide
#

well you need to check the getTo() and getFrom() in the PlayerMoveEvent and compare getBlockX and Z of each to see if they change. If not early return.

#

if they changed you need to check if they are different chunks using the formula (int) Math.floor(value) >> 4

floral flare
#

Does anyone know how to use PlaceHolderAPI?

eternal oxide
#

if x or z are different when passed through that, they moved chunks

kindred solar
#

How do i set an item to a specific slot and how do i rename it?

final fog
#

Is it laggy if I loop 5 offline players or something.

eternal oxide
#

depends what you are doing and iff they are known to the server or not. but it can be if they are not known

#

if they are not the method performs a blocking web lookup with the Mojang servers

final fog
#

I'm just changing their bedspawnlocation

#

and setting it to a random location

eternal oxide
#

if I were you I'd use getOfflinePlayers() and pick the ones you want

#

that will only return known players with no web requests

final fog
#

Wdym, check their uuid?

#

and put it in manually?

eternal oxide
#

no

#

if you call getOfflinePlayers() it returns an array of all players who have ever played on your server

final fog
#

How many players?

eternal oxide
#

all. so depends on your server

final fog
#

I am blind

rugged topaz
# eternal oxide ```java for (BlockFace face : BlockFace.values()) { Block relative = block.g...

doesn't this come with
NORTH_EAST(NORTH, EAST), NORTH_WEST(NORTH, WEST), SOUTH_EAST(SOUTH, EAST), SOUTH_WEST(SOUTH, WEST), WEST_NORTH_WEST(WEST, NORTH_WEST), NORTH_NORTH_WEST(NORTH, NORTH_WEST), NORTH_NORTH_EAST(NORTH, NORTH_EAST), EAST_NORTH_EAST(EAST, NORTH_EAST), EAST_SOUTH_EAST(EAST, SOUTH_EAST), SOUTH_SOUTH_EAST(SOUTH, SOUTH_EAST), SOUTH_SOUTH_WEST(SOUTH, SOUTH_WEST), WEST_SOUTH_WEST(WEST, SOUTH_WEST), SELF(0, 0, 0);
these extra values too?

final fog
#

I thought you said "who have never played on your server"

eternal oxide
#

@rugged topaz true I guess

#

I'd still recomend using an array of the BlockFaces than seperate blocks for each

#

even if you create an array of just the ones you want

kindred solar
#

how do i set an item to a name?

rugged topaz
eternal oxide
#

rather than one task per block I'd do them all at once, if not over 1000

#

also new BlockFace[] { BlockFace.UP, BlockFace.DOWN, BlockFace.NORTH, BlockFace.EAST, BlockFace.SOUTH, BlockFace.WEST };

#

would probably be better

#

You may need to move the inserting into the player inventory to sync but test that

#

If all the blocks are being tested for a Material match you should total up how many are found and do a single addItem for that amount.

kindred solar
eternal oxide
#

its in teh itemMeta

#

How do you mean use?

floral flare
#

Integrate to a cash plugin for example

#

And use on fatherboard

eternal oxide
eternal oxide
#

well you didn't ask to see which it is, only to see if it was armor

kindred solar
eternal oxide
#

@quaint mantle what exactly are you attempting to do?

kindred solar
eternal oxide
#

then put the meta back on the item or it will not apply

kindred solar
#

i type this ```java
evento.getPlayer().getInventory()

drowsy helm
#

because thats inventory

eternal oxide
#

@quaint mantle java if (event.getSlotType() == InventoryType.SlotType.ARMOR) { if (inventory.getItem(event.getSlot()).equals(yourHelmetObject)Something along the lines of

rugged topaz
eternal oxide
drowsy helm
#

material as blockface?

#

huh

eternal oxide
#

sorry, BlockFace

drowsy helm
#

oh lol

kindred solar
drowsy helm
#

you get the item in the inventory, get the item meta then set the display name

#

.getInventory() gets you the inventory

#

The docs ElgarL provided were for ItemMeta

kindred solar
#

then how do i do it?

kindred solar
sage swift
#

this is productive

eternal oxide
#
ItemStack item = inventory.getItem...
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("blah");
item.setItemMeta(meta);```
drowsy helm
#

^

sage swift
#

"but setMeta doesn't exist"

rugged topaz
#

@eternal oxide unsure why this is on the log

paper viper
#

dont copy and paste code gecko

#

lmfao

eternal oxide
#

fixed

outer sorrel
#

im trying to use the packetevents plugin/api thing but I cant find PacketPlayInPosition, I probably a blind or did something wrong

paper viper
#

what atomic basically means is like multiple threads trying to access an object right. it blocks another thread and waits for one to finish

rugged topaz
#

oh well, @eternal oxide not using log anyway and adding after, since the aesthetic is that you gain logs per broken object on time

eternal oxide
#

@rugged topaz count how many you need then pass to a final variable for your runnable to access

rugged topaz
#

?

#

or

#

wait

#

misread

eternal oxide
#

no, you run an Async to sort the blocks/count.
Then your sync runnable you make changes

rugged topaz
#

so yea two runnables

paper viper
#

use completablefuture (:

eternal oxide
#

anything you pass from your Async to yoru sync you pass into a final variable so it can access it

paper viper
#

but runnable will work

rugged topaz
#

confusing

#

but i'll see

eternal oxide
#

runnables are the simplest as its your first time

rugged topaz
#

not in regards to the completablefuture

#

not my first time either (w spigot), just haven't worked w anything like this

eternal oxide
#

Those are for when you understand threads better

rugged topaz
#

talking about everything

#

is it more optimized?

paper viper
#

yea use runnables at first

#

if you are new

#

i wouldn't say faster probably around the same speed but more functionality and useful utility methods

#

if you are like opening many theads you should consider using ExecutorService, that will definately help tho.

#

cause threads use space

eternal oxide
#

an example...

#

run all yoru code Async to count/list teh blocks then IN the same Async runnable...

        /*
         * A Future as we are Asynchronous to get the result.
         */
        Future<Boolean> future = plugin.getServer().getScheduler().callSyncMethod(plugin, new Callable<Boolean>(){

            @Override
            public Boolean call() throws Exception {
                //Do all yoru replacing of blocks here.
                return true
            }
        });
        
        try {
            // Lock NON-main thread to wait for the result.
            return future.get();
        } catch (Exception ex) {
            ex.printStackTrace();
            return false;
        }```
rugged topaz
#

do you keep autocorrecting to yoru

#

btw lmao

paper viper
#

thats a valorant agent

#

lol

rugged topaz
#

yes

#

all i can think of

eternal oxide
#

My fingers don;t move fast enough to get everything in the right order these days

paper viper
#

join the old coder gang

#

or not old coder

#

arthritus gang

#

lol

eternal oxide
#

Yeps

kindred solar
#

why there is a line over this method? ```java
getItemInHand

eternal oxide
#

like ; in my don;t. Pinky doesn't stretch quite far enough to get the '

#

getItemInMainHand()

paper viper
#

here si sany exampe of me typign fast

eternal oxide
#

identical ๐Ÿ™‚

kindred solar
paper viper
#

you need to get the PlayerInventory

eternal oxide
#

and wierdly I read that fine. At first saw nothign wrong

paper viper
#

lol

heavy mason
paper viper
#

something like event.getPlayer() to get the player. Then call getInventory() on that to get the player's inventory

#

then call getItemInMainHand() on that

eternal oxide
#

Yep, he's a little younger than me so he's just lazy ๐Ÿ˜›

heavy mason
#

๐Ÿคฃ ๐Ÿคฃ ๐Ÿคฃ

#

He said its becuase of IRCs

paper viper
#

GroupManager2 Soonโ„ข๏ธ

#

but 400k downloads damn lol

eternal oxide
#

3.0 is almost done. I just have to add the SQL code. Refactored for it, but not written it

paper viper
#

oo nice

eternal oxide
#

thats tiny. When it was bundled with Essentials it was thousands of servers.

#

hundreds of K downloads each version

#

These days its 3k servers

paper viper
#

still big

eternal oxide
rugged topaz
drowsy helm
#
                    for (BlockFace blockFace : new BlockFace[] { BlockFace.UP, BlockFace.DOWN, BlockFace.NORTH,  BlockFace.EAST,  BlockFace.SOUTH, BlockFace.WEST }) {```
can just be
```java
                    for (BlockFace blockFace : faces.asList()}) {```
eternal oxide
#

it can;t as that includeds a lot of diagonals etc

drowsy helm
#

ah right

rugged topaz
#

also removed the redundant arraylist face

eternal oxide
#

It looks fine. does it work is the question

rugged topaz
#

ig let's see

#

oh also

eternal oxide
#

sec, your future needs to be outside your amount loop

rugged topaz
#

that'd be outside the runnable

eternal oxide
#

oh ok

eternal oxide
#

I didn;t see teh scheduler in there

#

yep, test it and see if it lags/works

rugged topaz
#

well it won't work

#

because

#

the ide gives that error

#

is it meant to be outside the runnable?

eternal oxide
#

no

#

there has to be a typo somewhere. paste yoru code

drowsy helm
#

the indentation is throwing me off a bit, that return is for the asyncDelayedTask, right?

eternal oxide
#

I know the future is fine, I use that myself

rugged topaz
eternal oxide
#

I see, you don;t need to return a value

rugged topaz
#

it's a void ๐Ÿคฆ that's mb for not even noticing

eternal oxide
#

because you are inside your async task its not expectign a value return

drowsy helm
#

the task doesnt need a return

rugged topaz
#

delete the entire try/catch?

eternal oxide
#

just change teh return future.get() to future.get()

rugged topaz
#

alr

eternal oxide
#

and delete the return false

kindred solar
#

what's the diference between @brave glenHandler and @Override ?

drowsy helm
#

Override is a default java annotation

eternal oxide
#

override replaces a method in a parent class

#

as in, it overrides it

drowsy helm
#

@brave glenHandler tells bukkit that the method handles an event

eternal oxide
#

eventhandler is an annotation that Bukkit looks for to know that is an event handler

kindred solar
#

im asking this cuz my code for opening an menu isnt working

#
    @EventHandler
    public boolean onPlayerUse(PlayerInteractEvent interact){
        if(interact.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("ยงlยง6Menu")){
            interact.getPlayer().sendMessage("Entrouuu, GG");
            menuJogos.setItem(3, new ItemStack(Material.GRASS_BLOCK));
            interact.getPlayer().openInventory(menuJogos);
        }
        return true;
    }
#

if you want to help me

drowsy helm
#

what is menuJogos

#

can we see the code for that

kindred solar
#

okok

drowsy helm
#
interact.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("ยงlยง6Menu")
kindred solar
#

sry

drowsy helm
#

this may give you issues aswell

eternal oxide
#

have you registered the listener? or it it in yoru main class like the other?

kindred solar
eternal oxide
#

yep thats fine

kindred solar
drowsy helm
#

inventories can only be multiple of 9s

kindred solar
eternal oxide
drowsy helm
#

yeah it only takes 9, 18, 27, etc

kindred solar
drowsy helm
#

its overall slots not rows

eternal oxide
#

damn auto tag

paper viper
#

there is a dude literally named @urban grotto

kindred solar
paper viper
#

shame on him

#

he gets to deserve the ping

#

lol

drowsy helm
#

thats on them lmao

paper viper
#

exactly

kindred solar
topaz atlas
#

import org.bukkit.event.EventHandler;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin
{
}
public class MyListener implements Listener
    {
        @EventHandler
        public void onMove(PlayerMoveEvent event) {
            final Location to = event.getTo();
            System.out.println(to);
        }
``` It wont log anything when I move
drowsy helm
#

its not registered

paper viper
#

oh god

drowsy helm
#

and

#

dont nest classes

#

please

paper viper
#

especially in that case

eternal oxide
drowsy helm
paper viper
#

just not in this case

drowsy helm
#

just not good practice in that case

rugged topaz
#

java.util.ConcurrentModificationException is called on the for (Block block : blocksToRemove) { in the Future @eternal oxide, the tps seems to (on average) better than before, only a 0.04 dip per execution for a second or two, compared to 0.09-0.12

paper viper
#

you can actually create classes in methods

#

enums in enums

topaz atlas
#

So what exactly do I have to change

drowsy helm
#

so first off

paper viper
#

just so much

#

lol

drowsy helm
#

make the two classes separate files

#

so Main and MyListener as separate files

eternal oxide
rugged topaz
#

well ๐Ÿคท that's the stacktradce

#

it works fine

#

wouldn't notice anything if u were a player

topaz atlas
#

import org.bukkit.event.EventHandler;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public class Main extends JavaPlugin
{
}
public class MyListener implements Listener
    {
        @EventHandler
        public void onMove(PlayerMoveEvent event) {
            final Location to = event.getTo();
            System.out.println(to);
        }
```?
#

this

eternal oxide
rugged topaz
#

a thing i've noticed is that sometimes the blocks break in sets of 2/3 each, rather than each block every tick or so, might have to do in correlation to the stacktrace error

#

^ which isn't a desired effect

topaz atlas
#

buoobuoo?

drowsy helm
#

no completely separate files

topaz atlas
#

Ok done

#

Is that all?

paper viper
#

nope

#

so much more

topaz atlas
#

Dont I need to like run the class

drowsy helm
#

you also have to register it

topaz atlas
drowsy helm
#

and create an instance of MyListener

paper viper
#
  1. add an onEnable method in your plugin class
#
  1. create an instance (as said above), and register it
#

using getServer().getPluginManager().registerEvents(this, new MyListenerThingy());

#

where

#

this refers to the current plugin instance

#

and

#

new MyListenerThingy() refers to the listener instance

#

i typed that from memory, so idk if the method names are correct

eternal oxide
#

@rugged topaz are you running this with an amount more than 1?

rugged topaz
#

wdym?

#

only being run once

eternal oxide
#

you have a for loop that can spawn multiple Async tasks

rugged topaz
#

(every time i break a block)

#

o

#

no

#

the amount is 15

eternal oxide
#

thast why

rugged topaz
#

so that it breaks 15 blocks in a link

topaz atlas
#

So register the listener inside the onEnable event?

eternal oxide
#

you are runnign multiple tasks at teh same time on teh same blocks

topaz atlas
#

Pulse?

paper viper
#

Yes

eternal oxide
#

move teh for loop inside teh task

paper viper
#

i love it when devs use teh

#

lol

#

really shows how bad we are at typing english

#

compared to code

#

๐Ÿ˜”

eternal oxide
#

Imagine what code will be like in 10 years when IDEs adapt to the new language

rugged topaz
#

instead of i, i'd use..?

#

drk how to refractor this code, sorry, wrote it a while ago and was buggy never looked back

paper viper
#

/s

eternal oxide
#

and HKs

paper viper
#

Yes

topaz atlas
#

@paper viper isnt it the other way around according to the docs? like getServer().getPluginManager().registerEvents(new MyListener(), this);

paper viper
#

i may have mixed that up

#

if that is the case

#

then flip flop it

eternal oxide
#

@rugged topaz your current code looks like it runs until it runs out of compatible blocks, not by the counter

rugged topaz
#

so i wouldn't be able to move the loop into the runnable?

eternal oxide
#

you shoudl be able to delete teh first for loop

#

its just running the same code 35 times adn doing nothign other than causing a cme

rugged topaz
#

but then i wouldn't be able to call the amount of blocks i'd want removed

#

which is what the loop is for

eternal oxide
#

teh loop is not working. if you want to limit the blocks broken, add a check after the blocksToRemove.add(nearbyBlock);
if (blocksToRemove.size() >= amount) break;

deft sedge
#

I am having a problem with some code, I have code and error

#

Error:

#

I think taht code is what the error is mad at

kindred solar
#

i think

rugged topaz
#

i'd assume just 1

eternal oxide
#

long?

rugged topaz
#
              ex.printStackTrace();
            }
        }, i);```
#

the i

deft sedge
eternal oxide
#

no need to delay it

#

just an async task

deft sedge
#

it says that the things with my string to boolean or whatever conversion is the problem

rugged topaz
#

o okay

#

let's see

kindred solar
deft sedge
#

sorry

#

o god ya

#

i c what u mean

#

lemmie try to make it bigger

#

my server is restarting

#

ill show u again

eternal oxide
#

its text, just copy it

deft sedge
#

yea

#

ill do that

eternal oxide
#

?paste

queen dragonBOT
rugged topaz
#

@eternal oxide breaking a block only deletes 1x of the faces connected to it, rather than 15

#

here's updated code

deft sedge
eternal oxide
#

ah I see

#

line 10 is looping over a preCloned list. Change that to a while(!blocksToCheck.isEmpty())

deft sedge
#

that's not english

eternal oxide
#

you cna scrap the preClonedList then

#

@quaint mantle Try using the getCurrentItem()as thats the one thats clicked. You would also have to check the slot to make sure its being put on and not removed

kindred solar
deft sedge
#

yea the command works fine

#

the eror is based arround my method of converting book string to float

kindred solar
#

you may send the code to here to everyone can help you

#

?code

deft sedge
#

i did i send again sorry

kindred solar
#

?paste

queen dragonBOT
kindred solar
#

paste the code on this website

#

then save and send the link again to here

deft sedge
#

there

#

thx

kindred solar
#

Some1 already has this weirdy thing?

rugged topaz
eternal oxide
#

you already added the block to blocksToCheck. you grab it from there adn then remove it

deft sedge
#

@kindred solar did u get code?

eternal oxide
#

so get the first entry

kindred solar
deft sedge
#

k tell me if u dont' understand something

eternal oxide
#

@rugged topaz that way as you add blocks to the list it keep the loop going.

#

currently it checks a single block and exits

rugged topaz
#

o okay

#

to get the first entry?

#

.get(0)? i'd assume ur talking about something else

eternal oxide
#

get(0)

rugged topaz
#

just validating with you

#

is that correct?

eternal oxide
#

change teh remove to 0

#

well n

#

you can keep it as block, thats fine

rugged topaz
#

works either way lmao

eternal oxide
#

the only part thats probably not workgin yet is your leaves

rugged topaz
#

if anything

#

it doesn't break any connecting blocks

#

prints no errors

#

but my ears are being spammed with the custom XP level up

kindred solar
rugged topaz
#

it's adding +25 xp per tick

#

i believe

deft sedge
#

ook

#

i will

#

but I don't think that's where the error is

#

tha tpart works

#

it detects if it is book or not

#

i think it is in line 12 and 13

eternal oxide
#

ok one sec, let me see if I can simplify this

deft sedge
#

ill brb

kindred solar
#

idk so

kindred solar
deft sedge
#

waht is some1

#

or is it another person

kindred solar
deft sedge
#

yea

#

ok

#

do u have any ideas?

kindred solar
# kindred solar some1?

resolved, in my code i has evento.getPlayer().setDisplayName("ยง8[ยงfMembroยง8]ยงf" + evento.getPlayer()); instead of evento.getPlayer().setDisplayName("ยง8[ยงfMembroยง8]ยงf" + evento.getPlayer().getName());

kindred solar
deft sedge
#

yea

kindred solar
#

tbh i started today, so i cant help you that much, sorry

deft sedge
#

o

#

ok

#

anyone else have Ideas for mine?

eternal oxide
deft sedge
#

@eternal oxide do u have ideas for mine?

eternal oxide
#

Sorry I didn;t see your question

topaz atlas
#

The IDE I am using recommended I add this getServer().getPluginManager().registerEvents(new MyListener(), (Plugin) this); the (Plugin) part

#

Will that ruin the plugin or

rugged topaz
deft sedge
#

@eternal oxide do u have time to look it fine if u don't

eternal oxide
#

it will work, but its not needed, if the class you are in extends JavaPlugin

deft sedge
#

ill retype question

topaz atlas
#

import org.bukkit.Location;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.event.Listener;

public class Main extends JavaPlugin {
    public class MyListener implements Listener {
    @EventHandler
    public void onMove(PlayerMoveEvent event) {
        Location to = event.getTo();
        System.out.println(to);
    }
    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(new MyListener(), (Plugin) this);
    }
    }
}
``` It also recommends me to remove the `@Override`
eternal oxide
rugged topaz
#

well

#

that's not the desired / intended result ๐Ÿ˜

topaz atlas
#

Do I need to remove it

rugged topaz
#

if i reverted that, would that remove an optimization?

#

if so, a big one?

eternal oxide
#

you want each block to break with a delay?

rugged topaz
#

mhm

#

or, as the original

#

so it broke each block in an animation sorta

deft sedge
#

?paste

queen dragonBOT
eternal oxide
#

ok, one sec then

rugged topaz
#

going from the epicenter (the original broken block) rippling out to every face and block connected to that up until my amount is met

#

and not only that but i've noticed some strange behavior

#

if i break a single block, not connected to anything, it also breaks 3 blocks that ARE connected to one another, but not connected to the single block that i broke

#

which i don't think happened before

#

unsure what the cause could be

#

looking at the code and i don't see anything

deft sedge
#

I think the error is under integer.parse

#

Any ideas?

eternal oxide
rugged topaz
#

i'll check it out :)

paper viper
#

yea its prolly too complex

rugged topaz
#

apparently the syncmethod is missing a return ?

eternal oxide
#

@deft sedge which is line 42?

deft sedge
#

?

rugged topaz
eternal oxide
#

in your command

#

yepo, sec

deft sedge
#

42 says int Thirst = Integer.parseInt(thirst);

#

it is supoosed to turn the string under var thirstRAW into an int and store int to Thirst

eternal oxide
#

@rugged topaz change callSyncMethod to runTask

#

@deft sedge the value its seeing is "0.0" not an integer

kindred solar
#
    @EventHandler
    public boolean onPlayerUse(PlayerInteractEvent interact){
        if (interact.getAction() == Action.LEFT_CLICK_AIR || interact.getAction() == Action.LEFT_CLICK_BLOCK) {
            if (interact.getItem().getItemMeta().getDisplayName().equalsIgnoreCase("ยงlยง6Menu")) {
                interact.getPlayer().openInventory(menuJogos);
            }
        }
        return true;
    }
deft sedge
#

ok

kindred solar
#

not working

deft sedge
#

ohhhhj

kindred solar
#

cant fix it

deft sedge
#

@eternal oxide I need to convert that string to an integer

eternal oxide
#

read it as a float first

#

then convert to int

deft sedge
#

the problem

#

is that it gets this data from a book

#

and in a book this data has to be a string

#

@eternal oxide

eternal oxide
#

well what its seeing in teh book is 0.0

#

is it typed as that?

deft sedge
#

ill show

rugged topaz
deft sedge
#

does it not work if it 0.0

eternal oxide
#

ok it is 0.0

kindred solar
eternal oxide
#

you need a method that will try to fetch a float first, if it fails fetch an int

#

or, check the string for a decimal point

deft sedge
#

ooooo

#

ok

#

i see

#

so is there a way for me to remove the decimal

#

wait

#

i might be able to just make it in int

#

i'll try that

eternal oxide
#

Float.parseFloat(String).intValue()

kindred solar
eternal oxide
#

yes, thats the one thats clicked