#help-development
1 messages · Page 1983 of 1
Then you’re unlikely to get a great computer science course load, even universities are struggling to find competent CS faculty
im not gonna do universities
cuz cost much
lel
Then you’ll pretty much have to teach yourself
Google is your best friend
Because you’re not gonna learn very much in a high school CS course
im still an 15 kid so i have time to learn sht
self taught myself starting at the age of ~11 ezpz
imagine using bing 😂
is there any way to figure out what plugin it is without knowing it?
on a general server?
huh
take a guess
no there isnt unless someone didnt block the dump commands and plugins commands
it does not work
i dont know if spigot has a dump command
code?
Ya it does :p use chatcolor.of
yes sir is bad
on a server there is a plugin but idk the name. so i want to understand it
it is?
calculator
I taught myself at about 13
that crazy
well if u have permissions -> /plugins
CS moment
i didn't need it before :(
the server isn't mine
Huh? U sure bru
then ask the owner
For hex you need it
ok, but i don't have
because i want to insert in my server
what does it do
wait a moment
tbh i search thing for skid- i mean took the code and understand what do, but i find only ppl talk about the thing and i cant skid- i mean took the code D:<
i don't speak english so waait a moment
huh
hmm
naming conventions tho
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerChat(AsyncPlayerChatEvent e) {
Player player = e.getPlayer();
PlayerInfo playerInfo = new PlayerInfo(player);
LuckPerms luckPerms = LuckPermsProvider.get();
User user = luckPerms.getPlayerAdapter(Player.class).getUser(player);
String prefix=user.getCachedData().getMetaData().getPrefix();
String suffix=user.getCachedData().getMetaData().getSuffix();
if (!e.getMessage().isBlank()) {
e.setFormat(prefix +" "+player.getName()+suffix+ " §f » ");
for (Player players:Bukkit.getOnlinePlayers()){
e.getRecipients().remove(players);
if (e.getMessage().contains(players.getName())&&!players.equals(player)){
players.playSound(players.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP,1.0F, 1.0F);
}
players.sendMessage(ChatColor.translateAlternateColorCodes('&',e.getFormat() + e.getMessage()));
}
}
}```
mans writing C# conventions in java
in this plugin you can create armors that give advantages (translated via google translator)
i need to make a local database in .db format
and once again. i would not even use a var boolean but if you really want to use one, use the primitive type instead of the wrapper
and what are u trying to do
how to do?
in this plugin you can create armors that give advantages (translated via google translator)
No @quaint mantle
You can’t assume the shooter is a player either
You can’t cast without checking
Or a dispenser
Or a Ghast
If you cast without checking it will also error
I'm trying to make the hex color of the prefix and suffix color
You have to check with instanceof first @quaint mantle
in this plugin you can create armors that give advantages (translated via google translator) pls help
@maiden thicket
Currently it remove "§#" but it does not put the color
why do people clone itemstacks?
this link doesn't work
it works fine for me
make sure you login as its premium
So I got small problem I noticed storing player object to my BeastPlayer class
got some weird results for exampel I try to access player inventory and there diffrent result
then from Bukkit.getPlayer
Why are you modifying the cancelled status at all if it’s null
if inventory get changed there is no changes to player object in BeastPlayer class
should I not store player object
it that bad practice
I thing then I am better just with storing uuid
Return or just do nothing
always retrieve it lazily using the uuid
ur importing the wrong thing i believe
use bungee's chat color api
not bukkit's
and making method getPlayer in side class which will run Bukkit.getPlayer(uuid)
SpigotMC - High Performance Minecraft - Error
You do not have permission to view this page or perform this action.
i use the bungee's chat color api ^^'
for example yes
oh
i have an account but it doesn't work
?
k
but translating &
have you another pl?
@tall dragon I was reading on forum that it is ok to store Player object
so got confused there
its ok but not good practice
It’s fine as long as you clear the reference when the player disconnects
in my case object stuck and dosent notice changes
anyone have a pl with this description? "in this plugin you can create armors that give advantages (translated via google translator)"
ok I get it
As long as you remove the reference when the player leaves it’s fine
In some specific cases. But generally dont do it
have u another pl?
Thanks for info
No
SpigotMC - High Performance Minecraft - Error
rip
login bro
i just loggined
make a new account if it doesnt work
oh my god
click forgot password if it doesnt work
You do not have permission to view this page or perform this action.
Did you verify your email?
🦧
Idk new accounts might not be able to view premium
You have to verify your email
lol sorry
Like every other internet site
k
kk
what version are u on
1.17, and i've test in 1.17.1 but before i does have this problem
no, but is a good pl
U can probably view the one i sent u as well now
THANKS
it's like taht
my libraries ?
imports
not equal but is similar
was just going to say that :C
this is how i did it, it works with the format #ff0000Hello there!
https://github.com/FourteenBrush/MagmaBuildNetworkReloaded/blob/f85ace88fcdffb4556b3af885a9826af7b5058cf/src/main/java/me/fourteendoggo/MagmaBuildNetworkReloaded/utils/Utils.java#L19
so no § before it
hi im making a mod for client and a plugin for spigot, and im having problem with spigot one
surround what in parentheses
public void onEnable() {
getServer().getPluginManager().registerEvents(this, this);
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "meteorclient:main");
}
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
getServer().getScheduler().runTaskLater(this, () -> {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("moduledisable");
out.writeUTF("{\"modules\":[\"packet-canceller\"]}");
e.getPlayer().sendPluginMessage(this, "meteorclient:main", out.toByteArray());
}, 5);
}```
the hex code
im not receiving it at all
uhn mo
on my client i only receive brand and register
o
are there a free version?
this is an example: "#83c916You left the channel {0}"
you are trying to get the server to unload a module on the client?
disable*
good luck
@vestal moat I believe you have to register the channel for the player too
That is not how server-client works, you can only ask the client to do something and in almost all cases it will ignore the request. So the fallback is disconnecting them on the serverside with a message.
It appears you’re correct
That’s probably the issue then
Many mods will support servers doing this
If that were true, then the anticheats would use it
the client is for anarchies not to hack on minigames and stuff
on anarchies you can limit dangerous hacks
thats what im doing
Clients that are trying to get approved by servers to use will usually support this functionality so servers can turn disallowed things off
A hacked client is never going to be approved by a server so it wouldn’t support it
anarchies do approve them
why is there no getFloat in FileConfiguration
The only one that I am aware of that works that way is badlion when you install the anticheat on the client computer
In the same way that a hacked client is going to send a vanilla brand but a legit client sends a modified brand
but they wish to limit them, for example flight could be so fast that it could kick you, it could be better if client didnt even increase speed from the first place
Clearly the mod they’re working with intends to have this feature, that’s why they’re asking about it
Could not find org.spigotmc
1.17-R0.1-SNAPSHOT.
ok
why is gradle not resolving spigot
but resolves spigot api
i wanna use nms rn
did you run buildtools
You have to use buildtools
on that version
Spigot can’t host spigot in a publicly accessible way
when an event happens, say BlockBreakEvent, and someone breaks the block below them (they start falling into a hole underneath that block they broke) and i use setCancelled(), will it tp them back up to that block after it replaces it or will it keep them falling
The movement never happens because the break is cancelled
As far as the server is concerned the block was never broken so there was never empty space to fall into
And therefore the server will just autocorrect the movement
bruh
instanceof BlockProjectileSource
what do you want to achieve tho
and how do you know that dispenser is property of that same player
unless you want to remove all damage to players from dispensers
can someone help me with lombok getters? im trying to get values from a config using a library and its just throwing null exceptions and invocation exceptions. basically im creating a getter class that will return values from the config, but its currently returning null
No, the shooter can be a block
getShooter() returns a ProjectileSource, which can be one of many things
Of which includes BlockProjectileSource
can you get the gameprofile of someone who has never visited your server?
I have some names, I just need to grab their skin and use that. I need a gameprofile for that
thx, I'll try that
my getter is returning null, im using lombok
before the screenshot is just more private finals, and it has a static Config config and @Getter for lomnbok
but none of those values are returning anything
my paths are correct
Maybe just no Lombok, like don’t use it (=
alr is there an easier way? because i dont wanna have to type the string path evey time i need a config vaule
every* value*
Could basically write out the getter instead
Well depends on how your infrastructure looks like
well its not too complicated, its pretty much just the normal bukkit fileconfiguration
but its annoying having to type the path
Btw you probably want to avoid letting that input stream be there forever
Looks like a leak
try (InputStream in = …) {
}
Yes that one
Use try with resources
Or at least invoke ::close on it
alr
one sec
erm
the /config.yml is in my plugin files
it doesnt throw FileNotFound or anything
okay yk what maybe typing out the path is easier ._. ill try getters for 30 more minutes and if i cant find anything i will just type the path
Could use my config manager
You don't have to manually save or load anything
so
It does it all for you with just a few method calls
It puts config values into fields
does it support just yaml or
Yes, though you can join those if statements.
toml etc
And it can automatically deserialize complex objects
and does it keep comments
It's yaml only but you could easily adapt it to toml or json
alr
Yes it supports comments
sounds neat
can you give an exmaple?
of how you would setup
and get values
and set them
There's really no way to do that. A dispenser could fire randomly as well, doesn't have to be from user input. e.g. a redstone clock. Or a comparator. Or a daylight sensor
will i be attacked if i ask a very brief nms question 🥺
no
did mc just say go away to transaction packets
in 1.17
simply cannot find where they were remapped to
Yeah that's probably fine
@ConfigMappable
public class Config {
public static int num = 5; // 5 will be the default value
@Comment("stuff") // adds a comment in the config file
public static Map<Material, List<String>> map; // it will automatically determine how to convert this
}```
Basic example
Chestplate, yeah
I can give you the wiki article if you want a full tutorial on how to use it
PlayerInventory should have a getChestplate() method iirc
What's the CoinfigurationSection method to get an array from config?
I used a class with static fields in this case but you can also use an object
so how would i get that value in my code
You would just access the fields
just like Config.num
Yup
ok cool
can i import my own config tho
There's the guide
i have a file already
Is this even an array:
messages:
- "BLA"
- "a"
- "lmfao"```
its a string list
im fairly sure
idk
The config manager doesn't have any methods for that but nothing is stopping you from just checking if the config file exists and saving the default if not
betbetbet
But the idea is to not need that
Just put all the default values in the fields and it will generate the default config as needed
No
Hello folks. I feel like im extra stupid today. I am tryna make something start when 2 players are inside the server. so I used Bukkit.getWorld(e.getPlayer().getWorld().getName()).getPlayers().size however when I make it equal 2, it requires a third person joining to trigger the event. So I tried it with equals 1, and that only lets 1 player in, but it starts the event. What am I missing?
No but you can do .getType() on ItemStack
^^
I've a feeling getChestplate() is nullable though
it is
ItemStack chestplate = player.getInventory().getChestplate();
if (chestplate != null && chestplate.getType() == Material.ELYTRA) {
// do your thing
}```
if(p.getInventory().getChestplate().getType() == Material.ELYTRA){
no u ad .equals
had*
if (Optional.ofNullable(player.getInventory().getChestplate().map(ItemStack::getType).orElse(null) == Material.ELYTRA)```
anyone got an answer to my question though?
😎
@EventHandler
public void onLogin(PlayerLoginEvent e) {
World world = e.getPlayer().getWorld();
List<Player> players = ((World) world).getPlayers();
Integer size = players.size();
if(size == 2) {
e.disallow(PlayerLoginEvent.Result.KICK_FULL, "server is full");
Bukkit.broadcastMessage("Starting game!");
System.out.println(playerList);
GameStart.Start(playerList.get(0), playerList.get(1));
}else{
e.allow();
playerList.add(e.getPlayer());
}
System.out.println(Bukkit.getWorld(e.getPlayer().getWorld().getName()).getPlayers().size());
}```
getOnlinePlayers*
wow i hate that
Are you sure you don't want PlayerJoinEvent
smarter than me
Why though
no I dont want them joining if its got 2 players. I dont really want to kick the player after joining
because optionals are ugly in return values most of the time, but they're even uglier in direct calls :((
would PlayerJoinEvent work better though?
But it can save a ton of null checking boilerplates
16
Optionals looks mich nicer rather if(smth == null)
what packet is sent to the client for item meta?
LORE((a, b) -> Optional.ofNullable(a.getItemMeta()).map(ItemMeta::getLore).equals(Optional.ofNullable(b.getItemMeta()).map(ItemMeta::getLore))),
This used to be like 10 lines
Yeah that definitely doesn't look nice 
It's a bit ugly
lemme try playerjoinevent
That's one of the least readable things I've seen in Java lol
It was a preview feature then and you werent able to use it without a flag
But preferable to 10 lines of just null check after null check
So I prefer it
I wonder if it would be simpler with a stream
Yeah, 14 preview. 16 release. My bad.
https://openjdk.java.net/jeps/394
Probably not lol
bunp
still only starts the game when 3 players join
Use Objects#equals
it scrolled past ;-;
have anyone the pls "ecoarmor"? can you upload to me pls?
this is the place for development help, not cracked plugins lol
@Auxilor
@worldly ingot https://www.spigotmc.org/resources/premium-vanish.100369/ pretty sure this is a repost. idk if u go about these tho
Also, pretty sure that that plugin is open source
no only for dm after i do you can remove
Yep it is https://github.com/Auxilor/EcoArmor
I have no idea why you want to get a copy of that plugin from a potentially unsafe source if you can just compile it yourself
but there aren't java pl
sry for my english
how? sry
It's just as easy as installing https://adoptium.net/ and invoking ./gradlew build or something.
It probably requires NMS
without "."?
You probably shouldn't use that plugin then
k
How can I do area damage?
if i run somethjing once, can i change that value manually and get the value?
will it update i mean
what exactly do you mean there?
for instance if i initialize a variable like
public int number = config.getInt("testpath.int");
and then i change it in my config, when i get the value like
System.out.println(String.valueOf(TestClass.number))
will it update
since im getting a path
or will it not change because its not getting the path again?
it will not update
rror: cannot access PacketLoginInCustomPayload
import net.minecraft.network.protocol.login.PacketLoginInCustomPayload;
how can i fix this
primitives do not denote a reference
gradle is too annoying
is there a reference to server specific protocol changes in 1.17 anywhere
genuinely think mojang just did away with transaction packets
and im bout to be sad
unless spigot remapped them somewhere
https://wiki.vg is probably your friend there
well, march 10th is coming
Anyone have any experience with LibsDisguises?
Hi
I'm trying to serialize/deserialize ItemStack (red_sand here) and I get this error ```java
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
->net.minecraft.world.level.block.BlockSand["E"]
->net.minecraft.world.level.block.state.BlockStateList["b"]
-> ............. and it is infinite ..........................
my method is just ```java
public static String itemStackToBase64(ItemStack itemStack) {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);
// Write the size of the inventory
dataOutput.writeObject(itemStack.serialize());
// Serialize that array
dataOutput.close();
return Base64Coder.encodeLines(outputStream.toByteArray());
} catch (Exception e) {
e.printStackTrace();
}
}
Alright guys
my brain isnt working and I think theres an easy solution to this
if(size == 2) {
e.getPlayer().kickPlayer("Lol");
Bukkit.broadcastMessage("Starting game!");
System.out.println(playerList);
GameStart.Start(playerList.get(0), playerList.get(1));
}else if(size < 2){
playerList.add(e.getPlayer());
size++;
}```
I need to get the game to start when the player count (size) reaches 2
however it only checks if its 2, when a third player attempts to join
since we only want two people joining, obviously needing a third to join isnt good
what do I do in order for the game to begin as soon as a second player enters the server
what is playerList
its the list of players that are gonna be partaking in the game
so you only want 2 people, then just if there are 2 people, don't add them to the list
well see. When the first player joins. The player count is 0, so the if statement skips to the "else" statement
same goes for the second player
since size is 1
it skips to else
now we are on 2
PlayerJoin
I tried using playerlogin
same result
see this is why
I come here
why didnt I think of this
The docs don't have anything, but does the respawn (or the spawn event) event get called when a player logs in?
Bukkit.getScheduler().scheduleSyncRepeatingTask(instance, new Runnable() {
@Override
public void run() {
hitground.put(p.getUniqueId().toString(), 0);
while (hitground.containsKey(p.getUniqueId().toString())) {
if (p.isOnGround()){
p.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 100));
// p.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 40, 0));
Location location = p.getLocation();
World world = p.getWorld();
List<Entity> nearby = p.getNearbyEntities(4, 4, 4);
for (Entity tmp: nearby)
if (tmp instanceof Damageable)
((Damageable) tmp).damage(15);
world.spawnParticle(Particle.EXPLOSION_LARGE, location, 10, 1, 1, 1, 1);
hitground.put(p.getUniqueId().toString(), 0);
}
}
Anyone know why this code would stop my server lol?
It has something to do with the while loop
probably an infinite loop?
i dont see you removing the player from hitground
Why do you use string instead of the actual uuid object btw
I can send all the code
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Why are you passing -1 as interval?
why are you scheduling a task with -1
yeah
that's the period to repeat
so -1 means it will never run lol
And why nested tasks
Not true
I'm pretty sure anything less than 1 is treated as 1
Wait
hitground.put(p.getUniqueId().toString(), 0);
hitground.remove(p.getUniqueId().toString());
also that
I know 0 is treated the same as 1
Oh yeah I think you are actually right
-1 means no repeat
Scheduling a delayed task just schedules a task with a period of -1
I'm just guessing negative time would just never run
ah
Yea its -1 so that it does it once
And idk how else to do the schedual
Is that the cause of the server stopping?
i mean, you should have some kind of error or thread dump if the server just stops
where you can find out what exactly is the problem
k il do that
Schedule a delayed task rather than a repeating one
I mean the outcome is the same but it's more explicit in its purpose if you use the dedicated method
how :P
BukkitScheduler#scheduleSyncDelayedTask or runTaskLater
Just a thought that popped into my head
Can I make a plug-in like as a joke that literally just gives specifically me op
And put it on spigot?
As long as I say that’s what it does?
Thats just force op
Probably
I think it would not be allowed even when stated what it does
Idk I just thought of it lol
Why would you even want to put that on spigot
You’re not the first person to think of it and wouldn’t be the first person to do it
Or wait
¯_(ツ)_/¯
What about blacklisting specific people from using your plugin
Is that allowed?
Off the top of my head say if someone stole your plugins and made YouTube videos for them
Could you make it so that username can’t excel Ute commands?
Or would that be against the rules?
It looks like it printed it at the end
I dont understand :(
I mean, i dont think there is a rule against it.
Is it a npe?
Well this is something about dynmap
Does it say null?
Help
@quaint mantle join the thread
Whats meteorslamlistener line 45
but why?
IsOnGroudn is depreciated
Is it through the paper api?
That woulnt matter tbh
No
There’s gotta be an alternative..
Hover over it and see the depreciation message
@fossil lily add a hard limit. Then start with some debugging
If you want to be accurate
Not in all cases
Yea but I’m most cases
The isonground is one of those cases where you shouldn’t use it
But
Not the end of the world if you do
I mean for plugins like anticheat. No you shoulnt use it. But for a simple cosmetic effect. Why not?
Idk I wasn’t paying attention to what he was making
Oh really thanks. I didnt know it was that simply
I still wouldn’t
F
Glad you fixed it
What problem do you have? i can help you
I mean thats your choice but i dont see any problem in this case
Why a constructor on main class?
Very minor visual glitches
If the player Desyncs it could cause the effect to bug out for a second
Perks of being new/bad at java*
Hmn? i didnt understand
He’s probably new and copy pasted someone’s stuff from a non main class to a main class
If your not new then no copy@paste angry
😡
Oh ok
Lmao i would never do that
I remember a friend injected a spywhere on his pc because he copy-paste a project from github and executed on his pc
For Player#isOnGround(), it's not a "avoid using, there's an alternative". It's just a warning saying that you should not rely on it as the client can spoof the value and lie to the server
You can use this method. You will achieve the same effect as looking at the block below the player
Remember, deprecated doesn't always mean removal. Use at your own risk, check the deprecation notice
Alr
aight please dont hurt me for asking this 🐶 || how do you set a hard limit?||
dont read it if you're mean
You could count a number upward every time it loops and stop at a certain number
Why not make an api or library they all use
What do you mean by hard limit?
@proud basin in his while loop
Cons would be large file size if shaded or separate dependency plugin.
ah
So I'm using a session connector with DriverManager to get the connection but for some reason I'm getting access denied for user even though all of the info is correct. What is weird about this is that I do it this way with other projects but for this one it doesn't like it. java connection = DriverManager.getConnection(String.format("jdbc:mysql://%s:3309/%s?useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=CET"))
AM I STUPID
What?
That should set a hard limit right?
yea, thats a very short one but sure
ye
IT STILL
CRASHED
its not an infinite loop error
i dont think thats the problem
uGh
increment i outside p.isOnGround
indeed
so now I need to find the error?
so bassically you want to detect when a player hits the ground & perform some actions correct?
that is correct
so you understand why your server was crashing right?
Not really :P
well bassically either p.isOnGround never returned true on time before it crashes
this is why you dont use a while loop
What would be a good replacment?
i used to do this with a repeating runnable on 1 tick
i can send you a method. but you're not gonna be able to directly copy me and i don't want you to. as im using some of my api methods to achieve it. but you can easily make it work for your case
Okay
/**
* Runs a timer task with the tick period of 1 and will trigger your hit listener
* when the given entity isOnGround. If the entity gets removed before it hits
* the ground, nothing is called
* <p>
* The fly listener is called every tick
*
* @param entity
* @param timeoutTicks
* @param flyListener
* @param hitGroundListener
*/
public static void track(Entity entity, int timeoutTicks, Runnable flyListener, Runnable hitGroundListener) {
if (flyListener == null && hitGroundListener == null)
throw new FoException("Cannot track entity with fly and hit listeners on null!");
Common.runTimer(1, new BukkitRunnable() {
private int elapsedTicks = 0;
@Override
public void run() {
// Cancel after the given timeout to save performance
if (elapsedTicks++ > timeoutTicks) {
cancel();
return;
}
// Cancel when invalid
if (entity == null || entity.isDead() || !entity.isValid()) {
if (entity instanceof FallingBlock && hitGroundListener != null)
hitGroundListener.run();
cancel();
return;
}
// Run the hit listener
if (entity.isOnGround()) {
if (hitGroundListener != null)
hitGroundListener.run();
cancel();
} else if (flyListener != null)
flyListener.run();
}
});
}
now i know this might be close to spoon feeding. but you're still gonna need to figure some stuff out on your own.
Is the maven updated for 1.18.2, if there even is a build for it yet idk
hM
any questions?
yea, but i would really like you to fully understand this. else i might as well have made it for you.
you know you could just check javadoc yourself
javadoc is your friend
i mean, if you want to check if the whole inventory contains an itemstack of type elytra, yes
yea, then this check should work fine
No…
@quaint mantle @tall dragon unless I’m incredibly stupid
The inventory is a list of ItemStacks
So you would have to check if it contains the item stack new ItemStack(Material.ELYTRA)
And even then, if the name is changed or it has any NBT data then that wouldn’t work
You would have to loop through the inventory and check if the material is elytra
Thank you
I must be 😔
How I can check if player be on ground?
Yea I shouldn't use this method but what method is good?
that really depends on your use case
In my case this method don't working 😅
how about you share your case then
I want check it in PlayerMoveEvent
okay... that doesn't give me much information
what would be the best way to have like a 5 second timer per player?
I must check Localization getTo()
Bukkit scheduler
what ru trying to achieve as end result
how would i use that in terms of making a command having a 5 second cooldown?
you don't need a scheduler for command cooldowns
I need check if player land on ground in PlayerMoveEvent
yes. but why.
A yea you have right
Hi guys, excuse me i made a simple plugin just to test if it was working in the server. After that i deleted it from the Plugins folder, but for some reason it still working .-.
I mean, this is probably the most important information but I want check if Player land on ground to teleport player
did you restart the server
well then i see no reason why Player#isOnGround would not be working
then the plugin is still present in your plugins folder
I think do you have copy of your plugin (someone how I before )😅
where did u had that copy? in a a different location other than /plugins/ ?
This method check player on ground in getFrom() I need check getTo()
No no sometimes in missclick you can create copy your plugin in /plugins folder 😅
ah so you need to check if the player is going to be on the ground
all the isOnGround method does is check if there is a solid block under the player
so just do the same
but for getTo()
How do you guys restart your server? just close the terminal o u do something else
It is bad idea (slab stairs fence etc.)
why would those blocks result in a different outcome.
This blocks have other hitbox
does it have to be this precise?
well i think you could also shoot a ray downward untill it collides with something and check its length
anyone know how i could make it so i could have a command on like a 5 second cooldown
have a map with uuids of players & the time their cooldown started. then you can just calculate wether or not they are still on cooldown when they perform the cmd
Yea
you could try this.
I don't trust it
well i don't think there really exists a reliable way to achieve your goal
is there a way to make the fish bite the hook faster?
hey does anyone know how to get the two items to be combined from the PrepareAnvilEvent
get the item 0 and 1 from the inventory
ah ok thanks
i thought it would be a method like getResult()
inventory from here
getResult() gets the end item, but if you want to get the 2 middle items, you would get the anvil inventory, then get item 0 and 1 as Wizardly said
0 being the most left item, 1 being the middle
what should i use then?????? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/FishHook.html#setBiteChance(double)
declaration: package: org.bukkit.entity, interface: FishHook
what are you trying to do?
set the bite chance?????????
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
It just doesnt work
I guess it doesn't exist then anymore
Everything around it works
does the stuff in if (p.isOnGround()) run?
You're not starting it
new BukkitRunnable() {
@Override
public void run() {
}
}.runTaskLater(this, 5); //You need to do something like this at the end
In Spigot words the method setBiteChance does: 'Sets the chance of a fish biting.
0.0 = No Chance.
1.0 = Instant catch.'
So it's for decrease the time catching, so maybe the methods 'setMinWaitTime()' and 'setMaxWaitTime' could help you
yes, i guessed that
No
huh
Message below
also shouldn't everything be put under run()?
It is
for checking if a player is in an area should i just check for x and y at the same time or x, then if they pass that check, check for y coords
i want to display a title when a player is in a certain range of coordinates but i dont know really how to keep checking without destroying my server, if that does destroy a server checking coords every PlayerMoveEvent
anyone know a way to make a pickaxe look enchanted without having any enchant, but not hiding any enchants
im making a custom enchant and i still want players able to see other enchants
am I stupid or just blind? WHAT THE FUCK is the purpose of the Holder class?
Nms ig?
well ugh why
if you have a custom enchant, you can use that to make it glow
just add your custom enchant & you're done? I don't understand the problem
also where's the problem in hiding enchants if you claim the item doesn't have "any enchant"?
I don't understand at all what you're trying to do - you want to enchant an item with your custom enchantment without adding any enchants and also you do not want to hide non-existent existing enchants?
whut
Confused
me too
Is there any efficient way at storing the location of blocks that are placed. I suspect a sqlite database may be best for this? Not sure.
What buffer amount would i need to allocate for writing/reading diff java types (string, int, double, etc)?
how many blocks? ALL PLAYER PLACED blocks?
none, I guess?
doesn't bufferedreader/writer do all that on its own?
Yes.
I'd go for a "proper" DB like mariadb/mysql. sqlite is fine too, but definitely not yaml files for this one
normally I always say "yaml is fine to store data", but not for suuuuch a large amount of data
Cuz i will be sending and receiving BytesBuffer using Socket
for a few thousands, yaml is no problem at all
just think about this - a location reference is maybe, idk... 32 bytes? now you have 5000 location references in your list - that'd be about 0.16 MB in total. No problem at all
yeah so you'll basically have some kinda list or set with a list of locations
and you have to check them in every blockbreakevent
if you don't have a million blocks, no problem at all
yeah no problem IMHO
just be sure to turn them into a location in onEnable() instead of comparing strings everytime
wdym?
what exactly is yuor question?
- Loop over getConfig().getConfigurationSection("stations").getKeys(false)
- It will return a list like '-374_77_1268', etc
- Now you can get ghat configurationsection and loop over all keys inside 'stations.' + stationName + '.blocks'
is there anything like ExactChoice but for shapeless recipes?
yes, it's called ExactChoice
the documentation says it's only valid for shaped recipes
hm? where does it say that?
oh I see. Weird, I've used it many times in shapeless recipes without problems
no, it gives you a ConfigurationSection, obviously
you have to loop over the keys again (getKeys(false)), which returns a list of all "keys" inside that
do your custom recipes have ingredients with custom NBT data?
then you can get the value for each of that, using getString(key)
The documentation is outdated in that regard
i heard exactchoice breaks them
I believe it even works for furnace recipes and what not
nope, works fine, just the recipe book doesn't really understand it
alright then
yep it does
i'm just going recipe by recipe making it so if i use a custom item it returns air
no idea why it says "Only valid for shaped recipes"
It’s outdated
I’d update it but I’m not sure if there’s anything it still doesn’t support
because it doesn't work for shapeless recipes
🤨
how to make player undergo riptide animation without them moving or actually using riptide?
what is riptide again?
the spin animation
I think I never ever saw that one lol
you use a trident then it launches you, and also plays a spin animation
Enchantment
oh true, never noticed it
which holder
SHapelessRecipes actually always just go by material
@cursive crow
the purpose of the Holder class is
Fix it
nevermind i did it with preparecraftingevent or whatever it's called
if the crafting inventory has an item with the same custom model data as my custom item it returns air
isn't that event cancellable?
i have no clue what i'm doing, i'm just happy it works
you should rather just do event.setCancelled(true)
i don't think PrepareItemCraftEvent has that
oh well okay then I guess it's fine to use Material.AIR
erm what the
I have looked for the "Maven" button for hours
then I found out it's at the bottom lol
How can I constantly spawn torch fire particles near a player's feet?
Thank you
if you wanna do it for all players - a runnable is the way to go. if it's only for a few players, I'd use the PlayerMoveEvent
yeah i'll probably just put it in my armor logic runnable
it'd be much better if i didn't constantly check the armor players are wearing and only checked when equipping/deequipping it but i don't care enough and i doubt it's going to impact performance, it's a survival server with 10-15 players at most
💕
How to write a byte[] array to a simply byte?
You want to turn an array into one byte?
Yeah
Wat
Because the shity ByteBuffer class doesnt support adding a byte[] array
You can’t just turn multiple of something into one of something
Oh its a better way to do it?
I explain what im doing, im trying to create a class for reading/writing primitives (String, int, byte, etc) so i was using ByteBuffer class
not
Which class i can use?
that's like asking "how can I turn my whole family into one person"
that isn't too difficult
Because i need a class for storing indexes and primitive values
So what do you recommend?
No human centipede allowed
just eat them
is there a way to slowly change the color of a piece of glass
or not really "is there" but how would i do that
Not really
smooth transitions? no
You only got 16 colors to work with, you can’t interpolate between them
but you can change every x seconds, minutes, years the "color"
Or do you just want rainbow glass
Store the locations and change them with a runnable
?scheduling and replace the block every x seconds
lol repeating task every year
what if i wanted it to always be changing color even if it was being held
You’d have to have a runnable for that too
but how would i actually change the block
In the world or the inventory
Actually it’s technically the same either way
setType
vore??!?!?!?!?!?!?
Yes
Memory
What’s wrong with the existing types
byte int double float
You are not understanding
I need something for setting and getting, an index with any primitive value
wouldnt it break the runnable if the chunk wasnt loaded/player went offline/server restarted
Yes
if server goes down, every runnable get stopped
You need to store the block locations somewhere
That defeats the purpose of the primitive values
ah rip ok thanks
didnt understand
I will traslate it
I understand exactly what you’re saying
An array which could accept any of the primitives
But the primitives are different sizes
Meaning that would have to be a pointer array
Literally i need to store index and values, for then sending it and receiving it via socket
So you may as well make it an Object[] and use the boxed types
Use byte[]
You can map it
An int will always be 4 bytes
A long will always be 8 bytes
You can stitch them together inside a byte array
My idea was to do something like this:
Buffer buffer = new Buffer(); // Custom class
buffer.write(0, "This my message"); // Wrriting
String string = buffer.read(0); // Reading
So i send that class via socket
Doesnt fit me
It does
How make an example
I tried many times with no success
And sorry for losting your time :D
And ByteBuffer doesnt support adding strings
.
and that return a byte[] array
Yes
Allright
buffer.put("This is my message to you.".getBytes(StandardCharsets.UTF_8));
Dont disconnect please
Let’s see the error
And the error say that i cannot add a byte[]
You can though
Get rid of the index
rid?
Put doesn’t take an index for byte[]
^
of course you can't
you have to do it in a loop
Oh but i want to set multiple values
No you don’t
You can
How??
Again, look at what I sent you
hm? how?
ByteBuffer#put accepts a byte[]
put(firstArray)
put(nextArray)
And for getting them?
Its always ordered?
Looks like you need to keep track of the length of said array
So:
ByteBuffer buffer = ByteBuffer.allocate("how much here?");
buffer.write("String".getBytes());
buffer.write(new List<String>);
String string = buffer.read();
List<String> list = buffer.read();```
??
read reads a single byte
Minecraft has a nice class in NMS called PacketBuffer
Note that the amount of bytes you allocate does matter as well. You're directly allocating a backing array so if you allocate too much you're going to run out of memory and crash the server ;p
Which has a readUtf and writeUtf
well to be fair, they probably don't have a 17 GB string list though 😄
"probably"
No, but in a snippet above they put 1000, which is far too much
It also seems to handle the size for you
So wait wait, how much do i need to allocate??
ugh you still use the hardcoded 1000?
I try with 4000 and jvm doesnt respond
didn't you did that yesterday already and I told you not to do that?
Its bugged
No, you're just allocating too much ;p
with 4000 jvm doesnt respond Hahaha
To put it into perspective, if you want to write just a single integer, all you need is 4 bytes
What its better here
I wonder how Mojang handles it
Do you actually need a ByteBuffer? Because if all you're doing is writing to a byte array, you can use the ByteArrayOutputStream instead which does have some convenience methods for writing various types, including strings
What better sending/receiving your own object class or a custom class via socket?
Probably just uses a dynamic collection of some type and then converts to a static array when you are done filling it
Mojang uses a ByteBuf from Netty, yeah
yeah exactly, I suggested that yesterday too and I'm still wondering why they don't just use that 😵💫
So :D
?baos
Ah Netty has their own ByteBuffer
The one I linked is Java
Ignore my tangent
do you people wanna see something "nasty"?

