#help-development
1 messages · Page 1576 of 1
The wireless redstone thing was marked as "works as intended" by mojang if I remember correctly
Yeah that's normal
whats weird if you put a line of redstone like next to a piston but it isnt on the piston it works
like ik the power is transmitting to the blocks but why does the piston extend if the redstone isnt even near it
@prisma needle are you online on the backend server which receives the message?
how do i check if the owner of a uuid string is op? even if the player is not connected
what do you mean exatly?
Server#getOfflinePlayer(UUID#fromString(uuid))#isOp() @fluid cypress
thanks
Well thing is plugin message channels depend on a player connection, in order to send and receive you need a player to be on the server providing a connection the plugin message can use to transport through.
well I was online typing the command which should have run the method
I was on the spigot server
since the bungeecord is the proxy
Hmm, then it’s weird. From what I’ve red and seen it looks good.
No exceptions either?
Have you tried using the ProxyServer#registerChannel method in your onEnable I'm not sure if it's required for sending data
It is yeah
oh ok lemme check
I can just send the entire class here, how should I go about sending large amounts of code?
?paste
Upload everything to github or use this ^^
GitHub would be the superior way, if you don’t want to share it to everyone you could add significant people whom have access to read the code.
oh I really don't mind people "stealing" my code, it's really not worth using 😂
just me messing around
4*2(2*4?) piston door (worst ever)
alright, here is the Main class for my bungeecord plugin:
https://paste.md-5.net/qoqizivefe.java
and here is the class which sends the pluginMessage:
https://paste.md-5.net/wexuteguka.java
Fair lol, well not everyone thinks like that, frankly some are over protective
Oh bungee:bridge isn’t same as bungee:channel
Probably has to be the same

nope still nothing :/
If I knew whether it was a problem of sending or receiving the message it would be easier to troubleshoot
I'm setting up a quick test using your code I'll see if I can get it running
👍
Olivo taking one for the team 😌
For some reason the bundled java version is broken which makes it a pain to switching Minecraft versions
Lol yeah
Alright things are loading I'll see if it works
Is there a way for chunk generation in the overworld to remove all the generators apart from the "bedrock floor generation" that you see at Y0 to Y5
If you want just flatbedrock use a superflat world. If you want just bedrock with vanilla gen create your own world generator and look at the Minecraft source to find how bedrock is generated
here's the main class of my spigot plugin which should receive the pluginMessage... ideally saying "test" in chat when the message is received... if this helps :)
https://paste.md-5.net/hamuxaneci.java
CommandGeek
The channel has to be the same everywhere
For instance my:channel and bungee:channel are different
Conclure do you have any idea how to fix high CPU usage with Intellij
Do you use gradle?
yeah I updated those, just the pastes were made before you mentioned that to me
Ah well even in bungee you’d use the same as the spigot one
Olivo I believe you can change min and max ram alloc
Not sure if it helps (maybe it uses off heap)

man I feel super dumb rn
oh
man this is a smol brain moment
eh Don't worry about it, it happens to all of us at least once...
thank you guys so much for your help tho :)
Oh well do you unregister the channel btw? (In spigot)
no I don't, should I?
What's pmc 👀
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
oh yeah ofc
So check the onDisable there 🙂
perfect, thanks!
Custom command successfully added.
?pmc

oh nice you can add commands
Hehe
is discord helper like admin?
Hmm I mean what’s the definition of an admin in your POV then?
idk really
but if you can interact with all bots add things to the server or add any channels or maybe some other stuff like changing people nicknames i consider it as admin
¯_(ツ)_/¯
is this good for 48 chunks on 1.17.1(optifine)?
Is that on a server?
no
Aight
What should be "good"?
60 fps is okay
oh yeah if im on a server it never getting 60 fps
Oh you were asking whether the fps was good?
Map.of(k, v) returns an inmutable map? if so, how can i make it return a mutable map?
The point of it is to return an immutable one
pass the immutable map to the constructor of a mutable one
Anyone got an API like this but with 1.16/1.17 support? https://www.spigotmc.org/resources/multilineapi.33473/
i recommend testing on a vanilla overworld
Hey small litle question, whenever I generate my yml for storing data something weird gets added to the file.. as you can see there is a ==: with the className in it.. why does this happen?
thats why you did something like ..getInstance().set(path, player) right?
that is your class and it's so the parser knows how to deserialize it
I know it is my class, but is it possible to not show that in the file?
no
wdym, you can
show me then
this person has implemented serializable into his own class so that the yaml parser knows what to do with it
Correct
if they want to retrieve this object then all they do it get("player-data") and it will return an instance of PlayerHomeRepo
the ==: just tells the parser what type it is
Oh, thanks! 🙂
what does 8==D mean
o.0
any way to do an getConfig().get("uuid.*") to get all these values inside the UUID?
getConfig().getConfigurationSection(uuid).getKeys(false) will return name1, name2, name3, name4
its only a debug 😅
Hey, thanks man!
what the getKeys(false) do?
will return the values?
Is that what getMapList does? Would return {{ "name1": "Com whatever", "name2", true, etc }}
false is the deep boolean, meaning it won't return subsections
yeah, i want to return something like that
Like if you had yml something: something_else: "hi"
getKeys(false) returns just something while true will return both
thanks, i will study about that
i actually used getKeys true in a plugin of mine, but it's a very rare use case
if for some reason getConfigSection doesnt work you can also remake your config file name make it ```
name:
1: Com cer..
2: true
...
i need specify a name :/
its that not a config.yml
its a data.yml (player's uuid.yml)
im making an "variable saver"
wat
can anyone help me, how to make a timer that ticks once
Bukkit.getScheduler().runTaskLater()
How do you silently send a command as console via the spigot api?
Bukkit.dispatchCommand seems to always log
Why would you want to do that
other plugins without an api
so I have a question about what spigot/bukkit can do
I want to make a "new block" (which spigot can not do), but this block only exists serverside, it is sent to the client as an existing item frame entity. Is that possible? Its not adding a new block client side after all.
you could just use texturepacks
not in this case
ultimate goal of this is to make the server think of itemframes as blocks (like lichen) instead of entities
ah so put a block texture as a map?
but to report old itemframe entites to the player
I mean its possible to register new materials but its very iffy and i dont know if it would work well with itemframes
yeah good luck
basically, the player just gets a regular item frame entity when it looks at it
no fancy texture packs
but the server thinks of it as a really small chest or something
I was affraid of that
Hi, does anyone know the maximum expected wait time for a premium plugin to be accepted? I've waiting two and a half weeks and am curious how much longer the process might take.
i dont have a spigot account. i have a life
Based
yet you have a discord account 🤔
Hey guys I want to make a pvp plugin but I am not able to find any tutorial on yt so it would be great if someone can share a video
Thanks!
how about figuring it out yourself like most developers do?
Hmm
I can do that
But
I am a begginer
So ill have to watch a hundred tuts for that
XD
how much java do you know?
But I mean i understand thats how a programmers life work
i know java but i cant remember the basic layout of the code everytime and the setup of everything
in spigot
the spigot api is just another api that you have to learn, theres written guides for it and javadocs to reference
This has everything you need to know https://hub.spigotmc.org/javadocs/bukkit/
package index
yeah, thats pretty much my point here, theres not going to be a video tutorial for everything lol
take a look at the wiki and the javadocs, try to work it out, and you can always come back here if you need help
?xy
Asking about your attempted solution rather than your actual problem
eh he left
how can I make an Entity to an EntityCreature?
specifically a villager?
I know you can't directly cast them
?
ops
EntityCreature… what is that
it is a variable type
i know
cant you make the entity typ ea villager?
but which package
Oke
I have never heard that term before, what exactly is that?
if you dont know then probably not
yo gamers... why doesnt this filter out lines with login in it?"
getServer().getLogger().setFilter(record -> record.getMessage().contains("login"));
show me your pom in ?paste
?paste
non lambda version for yall
getServer().getLogger().setFilter(new Filter() {
@Override
public boolean isLoggable(LogRecord record) {
return record.getMessage().contains("login");
}
});
dk why it doesnt work
is 'pom' the class?
((CraftVillager) villager).getHandle()
a dependency
EntityCreature is Spigot's mappings
otherwise i was gonna suggest what Dessie did
Which is what he's using
i see
why does it look like that
are you on your phone or is it like a google theme?
iPad
anyone know what the problem is?
Asking about your attempted solution rather than your actual problem
disable the logs and output to console if it contains the string login
well
right now
it says that if it has login its loggable
you want the opposite?
i tried both ways
it doesnt work
even just setting it to be always no logging
doesnt work
Go for it
is there any good way to heal a set amount besides?
if (player.getMaxHealth() - 2 >= Math.ceil(player.getHealth())) {
player.setHealth(p.getHealth() + 2);
}
thought of a better way to do it
p.setHealth(Math.min(p.getHealth() + .20,p.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue()));
player.damage(-2)
it just doesn't deal damage sadly
Heyo, I have a security query. I currently have a problem with clients purchasing custom java plugins from me. They pay half of the invoice, then I send them a file and 25% of the time they block me without paying the remaining 50%.
How should I protect my plugins while still giving my clients a file before they pay the remaining part of the invoice?
Here is what I've come up with so far:
- Obfuscate the program using ProGuard (or other programs)
- Loading the jar during runtime by downloading the classes into ram from my api server
- Including a license feature which queries my api server on startup
What should I do, and are there better ways? Thanks! (if you respond, ping me please <3)
charge 20% before you start then show them the plugin, make them pay the remaining 80%
NEVER charge after you give your product
If they dont trust you, their bad. You are providing the service
but also licensing for plugins 🤮
and there always ways of getting around authentication
Why is licensing bad?
(if they're paying for a plugin they probably don't know how)
double the price and say them then 50% first
its a serverside minecraft plugin and they have the full power about it. they can just manipulate your jar
Not necessarily
If its obfuscated it becomes much harder, plus they need to have (or know someone that has) Java experience.
ofc., its java
maybe a stupid question, but how can i prevent a concurrentModificationException from happening here?
private double calculateAverage(List<Double> list) {
List<Double> _list = new ArrayList<>(list);
return _list.stream()
.mapToDouble(d1 -> d1)
.average()
.orElse(0.0);
}```
its happening at the mapToDouble line
by uuid, username may be inaccurate which is why it's deprecated but sometimes it's all you've got
it also does a network lookup so do it async
how to make this?
d1 -> d1, yes
replaced with Double::doubleValue and seems not to happen anymore?
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
magical what the internet contains
my code runs sync tho
oh wait nvm not that part
regardless the source list is being updated in that same task
and nowhere else
wasn't talking to you
don't make a BukkitRunnable
just lambda
scheduleAsyncTask(plugin, () -> {/*code here*/}
that way at least that part won't be deprecated
Someone know why when player join it change scoreboard to his scoreboard to everyone like set username entry to his name
like if my name is Player
and Player2 join i saw in my sidebar
Username: Player2
after he join
Main.java:
https://haste-bin.xyz/efokizoray.java
PlayerJoinEvent.java
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
player.setScoreboard(PVP.board);
}
Main.java 😋
static abuse 😋
it's because everyone has the same scoreboard, that should be pretty straightforward
so how i need to save it for that will dont be happend?
Do I need to use async to pull information?
my eyes
also, i would, yeah
what thats mean?
the sky is blue
I can't help you if you don't understand basic english bro
I'm being mean i can't help it
Make PVP's board non-static
i mean how i do that like
board.player_uuid?
let me try
Map<UUID, Scoreboard>
join, add player; leave, remove player
make a separate scoreboard for each one, update appropriately when needed
if i remeove static i cant use PVP.board in join event
fetch from hashmap
Well then you should learn how to use dependency injection
Better practice to use uuid.
^
doesn't really matter here since the player doesn't change when logged in
For consistency's sake, since player objects are not equal when a player relogs
Yes, doesn't really matter, but I'm trying to teach the correct way here.
well, if a player relog, he is reput back into the hashmap
hmm
so i need every event that need to fetch all online player instend use the player joined?
I would think player has a better abstraction barrier
oh it moved to the .average now
Underscores in java 🤔
yes im casually moving some command from my plugin to a sugarcane built in command lol
Is this the best way to get an offline player? I saw on spigot
yes underscores
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
args[0] is a string? convert into UUID
can someone tell me what im doing wrong?
private double calculateAverage(List<Double> list) {
List<Double> _list = new ArrayList<>(list);
return _list.stream()
.mapToDouble(Double::doubleValue)
.average()
.orElse(0.0);
}```
args[0] is a name of player
following tutorials while simultaneously asking for help
lol
keeps throwing ConcurrentModificationExceptions even though i know of nowhere where im modifying the list
Why? I did not understand
since the only place i modify it is about 20 lines or so above it, same runnable
😕
not sure why you're making a copy (which is just a shallow copy anyways)
^ youre not modifying it so no point making a copy
maybe try running it from another place in your code other than a runnable
not sure what else could be causing it
yeah thats what i thought yet it keeps throwing ConcurrentModificationException
about every time i call it
but not always, only after a while
my code shouldnt be too slow to run for >1 tick tho
nothing wrong with this itself, just checked
here's my entire runnable
i have a feeling its running more then once per tick somehow
though its only in that calculateAverage function that it throws an exception
(the bukkit runnable gets started in my command's init)
mm terminology flying past my head rn
holy moly
hm?
thats already refactored
it was ctps before
ah yeah no its because i was renaming variables
snake case or camel case tho
and what happens if you run it sync instead
camelcase
i dont know java semantics off the top of my head lol
only language like ruby uses snake
in C# it depends on where
On which site do you put your code and share it with others?
me? pastery.net
?paste
thx
It's just to show my code, what do you think? it's a house system
I'm new to all this.
👉 👈
it moves very far to the right
It is ok for new programmers i guess
what is that indent level lol
oh its tab indented
hes using tab indents and md-5's paste thing shows it as 8 spaces
ok class name UpperCamelCase
if (!(sender instanceof Player player)) return;
boom code stays in line
or PascalCase
the same thing
why is it rendering as 8 spaces -_-
just I not sure which one you prefer to call it
what ide
most probably configurable
use vim
jk
they shouldn't be tabs
What do you think I can improve?
they should be spaces
nobody should ever use tabs
even a tab in ide should be converted into spaces
most ides do that to my knowledge
I don't use it, I use the automatic eclipse format.
I personally prefer polymorphism for executing commands
How it works?
if (args.length == 0) {
return response(sender, "&cNot enough arguments!");
}
private boolean response(CommandSender sender, String message) {
sender.sendMessage(ChatColor.translateAlternateColorCodes(message));
return true;```
document.body.style.tabSize = 4; in console
?paste
what is wrong? I need to set helmet and clear cursor before clicking
https://imgur.com/eJkDZpS
https://paste.md-5.net/gozikewamu.cs
I used to do this: https://paste.md-5.net/somawigixu.java
CSComd is another abstract class I wrote
then I will execute the logic separately
i think polymorphism is using switch+case
holy moly
separation of concerns, baby
https://github.com/Redempt/RedLib/wiki/Command-Manager make your lives easier kids
i made a userscript to change tab width to 4 spaces on the paste site
you need to use net.md_5.bungeecord lib, not org.bukkit
org.bukkit.ChatColor works same
use IntelIj IDEA, dude
oh wait nvm
insert '&' before message
oh yeah i forgot that
thats not in an ide tho
two params
was typing it with two twiddling thumbs on my phone
it need the char symbol for replace
still am
('&', message)
Intellj not an ide?
no idea who thought tab = 8 spaces was a good idea in a browser but it seems standardized
Is there any way to cancel console messages about named entity killing someone or dying?
my eyes
hm?
hm?
your eyes what
what
what about your eyes
nothing
you talking about those system logs?
yea
nothin is wrong
whose code is this?
link
oh
nah tab size doesn't bother me
it bothers the living hell out of me
the lowerCamelCase is more bothering
omg lol
How to btw?
that's one of the more irritating thing I had when working with react on rails
idk
cuz rails uses snake but js or ts uses camel
fun fact: bing is C#
they seem to have hidden the dotnet version
ok so turns out, that code i was running async is really slow
when i disable the code my mspt = 1ms
when i enable it, it jumps to 38ms
whats the most efficient way to get cpu usage?
return response(...
My god, how could I be so blind.
time to run timings on the server lol
man im impatient lol
okay so turns out getProcessCpuLoad is slow
lmao
method to get cpu load causes cpu load
sounds like something mojang would make
lol
is there a better way to get cpu usage aside OperatingSystemMXBean
lets see how spark does it
nope, they use OperatingSystemMXBean
maybe i should learn to use the RollingAverage class
i moved the cpu thing into its own async runnable
making sure nothing else touches those variables
idk if its better but you could use the Runtime class
you are not supposed to understand 0101000101110011
this is the code
good luck understanding it
its just an inventory
but it doesnt work
simple code
okay and what exactly
anyways
what does not work
I can screenshare
any reason why paper doesnt stop tasks?
like, nowhere in paper's waitForAsynkTasksShutdown does it actually stop the task
the line on the rightclick.onclick is where I open the inventory
ok then paper
spacedash your thing is less important than mine
SkullCreator line 173
oh god
no it isnt
its an api
this thing idk
its somehow out of bounds
i dont know how thats even possible
but when I try it with like if(Main.plugin3.blabla) it works but when I add "!" at the start it doesnt work
thats what i dont understand
and i know exactly what you mean
good
I think i found the problem
I am illiterate
yeah i dont know how to write
I wrote "TeamSpeak" in the config but in the code "Teamspeak"
How do you not understand it if you wrote it? Or is it not your code?
I fixed it
this
broke the whole thing
Well don’t copy paste code in the future if that is what you did
i didnt
this converts a list of UUIDs to a list of players right?
in the parameter of the sendPacket function
“sight”
not sure why testitandsee doesn't exist yet
no idea what you're talking about
sights
i think he means that you spelled side wrong
A really bad one that I don’t get at all

you must be fun at parties
I do a bit of trolling
How is saying “this site doesn’t work” funny? Or is it out of context
the joke being that I was pretending that the site was actually going to be a useful resource and was confused that it didn't work when it was obviously just an unhelpful link?
whether you find it funny or not doesn't really matter much anyway, there's still no need to be rude.
🤦
Do anybody know why snakeyaml can't find my kotlin data class?
I tried the same code without the spigot server and it works.
Caused by: org.yaml.snakeyaml.constructor.ConstructorException: Can't construct a java object for tag:yaml.org,2002:cn.thelama.homeent.warp.LocationEntry; exception=Class not found: cn.thelama.homeent.warp.LocationEntry
in 'string', line 3, column 6:
a: !!cn.thelama.homeent.warp.Locati ...
LocationEntry is not registered
How can i register it
You do know Location itself is serializable
yeah i know but it isn't Location
what is wrong? I need to set helmet and clear cursor before clicking
https://imgur.com/eJkDZpS
https://paste.md-5.net/gozikewamu.cs
alright thanks
ConfigurationSerializable is from bukkit. Is ConfigurationSerializable matters the raw uses about snakeyaml.
Guys , how to make luckperms show the owner name yellow and every player can see it , i know how to use the api but , how to do this and also show him on Tab list ???
For snake see this answer https://stackoverflow.com/questions/42545091/snakeyaml-deserialise-class-containing-a-list-of-objects
My code
val yaml = Yaml()
val data = f.loadAsString()
val d = yaml.loadAs(data, MutableMap::class.java) // Gets the exception when run this code on server
thanks
@eternal oxide . ?
LuckPerms, nor any permission plugin affects the display in any way.
no
It is simply a store of information. How you alter tab and chat is upto your plugin or whatever plugin you are using.
when u see the ranks in servers , the people who have ranks have colored names ? @eternal oxide
how ?
A tab/Chat plugin
No
Yes
Are you asking for code to do it?
yes how ?
Name tag?
player#setDisplayName I think
@reef wind
okay but how to change the nametag
All I know is packets

not everything is one line of code mate
Google your question before asking it:
https://www.google.com/
I mean if only there was a search engine that spews out solutions for this
pro googling is a part of coding
You can always find answers
impossible I don't believe you
only spigot support channel can answer my questions

Is there a way getting the TPS of a specific world?
Worlds don't have different TPS
but what if spigot goes multithreaded?
Which means mojang has to do it
mc is already multithreaded lul
but not in a form where the tickrate would differ from world to world
how would I make respawn anchors explode in the nether like they do in the overworld?
Like stop them from exploding?
no
make them explode like when you place glowstone in them and hit them/place 4 glowstone in them they explode in ov
Just check for interact event and explode if it’s an anchor
is there no way to override the block functionality and make it have same functionality from overworld in nether
not without modifying nms source
Guys , How to change name tag of player luckperms (setdisplayname code don't work)
what field in ExperienceOrb actually denotes value?
count or value?
because merge is merging the count lol
@solemn shoal .
dont ping random people
No
:(
or well thats not what im currently doing
bump
Why are you still on this? I literally gave you a google search link where the FIRST post has your answer. https://www.google.com/search?q=Spigot+how+to+modify+tab+names?
How get command list?
Have you tried looking at the Javadocs?
Yea xD
You want every command registered to the server?
But on this server (no MC)
?1.17 Install 1.17 with BuildTools: <https://www.spigot...
?ask If you have a question, please just ask it. Don't...
?basics Here are some links to get you started on learnin...
?bt https://www.spigotmc.org/wiki/buildtools/
?cba {author} definitely regrets to for the most part ...
?changelog https://spigot.club/changelog
?changename Name changes on the forums are granted to those w...
?cla https://www.spigotmc.org/wiki/cla/
?contribute You can find information about contributing to Sp...
?conventions Java Coding Conventions: <https://www.oracle.com/...
?details Please provide your server version, relevant serv...
?di Guide to dependency injection: <https://www.spigo...
?discord Invite others with the official invitation URL: h...
?dmca An unofficial explanation of the DMCA can be foun...
?email support@spigotmc.org
?eta There is no ETA. Having an ETA leads to unrealist...
Probably shouldn’t have asked that in this channel lol
?eventapi https://www.spigotmc.org/wiki/using-the-event-api/
?fixmuhlag https://www.spigotmc.org/threads/283181/
?flags Aikar's garbage collection flags: <https://aikar....
?fw https://www.spigotmc.org/wiki/firewall-guide/
?google Google your question before asking it: <https://w...
?howtopostathread https://gfycat.com/healthymeatydogwoodclubgall
?irc IRC Chatroom: https://www.spigotmc.org/pages/irc/
?ischocoreal No, Choco is not real. I was not programmed to sa...
?issamreal Yes Sam is real. I was not programmed to say this...
?java16 Install Java 16 at <https://adoptopenjdk.net/?var...
?java16_linux ```apt-key adv --fetch-keys https://adoptopenjdk....
?javadoc Spigot: <https://hub.spigotmc.org/javadocs/spigot...
?jd Spigot: <https://hub.spigotmc.org/javadocs/spigot...
?jd-bc <https://ci.md-5.net/job/BungeeCord/ws/api/target...
?jd-bcc <https://javadoc.io/doc/net.md-5/bungeecord-chat/...
Oke
This is really weird, the respawn anchor won't be set to a diamond block until the anchor is fully charged (4 charges)
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block != null && block.getType().equals(Material.RESPAWN_ANCHOR) && event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
RespawnAnchor anchor = (RespawnAnchor) block.getBlockData();
World world = event.getPlayer().getWorld();
if (anchor.getCharges() > 0) {
world.getBlockAt(block.getLocation()).setType(Material.DIAMOND_BLOCK, false);
}
}
}```
That was how many times I right clicked the anchor till it turned to a diamond block
https://i.gyazo.com/fa7b7fba57137770a688748b1001eb02.png
I logged getCharges() before this if statement
if (anchor.getCharges() > 0) {
world.getBlockAt(block.getLocation()).setType(Material.DIAMOND_BLOCK, false);
}```
I'm stumped
Okay this is weird, I placed 5 anchors with one at each charge level, changed the code to below and I right clicked each one and turned into diamond block ;-;
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block != null && block.getType() == Material.RESPAWN_ANCHOR && event.getAction() == Action.RIGHT_CLICK_BLOCK) {
RespawnAnchor anchor = (RespawnAnchor) block.getBlockData();
World world = event.getPlayer().getWorld();
world.getBlockAt(block.getLocation()).setType(Material.DIAMOND_BLOCK, false);
}
}```
nvm fixed
but my code can works without running on server as a plugin
yes
and my data structure is really complicated
Map<String(Modules name), Any(Modules Configuration for this case should be LinkedHashMap<String, LocationEntry>)>
So i have no idea why it can't works on server
It shouldn't be
how i can nerf the strengh by 50%
try listen to damage event and reset the damage
@EventHandler
fun event(e: EntityDamageByEntityEvent) {
if(e.damager is Player && e.entity is Player) {
e.damage /= 2
}
}
if you don't want target/damager is Player just remove it
@eternal oxide
But how to change the player nametag
He probably does it in Java btw
hmm then```java
@EventHandler
public void event(EntityDamageByEntityEvent e) {
if(e.getDamager() instanceof Player && e.getEntity() instanceof Player) {
e.setDamage(e.getDamage() / 2)
}
}
setDamage
getDamager() getEntity()
java boilerplate 
fixed
pure java > kotlin
runs
kt let write things easier
Yup
I never ever saw a plugin made in kotlin
My plugins are all pure kt
Even Gradle build script
Nice, what do you think of kotlin?
obviously they hate it
traitor!
👀
naturally pure java and maven xml is superior
It's good most time but sometimes
how can i check the config string is "test"??
When accessing my class with reflection
Hey @worldly ingot I reworked my Crafting methods PR from last year, anything you would change about it? 🙂 https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/893/overview
Will get harder than pure java
@slow oyster instead of adding new methods, change the access levels of the fields so you can access them directly
I already showed you, unless you are talking about something other than the tab list now
i.e. private final InventoryCraftResult resultSlots; to
public final InventoryCraftResult resultSlots; // PAIL private -> public
can anyone help me?
Sure
config.getString
that doesn't work
exception?
i want to check if example is test example: test
Outside of that, just add some Preconditions.checkArguments(player != null, "player must not be null"); to all your arguments in CraftBukkit
(Use that instead of Validate too btw)
config.getString("example").eq("test")
if ("test".equals(getConfig.getString("example")))
getString might return null, so yea
this
@eternal oxide
Other the tab list
The name tag of main player not the tab
well kt is lot better then java in null safe
Okay, I have the validate checks in the getNMSRecipe method that they both call at the beginning of the method is that okay? I'll change them to use Preconditions though
if you are talkign about names over teh player heads then Scoreboards
@eternal oxide
Yes how ??
Oh that's probably fine then, james, yeah
Didn't see those
But yes, Preconditions#checkArgument() is best. Used throughout most of the project
Please just Google it. There are lot answers
The Validate ones are much older and should probably be replaced lol
but, this is for all the things no only strengh
U can check the entity effect
btw why this server can't send any image?
its really hard to show something when its long
!verify
Usage: !verify <forums username>
!verify Lama3L9R
A private message has been sent to your SpigotMC.org account for verification!
is it possible for a plugin to set a resource pack for your server if yes what methods should i use?
Okay sweet, made those changes now 🙂
LGTM 🙂 I'm sure md will have comments
@slow oyster the javadocs on the getCraftingRecipe mention a player parameter being required, while there is none (crafting events are also not published). probably just forgot to remove them during the copy of the docs 😅
lol, I'm guilty of that sometimes
happens lol ¯_(ツ)_/¯
Oh yeah nice catch, I decided not to send a crafting event on the getCraftingRecipe method since you only want to find the recipe.
Yea I agree, that method should not publish any events to handlers 👍
If anything does call an event you should document it
also just a design question, but are we actually happy with itemstack AIR being returned if the recipe was not found ?
I know spigot/bukkit loves to be inconsitent af with these
Example, recent method I pushed:
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Player.html#breakBlock(org.bukkit.block.Block)
Bukkit's ItemStack nullability is extremely inconsistent, yeah
I'd personally rather null tbh
Same, if you wanna stick to AIR then at least document that in the @return
imho, if it's to do with inventories, use air. If it's fetching data from anywhere, null
The Inventory methods shouldn't ever return null
but we're stuck with it for now
when i using a mongodb(on local machine) for player data storage should i fetch all the data when onEnable or fetch only when feature need?
Depends on what kind of data and how urgent it is
Claims, for instance, should be loaded immediately
What about players credentials?
NMS returns AIR for the recipes that are not found so I stuck with that since PrepareItemCraftEvent's may expect it
Might as well stick to NMS behaviour then
Would include that in the @return statement then
choco im bored give me an interesting thing to do
^^
related to java
I mean... what kind of credentials? I'd hope they're not stored in plain text.
login credentials

with passwords last login date and ip
And their mother's maiden name, first pet and name of their first school?
its encrypted with sha256. no need to worry about data leak
Okay. Well, in that case, still best to query on a need-be basis
No reason to load that immediately
It can be queried async when requested
ok thanks
@slow oyster are you sure that the resulting item stack is AIR ? I am looking at CraftInventoryCrafting rn and the result method returns null if the stack is empty
If its a localhost query in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/AsyncPlayerPreLoginEvent.html
is it possible for a plugin to set a resource pack for your server if yes what methods should i use?
net.minecraft.world.item.ItemStack itemstack = net.minecraft.world.item.ItemStack.EMPTY;
if (recipe.isPresent()) {
RecipeCrafting recipeCrafting = recipe.get();
if (craftResult.setRecipeUsed(craftWorld.getHandle(), craftPlayer.getHandle(), recipeCrafting)) {
itemstack = recipeCrafting.a(inventoryCrafting);
}
}```
Oh, no, Player#setResourcePack()
ok thanks! and would that require a server resatrt?
why is it called on the player instance?
Because it's sent to each individual player
well yes that is the internal representation but existing API returns null for crafting inventories that do not have a valid result
So you'd set it on player join
ahh makes sense, thanks!
declaration: package: org.bukkit.inventory, interface: CraftingInventory
which would be the one called during the pre craft event no ? I am not talking about passing null around internally, but you might want to convert to null at the end of your stack if the item is empty
tho I guess, that is also just preference on my end. bukkit is just too inconsistent with air vs null
how can i do like this getConfig().getInt("Example") - args[1]
is it possible?
i want to remove amount of int that was in config smth like 500 - 100
int value = (getValueFromConfig()) - Integer.valueOf(args[1])
i think
Oh yes you're right it seems PrepareItemCraftEvent does get passed null if the recipe doesn't exist, hmm
remember to check if the value from config is not null and the args[1] is an int
Well more or less
the event only has the inventory
which, internally represents the result as AIR
but when accessing it through bukkit it would be null
to set it in file use getConfig().set("Example", value)
config.set(path,value)
Thanks <33
"??
How can i set the config?
with this?
What do you mean?
Ah yeah, CraftInventoryCrafting returns null if the Item is AIR. I guess I might as well return null too then. net.minecraft.world.item.ItemStack item = getResultInventory().getItem(0); if (!item.isEmpty()) return CraftItemStack.asCraftMirror(item); return null;
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Yml is space sensitive
i want to set the config with this value
yeah, might as well. Might also just be nicer to work with from an API endpoint.
but then again, maybe md has some input on that
I know, but triple checked it.
And I even asked for help, but no one could do anything about it.
Thanks!
Although CraftItemStack.asNMSCopy() makes a null ItemStack return AIR 😄 😄 😄
yeaaaaa, it is a mess
I guess I'll leave it to just return AIR then. The prepareItemCraftEvent still gets sent null so it doesn't affect anything interally
okay, note it in the javadocs and wait for more md input 👍
getPlugin().getConfig().set("Data." + p.getUniqueId() + ".Coins"), value;
'set(java.lang.String, java.lang.Object)' in 'org.bukkit.configuration.MemorySection' cannot be applied to '(java.lang.String)'
Your value is outside your bracket
any way to access a custom sound introduced by a player's resource packs using spigot?
I can't wait to get this PR sorted since I can hopefully completely remove NMS from my plugin for future versions!
whats the api called to open a sign, enter a value and on close it gets what you typed in the sign?
ok can someone tell me how it is possible for a living entity to be tagged as not valid on the tick it is meant to spawn in
hey guys, for some reason my sidebar looks like this:
see how the numbers on the right are red?
what are you trying to do
spawn entities on a specific location
in my set display name function I always add ChatColor.RESET to the end of the name...
show code
for whatever reason the 1.17 update broke a very specific portion of this code
show error
I even printed it out before i send the packet to myself
are you trying to get rid of the numbers?
and you can see in the screenshot I sent earlier it's white
they should be white, not red
for some reason the colour of the objective name being displayed is influencing the colour of the numbers
oh wait
are they always red???
I may just be really stupid
i think so
worlds have different TPS
yes they are always red
there's a overall TPS and for each world a TPS
the world TPS can affect the overall TPS
i have no idea what im looking at
you have 600 lines of code with almos tno documentation in the main method
and i cant go 1 by 1
to see what they do
i would recommend you debug it
do you know wheres the problem?
all that matters is line 70-71 and 80-82
every time it reaches line 82 it says the entity isn't valid
the one I spawned on 70
except
well
no they don't Irgendwer tf
randomly when it doesn't
and it is truly random, it doesn't even really work for the same entity consistently
there is
No
if only each world ran on a different thread lol
Worlds tick method is called by the main heart beat thus the same tps
so why are living entities saying they're not valid on the tick they spawn in?
what can cause that and how can I fix it
isValid
boolean isValid()
Returns false if the entity has died or been despawned for some other reason.
Returns:
True if valid.
if (!this.villager.isValid())
new DeveloperMessage("Villager isn't valid");
yeah that makes less sense
when the spawned entity is valid
unless it manages to spawn AND despawn on the same tick and before my code has a chance to run
meaning it died for some reason
and only does it for some of them
surely it's not getting killed before 2 lines of code have run
why is that red lol


