#help-development
1 messages · Page 681 of 1
who plays chess
coll aparantly
No ICBMs are not legal in chess
Login to your Chess.com account, and start enjoying all the chess games, videos, and puzzles that are waiting for you! If you have any issues while logging into your account, do not worry. You can recover your password, or drop us a message and we will gladly help.
okay well ill keep it in mind for the future, I dont really mind with this plugin but its good to know someone is having enough fun to repost it
Does ICBM stand for InterContinental Ballistic Missile ?
yea
how is that related to chess
wtf did I miss
how did i mess up so badly
yeah that was funny
i once almost fools mated someone
then i forgot how
not my proudest moment
i stg cipher if you make a 18+ joke
what else
3+0 blitz
we can play blitz if you want
isn't there an option to set a time per move instead of a total time
yea up to 1 day
naaah I usually think every move through a hundred times lol. I was already almost out of time when you killed me lol
i had only 1 minute left
Login to your Chess.com account, and start enjoying all the chess games, videos, and puzzles that are waiting for you! If you have any issues while logging into your account, do not worry. You can recover your password, or drop us a message and we will gladly help.
my elo is somewhere around 300 even when im awake so imma say no lol
1 day per move
tomorrow, I'm still trying to launch this weird rocket in half life 1
yeah you can play your move tomorrow
oh ok I'll accept it then
yep we aint going to see those guys until october
now or never, not that someone else accepts it
I did accept it and I also already did e4 but then somehow it ended?
wrong 1 day timer lol
ah no there it is
you choose the one where the board needs to stay active im guessing
ah yeah, it somehow switched to another site after I confirmed the first move lmao
gotta install it on my phone so it notifies me
nice I found the train
reminds me of Freeman's Mind
how do i change item drops on BlockBreakEvent?
and check if there were item drops?
BlockDropItemEvent
okay.
appreciate it.
do i just change the items in the List<Item> ? I am guessing it is a list because could be many items in case a chest with items is broken?
Yes
The fadeIn and etc was introduced in 1.9? When is the method introduced?
I have some array list of ItemStacks. How to prevent removing 2 same ItemStacks?
use a set
if they are completely identical that will prevent that, but if not just before adding to the list check.
I can and want have to identical ItemStack in list thats okey. You can get 2x 64 cobblestone for example
Thanks gona try it.
Wtf is wrong with github mobile
Wait.. you cant .get something from set like you can from List?
Sets are unordered
You can loop over them or stream them
But there is noch thing as a „first element“
Oh fuck... Im just making GUI where player can chose items. If they are 2 same ItemStack if chose both of them and remove from menu (you can chose every item only one time). And thats what I need to fix.
I was using list
Let me better explain.
If I click one red wool. One should replace green glass
thats oke, but another one get deleted as well
thats a issue
I hope that's maybe understandable xD Player will get the first 5 slots (the green one) after closing GUI
The list should only remove the first instance
Can you send your code?
Sure but will be hard to undrestand probably 😄
Maybe I will need send whole class?
?paste
Whatever is relevant
Probably this:
@Override
public void handleMenu(InventoryClickEvent e) {
ItemStack item = e.getCurrentItem();
Player p = (Player) e.getWhoClicked();
if (item == null) return;
if (item.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(PersoKits.getPlugin(), "function"), PersistentDataType.STRING) != null) {
String function = item.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(PersoKits.getPlugin(), "function"), PersistentDataType.STRING);
if (function.equals("removeItem")) {
ItemMeta meta = item.getItemMeta();
meta.getPersistentDataContainer().remove(new NamespacedKey(PersoKits.getPlugin(), "function"));
item.setItemMeta(meta);
kitVaraint.remove(item);
optionItems.add(item);
inv.clear();
super.open();
return;
}
}
}
Can you send the whole class?
I’m line 103 it looks like you remove from the list every time
I’m on my phone right now so it’s kind of hard for me to see what’s going on
umm line 103 is this for me
In the method setMenuItens right after the first if statement
Yea, thats should not be issue, or wait...
Yea, you are right.. What I want to do, is already chose items not display in arrea to chose (afterr barrier). But Im removing the item already after choosing the item. And then when I open inventory Im removing that item again.. Because that working whit same ArrayList...Thanks a lot!
No problem
any idea why STRENGTH isnt on potion effects in spigot java docks?
Was looking for make
%player_has_potioneffect_<effect>%
Work
its increase_damage i think
if thats what u r searching
works thanks
I am trying to set a permission to be only available when given but not op
core.admin.commandspy:
default: false```
I set this in my plugin.yml but the OP users still have access
Anybody know a good tutorial to learn custommodeldata on spigot forumns
i remember seeing one that also included stuff like blocks w/ block states n such
but i cant find it
Do you have a perms plugin with * or something
I have my own checking permission function
if (!(sender instanceof Player))
return true;
if ((!sender.hasPermission(permission)) && (!sender.hasPermission("core.*"))) {
if (notify) {
if (getRankFromPermission(permission) == null) {
ChatUtils.sendMessage(sender, Prefix.permission(), MessageUtils.noPermission());
return false;
}
ChatUtils.sendMessage(sender, Prefix.permission(), "&7This requires rank " + RankManager.getRankFromPermission(permission).getPrefix() + "&7.");
return false;
}
return false;
}
return true;
}```
And the player does not have any "*" permissions
Is there a perms plugin installed
Try without it, maybe it defaults op to everything
No permissions plugin, only my checking hasPermission function
Post your full plugin.yml
version: 3.0
main: src.sc.main.ServerCore
author: KBS
commands:
heal:
usage: /heal [args]
description: Heal player
feed:
usage: /feed [args]
description: Feed player
time:
usage: /time [args]
description: Set time
permission: core.command.time
region:
usage: /region [args]
description: Region management
permission: core.command.region
warp:
usage: /warp [args]
description: Warp management
aliases: [ warps ]
clearchat:
usage: /clearchat
description: Clear chat
permission: core.command.clearchat
[Cut 50 commands from here]
permissions:
core.admin.commandspy:
default: false```
md you should change the trash command system (as in adding commands to plugin.yml)
its so annoying
api's exist but still
🙂
You only have one permission?
Yes, only want to block this one permission from OPs
The other's I have in a .java using strings not in the plugin file
Maybe your perms checking function is broke, because has permission will definitely return false
Aren't OPs implicitly granted all permissions?
Not by Spigot
this would be bad if true
it is, just isnt called strength 😔
the bukkit naming scheme is.... something
iirc theyre based on older internal names
I have no idea why it won't remove the permission
I am using Spigot
any permission plugin?
My own methods
then you are granting that permission yourself
This layout is designed for implicit allow instead of implicit deny btw.
Good point, I will rearrange that later
But I want to figure out why it wont deny the permission
I'd recommend checking normal #hasPermission() to rule out if it's an issue with your method.
are you granting a wildcard admin permission by chance?
Hm, i tried normal has permission and it denied it
Then it's likely that your if statements are failing. Resulting in your method returning true.
if ((!sender.hasPermission(permission)) && (!sender.hasPermission("core.*")))
This is likely where everything falls apart.
I think core.* encompases core.admin
But I never give the user core.*
..
Do I need to set core.* to false aswell
But I was OP to have access to all commands except this one permission
aren't u supposed to have your own parser to use wildcards?
like does spigot support wildcards in permission checks by default?
I think it does.
Sorry I don't understand, I explicitly check for core.* so if it is given it should pass any of my commands?
have you tried debugging your code?:D
like print line by line what's going on?
also bukkit permissions api doesn't support wildcards
I removed the core.* line and it works, not too sure how this will affect long term but ill have to figure that out next
spigot doesnt support .* permission attachments i think
pretty sure you need a permission manager which supports it like luckperms
which overrides the Permissible so Player#hasPermission works
how do I do config files in bukkit b1.7.3?
is collection faster than list for adding a ton of elements and then iterating over them?
Bruh
Wdym
Collection is an interface which list extends
set* sorry
LinkedList probably gonna be fastest add then iterate
how to drop players inventory items when left?
ok ty
Set is slower for iteration as it has at least 25% by default of empty spaces
no but seriously, how
But it's a lot faster for contains and remove
this shits ancient
Beta?
yes, you might open your eyes sir
having fun
if you don't let me have fun, I take out my chainsaw ||and go cut some trees in my garden to relax a bit||
Yo, you don't have to be this brutal
lol
yep
I just use a LinkedHashSet
Works wonders for iter, add, remove & contains
Yeah it's good but keep in mind that space is a thing so if possible use a simpler solution
Iteration is still slower than when iterating over an array
Which a normal arraylist and hashset is
But you're loosing the order for set
Whats the new method for the deprecated ChatColor::getLastColor?
paper moment
Getlastcolor isn't deprecated as far as i know
Why's paper deceiding what is deprecated or not?
They deprecate stuff in favor of adventure
But they're supposed to keep compatibility with spigot
Hence the deprecation
damn i have to wait 10m before i can write anything in papermc discord
Tho once they hard fork they are planning on yeeting those methods quite surely
Hello again , i have problem with sql code ..
when i click on this and set a nick , it does change
but its not updating in mysql table :
it does not say profile is null , so its saving it , but it does not update the values .. \
wtf is that indentation
And why images when we have bins
easier to understand what iam trying to do :p
But spigot on the other side decided not to deprecate most of string methods
Nah
I mean you have minimessage
Which makes it easy to deal with
And you have the static factory method that takes a var arg of them so you don’t have to deal with append and what not
I wonder if you can use asm to make a class that extends String
Add a .exceptionally to the future
9/10 chance it swallowed an exception
i usually just convert a string to a component and use § for colors
I'm willing to do a crazy bet
and say it's probably because you added too many spaces to your query
:)
Tbh I don’t mind adventure or bungee chat for that part as long as there exists api to do the stuff I wanna do
I just add support for minimessage and write a bland config with no colors
customer can spend the time if they want
Yea
it update the data , when it exist in the table [save method]
yeah but look at the order
what's wrong with it?
it's all mismatched
don't let AI do the work for you
was jsut lazy to write it down xD
yeah its fixed thanks .
Im pretty sure that sql can be made way shorter
I wonder if UUID is a final class or if you can just extend it and override toString to cause sql injection
bit farfetched
It's final
aw
How would I prevent the server from sending the player a specific recipe?
The UndiscoverRecipeEvent does not do this
Whats the point of this
Well, it's just for an easter egg and not actually crafting anything.
I thought it was best to leave the recognition of this "recipe" to the server.
I guess I have to completely handle it myself?
It's only for the recipe book
anyone knows whats the easiest way to export custom variables for players into json to api link
so i wanna use the api.servername.net/player/
to get custom plugin variable values like economy, playtime etc..
lemme know if you need help with the discord
sometimes I really question my sanity
i mean. ur not wrong
what does it actually mean when my plugin is printing something in console called "Skipping block entity with id"
are you sure thats your plugin?
pretty sure thats just the server
really confused as i dont warn anything in console
Im thinking it could be some sort of spawner possibly that appears in the gui. But why is it using my plugins' logger
i dont think its using ur logger
The TileEntity isn't matching something it knows?
merely that thread
Hey can someone tell me how I can do the friend or foe custom pvp timer thing in my server? I want pvp to be on at random times for like 15 min or it can be on every other 15 minutes
I wonder if its something todo with using im.getBlockState
which auctions plugin?
monke hears a big sucking sound like the sound of a giant vacuum sucking him back in to development...
(which i use to grab items from a container so they can preview it)
Does anyone know how i can prevent it from being logged?
not really, me and vacuums have always not got along
are u ok
i have no idea what TileEntity.java does
nms = evil don't you know?
yes
nms is only a bit evil
ok
i am not one to criticize tho
soz, i just don't have enough of a bigger picture to be of help
like what is actually trying to be accomplished
usually the issue is the approach, not the method
at least from experience thats what everyone tells me before i use NMS
well like i said, im not using nms
bsm.getBlockState() is actually causing this
which is via the bukkit api
Do I have to use Maven with NMS?
Well alright
?jira
Im not really sure if its a bug
either way i have dont have much information either, im not the server owner just the plugin owner
yea it might be caused by something specific on that server
Why do people here hate Paper?
why do you assume people here hate paper
we dont
Ah my bad then
well this is a spigot discord server not ***er
this is just not the appropiate place for support for paper
Yeah
what plugin and is it reproduceable?
getting more information from the user, i've added a debug lol
not fair to report something i dont know much info abt
clearly you've not met the people who report bugs to me
so many people report bugs to me
and its the stupidest things
"WhY is ur warp plugin charging people $077 for teleporting to a warp"
bro, in ur config u have 77 at the end
💀
you have people who actually use your plugin asking to do support for your plugins? Must be good
i mean yeah fair enough lol there are some silly people
who asks "does ur plugin support 1.8"
bro it says on the spigot page
"what does the configuration file look like?"
how to break blocks as a player? for example, with a custom pickaxe which breaks multiple blocks at once, how should i create the blockbreakevent and pass it to other plugins, for those other blocks ?
i show them this
just call that event for each of those blocks
BlockBreakEvent bbe = new BlockBreakEvent(PARAMS);
Bukkit.getPluginManger().callEvent(bbe);
depending on how many blocks that might not be too performant though 😄
block.breakNaturally
i think
might be player.breakBlock
that doesn't break it as the player
declaration: package: org.bukkit.entity, interface: Player
it was player.breakBlock lol
player.breakBlock seems to be too new (I don't have it in 1.16.5 lmao) but the callEvent is enough since it's up to 9 blocks and lets me associate the player with those blocks
its been there since 1.17.1, yeah it is
3x3?
How can I create a custom path for the EntityEnderDragon? (1.17.1 nms)
Could someone help?
Hi guys, want to improve my codes practices in java for plugins minecraft 1.8, somebody help ? Send me a tips, tutorials etc...
Too old! (Click the link to get the exact time)
Hey guys, I'm spawning a custom entity with NMS, but the server crashes as soon as I spawn it
Weird, there is no crash log
I set it to spawn when a player joins
?whereami
Oh shoot
Alright
all thats in this log is the server yelling there's no server.properties file
you might want to post the code that spawns the entity
?paste
the spawn method is in MinecraftRigidbody. It basically calls level.spawnFreshEntity(this)
How to use a custom library with gradle? I got compileOnly files('libs/ChiccenAPI-0.1-SNAPSHOT-dev.jar') in my gradle.build dependency section and get this error ``
Execution failed for task ':compileKotlin'.
Could not resolve all files for configuration ':detachedConfiguration1'.
Failed to transform ChiccenAPI-0.1-SNAPSHOT-dev.jar to match attributes {artifactType=classpath-entry-snapshot, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
Execution failed for ClasspathEntrySnapshotTransform: C:\Users\Kento\Desktop\ChiccenNetworkPlugins\ChatAndTablistStyling\libs\ChiccenAPI-0.1-SNAPSHOT-dev.jar.
Check failed.
mvn install it if you want to do it properly
or gradle publish with the maven-publish plugin for gradle projects
No. How do I do that?
https://www.spigotmc.org/wiki/intellij-debug-your-plugin/ im going out on a leg and say youre using a good ide
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Why is your org "org.example" and you are using paper it seems
i cant paste pictures since im not verified so...
https://pasteboard.co/P2jfnkKzuWa9.png
is it possible to replace that messages ?
blocks section does not exist.
ur on spigot discord
You can't
custom texture pack with invisible item maybe
that would still need an item, wouldnt it?
I dont know what u r trying to achieve but maybe HandItemHeldEvent or whatever it is called could work
its called when a players changes slot
What are the conditions for rain to change into snow?
that's based on the biome
Biome ig?
isnt it also depending on snow? So if theres no snow it only snows at very high height but when theres a snow-layer it snows
how do i change the chests direction org.bukkit.material.Chest is deprecated
fuckin hell its also based on the temperature gradient in biomes
its a mix of biome, height, temperature, and of course if its currently 'rainy' weather
why don't we have a 'is it snowing' check lol
playerWeather is like 'sun, rain'
and thunder???
oh theres World::isThundering
yea
i need to have a precise measure if it's snowing or not
like at a certain location
check if the world hasStorm and the location biome
thats no very precise, especially considering how temperature maps and randomized snow heights are a thing
i dont need approx, i need exact
thats not what the wiki says
if it's World#isStorm() and you are in a biome which supports snow it will snow]
hm alright
u could also use Snowable::isSnowy
that will only tell if there is snow on the ground
and if theres snow on the ground its most likely to snow
As I understand it, you can’t make a bind on the Q button if there is no object in your hand?
unless its changed it won;t snow nor rain in desert biomes
Dont’ open gui*
only with texture packs
That is, when you press the Q button, give the player a custom item and pick it up immediately after opening the menu?
sooo i cant see the biome, whats waiting for chunk mean
Will the same occupy 1 cell then?
wdym?
no clue, try checking the temperature at teh block
nvmind had to toggle it twice
what cell?
it has to be hasStorm() still
Well, if the player constantly has an object in his hand, it will take 1st place
@eternal oxide u were wrong, it is random heights
1st place?
Slots
The item can be removed if the player switches of the slot, and it doesnt need to be set if the player is already holding an item
so no
?
then it's now based on temperature not biome
U will actively set the item in the players hand and remove it from everywhere else
Thank you
np
where can i see temperatore?
ah i meant as a command
that returns the temperature adjusted for height
Look at the private message
yea
also going higher makes the temperature lower
is snow just a threshold on temperature
no clue but I'd assume zero
thats probably just a rounding issue. likely floors
why isnt this documented anywhere urgh
I guess as it's fairly new (ish)
can i manipulate temperature?
I doubt it
well not with the api
i can probably manually override it in the mca file but
not worth the hassle
yea but that doesnt give me the number that's the threshold
man i really dont want to fish through nms to get that double
welp i found minecrafts minimum temperature
well, time to write my own config thingy because 1.7.3 beta don't got it :(
can I control (with spigot) cow's direction, for example I give it the final location and it's ai will go to that loc.
pathfinder is not in the spigot api
if i have time i might push request some changes to the api
Why are events in bukkit b1.7.3 so confusing
im sorry what
What's wrong?
why are you using 1.7.3
Beta 1.7.3*
Isn't it the same as modern day bukkit with far less events?
It's like
Also isn't b1.7.3 still hMod days?
You have listeners for certain stuff, like playerlisteners
And then you override the methods like onPlayerJoin, atleast that's what I guess it works like
Ah, so I guess they use a system comparable to minestom
Or at least the minestom I used a few years ago
the question, of course, is not related to the plugin, but related to the serialization of objects, how can they be transferred between the server and the client (java) if the package in which the object is located changes
Hey lads, how can you technically implement upgraded plants (with few levels - each time they get better). I know that block ageble have 7 "ages" but does that apply to all plants/crops? How does that work in the case of sugarcane? I thought about using onPlantGrow and skipping (setting higher level for each upgrade) levels, do you think that would work?
can someone help me with securing my server from bots/ddos? like can someone put some kind of attack to my server
ddos is more difficult, i remember blocking the attackers manually
!verify Cyrei
Could not find your SpigotMC.org account!
as for bots, pretty sure there are ways
!verify Pheonix33991
A private message has been sent to your SpigotMC.org account for verification!
does anybody know how I can get the source of explosion in HangingBreakEvent? When I e.g. hit a end crystal, getRemover() returns the player instead of the crystal
how to findout if player is clicked on a clickable text component?
You add the click event to the componemt
i want to know if player clicked or not
who else would have clicked it
i'll handle it
but i dont know how to get a boolean or something
any thoughts?
i don't understand the question in the first place
you can use whatever command you like for the clickevent
you have 100% control over which command is ran
i'm gonna send a clickable TextComponent message to a player and i want to findout is the player clicked it or not
You will be best to use click event component and player command pre process event
hmm good idea
yeah well if your onCommand(...) method gets called for your command, then they clicked it
why preprocess event? why not just a proper command executor
Doesnt need to be a real command if you use pre process
hell no
yes very good idea
Bc it may be something that end user can abuse to gain unfair advantage
no, you'd just include a secret in the command
using a hashmap to store player and a boolean on sending the component
after all they could also just run your arbitrary command if you don't properly register the command
then after he clicked turning the boolean true
im gonna check the hashmap. if the player isnt in the verify procress then return;
@remote swallowits ok to use a hashmap?
Thank you very much for that brilliant idea( sorry for my bad english)
I'd use a properly registered command with secrets, like this
public class MyCustomCommand implements CommandExecutor {
private final Map<UUID, Function<CommandSender, Boolean>> commands = new HashMap<>();
public ClickEvent registerCommand(Function<CommandSender, Boolean> command) {
UUID secret = UUID.randomUUID();
commands.put(secret, command);
return new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/myplugincommand " + secret.toString());
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(args.length != 1) return true;
String secret = args[0];
UUID uuid = UUID.fromString(secret);
Function<CommandSender, Boolean> storedCommand = commands.get(uuid);
if(storedCommand == null) return true;
commands.remove(uuid);
return storedCommand.apply(sender);
}
}
and then you can easily reuse it everytime
public void doSth(Player player) {
ComponentBuilder builder = new ComponentBuilder();
builder.append("Click here to kill yourself").event(registerCommand(CommandSender -> {
player.setHealth(0.0D);
player.sendMessage("You killed yourself by clicking the message.");
return true;
}));
player.spigot().sendMessage(builder.create());
}
it was simple packet spam from many ips
You can't really block it yourself
i want to test and improve my protection
isn't it entity explode event?
EntityExplodeEvents gets called when the crystal explodes, but I want to cancel damage done to the hanging only
i specifically only want to avoid damage being done from certain explosions (e.g. end crystal) to hangings (e.g. item frames)
For some reason, the following code severely lags the server.
public class ImprovedChunkUtils {
public static Chunk[] getNearChunks(Location loc, int radius) {
ArrayList<Chunk> chunkList = new ArrayList<>();
//gets the chunk coordinates of the location
int centerX = Math.round(loc.getBlockX() / 16f);
int centerZ = Math.round(loc.getBlockZ() / 16f);
//iterates through the chunks in the specified radius boundary
for (int x = centerX - radius; x <= (centerX + radius); x++) {
for (int z = centerZ - radius; z <= (centerZ + radius); z++) {
//adds the chunk to the arraylist if loaded
if (loc.getWorld().isChunkLoaded(x,z)) {
Chunk currentChunk = loc.getWorld().getChunkAt(x * 16, z * 16);
chunkList.add(currentChunk);
}
}
}
//converts and returns the chunks as an array
Chunk[] output = new Chunk[chunkList.size()];
return chunkList.toArray(output);
}
}
Does anyone know why, and how to fix this?
getChunkAt takes in chunk coordinates
EntityDamageByBlockEvent
EntityDamageByEntityEvent
so you load totally different chunks
one of these
cancelling both will not prevent the item frame from breaking
I like the old bukkit event system even more than the modern one now suddenly
Alright, thanks
if you want to use "normal" coordinates, use getChunkAt(Location)
also, it's funny how there is Player#setGameMode but there is no implementation for it
also, this feels like I'm coding in like 2014 or something
wdym? the implementation is in CraftPlayer
Bro is bisexual
this is an ancient version btw
I sometimes have the feeling I'm even more outdated than I could be but this seems to be the newest build for b1.7.3 lol
I wonder how I'd do NBT here lmfao
weird lol
but I'm pretty sure in b1.7.3 you can't toggle gamemodes at all
lmao there isn't even chat in singleplayer
creative mode was added in beta 1.8
that's what chatGPT tells me
ideal version choice I made here
yes, beta 1.8 was the last
It was added in r1.3.1 or r1.3.3
If you can work with that outdated API, sure you can.
Now even the Scoreboard is getting an outdate stuff or something, because appearently, Objective o = board.registerNewObjective(); is deprecated.
(actually what is the new method of making Scoreboards??)
I can make custom creative gui probably, but there are a lot of creative mode aspects
I mean, you can probably setItem(slot, ItemStack);, right?
b1.7.3 is extremely old.
lmao what are these
sounds mojang-ey
notch go brrrrr
Seems like this is not the right method anymore... 😮💨😮💨
I wonder if these are still a thing
Still? Not like were?
player
I like old bukkit gonna be honest
What the hell is Criteria?
Like Criteria.VALUE?
Seems like so
YAAAAA :D
Eh, it was harder, I guess.
Mostly working with packets is not so fucking good for me
Use packets just to have tablist? Hell no
tablist? Who needs that eww
I like to just highlight the server name, and which server the player is on
and sometimes dc and web
that's all
nothing else
pretty sure thats ProjectileLaunchEvent these days
It absolutely does
yeah wanted to say the same
And is not even deprecated
lmao what
damn jitpack fails to build if a dependency has a newer version class file, even when it's set to provided 😦
No error it seems like it works xD
I don't know but I sure do wanna poke my eyes from it I guess
I am using 1.20 API
XDDDD
(to actually run on 1.20.1 HEHEHEHEEE)
this version is so old it has no death messages afaik
there isn't even a death message in multiplayer I think
there isn't even a death event lmao
rn I'm curious how modding works here
In this scenario, I have died due to a Zombie killing me, while I was AFK, leaving chat open (I was on a local server, so there was chat), and the creeper did... Find me... Never actually exploding XD
Once I closed chat I got the "U DEAD BITCH" screen. XD
HMmmmm...
Definietly not Forge I guess
but maybe it does exists on b1.7.3 who knows?
ru running windows 8 or something?
it was some modlaoder thing
that is not 8 lol
i dont know been so long
Windows 7. But 'twas in 2020, before I even turned 14 XDD
(I turned 14 a couple of days later after the screenshot lol)
looks more like something between vista and seven
The square screen tells everything
I have been using square screens for 10 years bruh
My current 16:9 monitor is the first 16:9 monitor I have xd
AND I AM USING COMPUTERS EVER SINCE I AM 5 XDDD
or 6
idk
xd
Can you modify what commands a player can see?
PlayerCommandSendEvent
Yup
or, much easier - just don't give players perms for commands they shall not see
Not every plugin is coded to work like that
So PlayerCommandSendEvent is better.
public void onEvent(PlayerCommandSendEvent e) {
e.getCommands().clear(); // I usually clear
e.getCommands().add("command"); // This should be a valid command. You can also check for a specific permission, so that only players with permission yourplugin.yourperms should see specific commands. See below
//if (e.getPlayer().hasPermission("plugin.vipcommand")) {
// e.getCommands().add("vip command");
//}
}
This should work.
is it safe to modify the collection async?
What do you mean? Making an ArrayList to add the commands? Non-sense I guess, and I never succeded.
Going through each command and removing it if the player doesn't have the right permissions
I mean if there is a .remove(""); option, you probably can remove all commands you don't want your players to see, but it's just better to clear all the commands, then with assigned permissions, let them see all commands they shall see (as like the example I sent above)
Alright thanks
yw
is ConfigurationSection#getKeys ordered?
so for example:
section:
first:
field: "Hi"
second:
field: "Hi"
would config.getConfigurationSection("section").getKeys(false)
give this set:
[first, second]
the docs say nothing about ordered/unordered
I need help to build a plugin in the best way possible, could you send me tutorials? OR give me tips?
@glass mauve they're ordered
Yea i use them a lot
build how, compiling or making a plugin
hi, I have a question... is there a way to check the playercount of a server externally? because the player count data is very important and i really need to prevent it from being tampered with.
for example if i make a plugin that sends data to a specific socket when someone joined the server, you can modify it
i want to prevent that
secure socket
how?
I want to make a tag plugin that places the tag in the list of players when the "tab" key is pressed, the following, when executed /setTag <tag name> <username> it puts it in the tab like this [TAGNAME] USERNAME
for anyone wondering, I used bezier curves and teleported the dragon creating a custom path. Dm me if u have any questions ^^
Debugger doesn't show anything
It just disconnects
team api
oh
nvm
i meant something else
i meant that if the Client is modifying the player count
not a third party
yea
well, the server cant tell if a player just joined or the client did something sus
?
like good code practice
anyone can submit data for a plugin if they have the id
E can't I change my username in spigot
but isnt there a mojang api for this?
Is it possible to obtain a directional vector from an EulerAngle?
I think Location#toDirection is what you want if im not wrong
you mean yaw and pitch to directional vector?
No, I mean EulerAngle
An euler angle is just a vector if you think about it that way
Like, I guess so, EulerAngle doesn't use yaw and pitch directly
I'm not sure I understand
Hey guys. I'm developing a plugin that makes use of the PhysX native bindings to try and make a physics plugin via block displays. Anyways, when I spawn one of these physics entities, the server just weirdly closes without any crash logs or anything.
Yes, but I mean, I need to make the EulerAngle a Vector
If you want a pitch/yaw/roll vector all you have to do is convert it to degrees 😛
Math.toDegrees(radians)
Would that allow me to converse EulerAngle to a directional Vector?
Probably. It would represent the same value in 3D space
Thanks
So, like this?
@NotNull
private Vector getAngleVector(EulerAngle tempAngle) {
double yawDegrees = tempAngle.getY();
double pitchDegrees = tempAngle.getX();
float yaw = (float) Math.toDegrees(yawDegrees);
float pitch = (float) Math.toDegrees(pitchDegrees);
Vector vector = new Vector();
vector.setY(-Math.sin(Math.toRadians(pitch)));
double xz = Math.cos(Math.toRadians(pitch));
vector.setX(-xz * Math.sin(Math.toRadians(yaw)));
vector.setZ(xz * Math.cos(Math.toRadians(yaw)));
return vector;
}
Thanks a lot Choco
??
IntMath.pow is superior for ints
Hi there. I just started developing my own plugin(s). I am skilled with Java, but less so with plugin development. Is there a place where I can ask all questions on plugin development? Or can I just do that here?
What this error ?
here
there is no setdropitems method
im gonna guess your project is setup for a higher version of mc and spigot
org.Bukkit.ChatColor is depricated and I have no clue if I should fix this and how I would have to do it.
you are using paper api not spigot
Is that the reason?
paper deprecate string methods to promote using adventure components
I see
I might just change it to Spigot then, to make it more generic
spigot api is missing some stuff paper has but it works for more people and you get to publish plugins on spigot
Yeah, that's what I understand. However, I'm developing something personal, so I would be the only one with the issue XD
Now I have to figure out if I can refactor to a spigot plugin...
yeah you can
And how XD
just change the maven/gradle dep & repo and move to a plugin.yml if you use paper-plugin.yml
Ok, I'll see what I can do
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
@remote swallow
@lilac dagger
my code
package legitey.legitey.handlers;
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.event.Listener;
import java.net.http.WebSocket;
import java.util.Random;
public class LuckBlock implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if (event.getBlock().getType() == Material.STONE) { // Somente para blocos de pedra, você pode ajustar isso
event.setDropItems(false); // Impede que os itens padrão sejam soltos
// Lista de itens que podem ser soltos
ItemStack[] possibleDrops = {
new ItemStack(Material.APPLE),
new ItemStack(Material.COAL),
new ItemStack(Material.IRON_INGOT),
// Adicione mais itens aqui
};
Random random = new Random();
ItemStack droppedItem = possibleDrops[random.nextInt(possibleDrops.length)];
event.getBlock().getWorld().dropItemNaturally(event.getBlock().getLocation(), droppedItem);
event.setDropItems(true);
}
}
}
do you have a pom.xml
you are running a 1.8 server, setDropItems did not exist in 1.8
yeah
?paste it
Thank you. I was able to do it and I fixed all my issues as well.
you have the 1.12 api but you run 1.8
how to change?
1.8.8-R0.1-SNAPSHOT
event.setCancelled true
world.dropitemnaturally
instead of setdrop
what?
this should work
where to put this?
cat gpt
yeah
so just cancel and set the block to air
this?
how to set ?
event.getblock.settype material air
``
private static final Random RANDOM = new Random();
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if (block.getType() == Material.STONE) { // Somente para blocos de pedra, você pode ajustar isso
// Lista de itens que podem ser soltos
ItemStack[] possibleDrops = {
new ItemStack(Material.APPLE),
new ItemStack(Material.COAL),
new ItemStack(Material.IRON_INGOT),
// Adicione mais itens aqui
};
ItemStack droppedItem = possibleDrops[RANDOM.nextInt(possibleDrops.length)];
block.getWorld().dropItemNaturally(block.getLocation(), droppedItem);
event.setCancelled(true);
block.setType(Material.AIR);
}
} ``
Any help?
block drop item event if it existed back then
How do I drop any minecraft items? I want to be able to drop all items but in a single unit, how can I do that?
World#dropItem();
use a loop to iterate the material?
you said you want to drop all items
What would be the best way to store additional data for players and entities, i'm trying to make a custom rpg stats plugin similar to the way they do it on hypixel skyblock, with health, defense and mana etc.
what do you mean or both
pdc
i'm going to use yml configs to store data
pdc,mysql etc
and it will load data from config into memory on startup and load data from memory into storage on shutdown
what im more trying to figure out is what the class structure should be like
hold your data into objects and store the objects into a hashmap with uuid as key and their object as value
and those objects implement configurationserializable, so i can store them in config?
same could be said about your yml storage, use key as uuid and value as the values in the yml
it's up to you what system you use
if you use bukkit then yeah
why not set of data and data contains uuid
so is that the best way to do it then
slow search
hashmap and path finding would be easier if uuid is the key
ok i'll try to code that you might see me back here in a bit if it doesn't work lol
I have a custom entity with NMS for 1_8_R3. Inside the entity I have a spawn method, which spawns the entity and then also sets some NBT tags. See code:
public void spawn(Location location) {
((CraftWorld) location.getWorld()).getHandle().addEntity((this), CreatureSpawnEvent.SpawnReason.CUSTOM);
setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
setAI(false);
//setInvisible(true);
setSilent(true);
setAsleep(true);
setInvulnerable(true);
System.out.println(this.getNBTTag());
}
When printing out the NBT tag at the end, it prints out null. In the methods setAI(false) and setInvulnerable(true) I run the following method:
private void setNBTCompoundTag(String tag, boolean flag) {
NBTTagCompound tagCompound = getNBTTag(); // Tag is always null
if (tagCompound == null) {
tagCompound = new NBTTagCompound();
}
System.out.println(tag + ": " + flag); // {} (empty NTBTag)
c(tagCompound);
System.out.println(tag + ": " + flag); // NTBTag without the tag set, but does show everything else
tagCompound.setInt(tag, flag ? 1 : 0);
System.out.println(tag + ": " + flag); // NTBTag with the tag set.
f(tagCompound);
}
In here I get the NBTTag (which is null every time) and it creates a new tag in case it does not exist. It then sets the specific tag to 1 or 0 depending on the flag. This works, because if I print the tag there, it shows that NoAI is 1 and that Invulnerable is also 1. I assume for some reason the f() method does not update the tag for the entity.
These are the other methods mentioned:
public void setAI(boolean hasAI) {
setNBTCompoundTag("NoAi", !hasAI);
}
public void setInvulnerable(boolean isInvulnerable) {
setNBTCompoundTag("Invulnerable", isInvulnerable);
}
There's literally an option "display" in spigot.yml for tracking range also
?notworking in that case
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
that option is weird though. I set the tracking range to 128 for displays, yet it's still visible at ~155 blocks
if one does not change the view range on the entity object itself, it disappears at 80 blocks, even though it's set to 128 in spigot.yml
Wait I just found out that Entity#getNBTTag() always returns null. Could someone explain how NBT tags work and what the methods Entity#c(NBTTagCompound nbttagcompound) and Entity#f(NBTTagCompound nbttagcompound) exactly do?
Is there a util built into spigot to raytrace from an eye to their target loc?
World#rayTrace(....). use the eye location as starting point and use a predicate to filter out the entity that you're raytracing for
Alright so, invulnerable was working. Apparently you need to be in gamemode survival or adventure for mobs to be invulnerable. I was in creative. As for no ai not working, the string I passed was "NoAi", but should have been "NoAI"
So it was just a combination of two simple mistakes which made me think something was wrong with the nbttags
There's an API method for noai
not on their 8 year old version 😄
Hello - I am trying to debug some code but my console is only printing [15:07:56 WARN]: java.lang.NullPointerException
How do I figure out which class it is in
by reading the next lines
^
Check the log file, it might have more info
looks like you somewhere do getLogger().warning(exception.getMessage())
I wish, nope I am not logging anything
are you sure it's not from any other plugin?
or maybe it happens from within a task / runnable, in that case wrap the whole thing into try/catch and print out the exception in the catch thing
FactionValueCounter.startBlockCountingTask();
}catch(Exception e) {
e.printStackTrace();
}```
This is printing the same thing
what is startBlockCountaingTask() ?
It use to start my timer but i changed it to just run the method itself so i could attach to a command and spam
I just want it to tell me where the error is
It seems to be an issue within a chunk
I am counting blocks within claimed chunks for claim values
Chunk x8 z14 will null sometimes
but not everytime
FactionValue value = new FactionValue();
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 256; y++) {
for (int z = 0; z < 16; z++) {
Block block = chunk.getBlock(x, y, z);
Material material = block.getState().getType();
if(material == Material.MOB_SPAWNER) {
CreatureSpawner spawner = (CreatureSpawner)block.getState();
EntityType type = spawner.getSpawnedType();
if(entityTypes.containsKey(type)) {
value.incrementSpawner(type);
}
}
}
}
}
return value;
}```
This seems to be making it mad
But I just want it to tell me where the line is so i can debug it
But i need to know where lol
if ur not catching the error anywhere ur server impl is weird, pretty sure bukkit should print the stack trace if an error occurs in a scheduler task
well you haven’t shown us the but you log it
where is that weird "start done" thing coming from
That is my debugging lol
It is counting the spawns in each claim
Chunk coords x.z
can you show us that class that logs that
why the hell are you looping over all possible blocks (and without respecting world getMinHeight and getMaxHeight)
instead of simply getting all tile entities in that chunk
What can cause git issues while trying to create a branch? I just run the git init and then git branch <name>
what is the error msg?
I plan to make it also check for certain blocks
git checkout -b my-new-branch
Idk what else to do :p
I mean i doesnt even allow me to create branch, thats the most weird thing
upload the whole project go github
I just created a new git project by git init and then run "git branch <name>" to create the branch. And then that error
that means you don't have any master branch yet
you first have to commit sth
as mentioned you can also just use the regular way: git checkout -b new-branch-name
then you don't have to commit anything first
TIL that the local difficulty you find in the F3 menu was just an approximation done on the client. Not information it received from the server.
As to why the server doesn't send that information to the client, that's still a mystery. However, recent snapshots have turned the value into question marks to better reflect it.
I checked thru my older logs and found 19.08 16:15:42 [Server] [INFO] Caused by: java.lang.NullPointerException 19.08 16:15:42 [Server] [INFO] at org.bukkit.craftbukkit.v1_8_R3.block.CraftCreatureSpawner.getSpawnedType(CraftCreatureSpawner.java:32) 19.08 16:15:42 [Server] [INFO] at src.factions.faction.FactionValueCounter.countBlocksInChunk(FactionValueCounter.java:75) 19.08 16:15:42 [Server] [INFO] at src.factions.faction.FactionValueCounter.countBlocksInFactionClaims(FactionValueCounter.java:118) 19.08 16:15:42 [Server] [INFO] at src.factions.faction.FactionValueCounter.updateAllBlockCounts(FactionValueCounter.java:127) 19.08 16:15:42 [Server] [INFO] at src.factions.faction.FactionValueCounter$1.run(FactionValueCounter.java:137) 19.08 16:15:42 [Server] [INFO] at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71) 19.08 16:15:42 [Server] [INFO] at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:53)
With all my debugging ive moved half the lines around
So I can no longer pin point it
It seems to happen when player is offline
Does someone know how could I code (also using a texture pack), a progress bar with a text and a number above it? But I don't mean a bossbar, I mean a custom progress bar below the bossbar. Something like this:
The progress bar would be dynamic and the "NAME" would be: 'Zombie: 70 HP' for example
I got "Caused by: java.lang.IllegalStateException: Asynchronous entity world add!"
Don’t add entities to the world async
Usually you don't want to use async
I was counting the blocks using async so it wouldnt locked up the main thread while counting all the blocks
I can tell you that 99% of your code can be ran in sync
Ill try it on sync
Ah
The thing is it is counting all players claims and checking for certain blocks
Should I keep it sync?
Reading blocks should be fine to do async. Modifications need to be done sync though.
"it's just reading" doesn't mean it's thread safe
take a chunk snapshot sync and analyse it async
new BukkitRunnable() {
@SuppressWarnings("deprecation")
@Override
public void run() {
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 256; y++) {
for (int z = 0; z < 16; z++) {
int blockTypeId = snapshot.getBlockTypeId(x, y, z);
Material material = Material.getMaterial(blockTypeId);
// Perform your analysis based on the material
}
}
}
}
}.runTaskAsynchronously(Factions.getPlugin());
}```
Like this?
chat gpt!?
you could use a CompletableFuture
and supplyAsync to supply info and thenAccept to do changes or whatever u want on main thread
uh i mean, half the methods there don't exist, getBlockType already returns a Material, and chunks can go lower than 0 and higher than 256, but you should probably constraint the search within your claim boundaries, other than that, you got the spirit lol
Unfortunately I am using 1.8 for this plugin
does 1.8 even have chunk snapshots
Doubt it
One of these days, @Since tags will be added to the docs.
I'll do it myself if I have to.
fr
I genuinely don't think they have any benefit
We only support the latest version anyways so
except Player#throwEgg
Egg
Do it
And good luck :p
Can you explain why? I don't understand how better documentation is a bad thing. How does adding those tags advocate supporting older versions?
If one of the pillars of spigot is retaining backwards compatibility, to the greatest extent it reasonably can, then how does adding these tags harm that idea in any way? Java itself has these tags and uses them in their documentation. If anything it's documenting the evolution of the api.
