#help-development
1 messages · Page 1856 of 1
Still, stupid
yes, our minecraft plugin must save some milliseconds of runtime
????
getDislayName from the ItemMeta will return §
in that specific case sure
If you use another char I guess you could use replaceAll
or you use the actual method that will do it EVERY time
thought they meant like chaining replace all calls with a simple regex
but still.. dumb
Or just translate it first
or you could simply change the regex
ok
and no
the stripColor dont translate the & to §
also, it uses the replaceAll
do you have any point in this conversation
is that a question?
no its a statement
is there a way i can find all instances of a set of characters in my strings and then replace all those instances at once in intellij?
i would use the ctrl f "select all occurrences"
yea ctrl shift r is shortcut for that iirc (what pulsebeat said)
Does anyone have further information regarding this? https://github.com/SpigotMC/BungeeCord/issues/3197
There's numerous opened issues regarding the very same thing...
`listeners: query_port: 25577 motd: '&1Another Bungee server' tab_list: GLOBAL_PING query_enabled: false proxy_protocol: false forced_hosts: pvp.md-5.net: pvp ping_passthrou...
only if i need in my specific opened file
is there a method like this in map
NamespacedKey key = namespacedKeys.get(keyStr);
if (key == null) {
namespacedKeys.put(keyStr, key = new NamespacedKey(plugin, keyStr));
}
putIfAbsent?
let me eat your toes
Can you summon a snowman with a pumpkin peeled off?
Snowman#setDerp
derp
hi, for example if I have 2 points of Yaw, one is -125, and the other is -170. How do I know if player is looking in between those two. I know how to get the yaw of the player. But I don't know how to Boolean it.
Thanks
< >
less than and greater than signs
will do this
Ok now, I have two more Yaws. -170, and 170. How do I know if the player is looking inbetween them
monke < human > money
why did it put an A in front of all the characters
the answer is my previous message
use greater than and less than signs
And have you saved the file with the right encoding
why shouldnt it
i think that now it depends on how do you want
this is like basic math
?learnmeth
its just a character
i needed computeIfAbsent to return the value no matter what in one line
public <KT, VT> void set(PersistentDataContainer pdc, String keyStr, PersistentDataType<KT, VT> type, VT value) {
NamespacedKey key = namespacedKeys.computeIfAbsent(keyStr, (v) -> new NamespacedKey(plugin, keyStr));
pdc.set(key, type, value);
}
?learnmath
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
?learnjava
are you using §?
Dude
imagine not learning math before making plugins.
its not basic math
bruh
no im using translateAlt
it is bro
minecraft yaw is not
use utf-8 on the server
literally simple as shit
Yes that
if it isnt basic math then you probably grade 2 or even less
Gosh imagine I though you did the code goodly
Minecraft yaw is prob easier than an actual gyroscope used on a robot that I had to program using the exact same thing I said above
How do I know if player is looking in red?
im a good at coding
you cant use < > because -170 and 170
sadge bro learn math
yes you can...
I do the code welly
this way seems to only work for one class file at a time
is there a way i can do it for all my class files
if (player.getPitch() > 170 && player.getPitch() < 190) {
}
I wish java had a quick way to check a range
Pitch cannot be grater than 180
Well, quick and not cursed
AH YAW
yeah but yaw isnt pitch
Yaw cant be greater than 180
@quaint mantle Do you know anything about this?
nope
?jd
Great
You're a spigot discord helper and you haven't interacted with bungeecord?
correct
but yaw is |
pitch is -
?
Ok
like you mean... up and down by this or smth else
a quick google search led me to this
yaw should be rotation around the center point
anglediff = (facingAngle - angleOfTarget + 180 + 360) % 360 - 180
if (anglediff <= 45 && anglediff>=-45) ....
The reason is that the difference in angles is facingAngle - angleOfTarget although due to wrapping effects, might be off by 360 degrees.
The add 180+360 then modulo 360 then subtract 180, effectively just converts everything to the range -180 to 180 degrees (by adding or subtracting 360 degrees).
Then you can check the angle difference easily, whether it is within -45 to 45 degrees.
have you try selecting everything?
ok i did the ctrl shift f way
Who the hell picks helpers in this discord? What's the point of this discord if I can't even get some support on a fairly important issue...
im not a helper im a moderation helper
we arent super engineers
i've gotten all the occurrences i just dont know how to replace them
well i mean redempt is pretty smart
+1 im using their library
lol
yes but im stil lconfused tryna understand it
we arent here for support, but we are here for fun 🥱
Optic may disagree :p
add 360 to all of the range values
so
fair, fair
I dont get how minecraft is literally more complex than an actual gyroscope
What the hell is the point of asking a server question in fucking #help-development ??
its clearly not code related
programming/development
Is that not clear enough?
do you even read all of that?
This is literally the spigot discord... this is a development channel...this is a development issue...
this is most likely a code related issue
but i dont sometime i thought this was general chat because #general is just #help-development but better
there is nothing on the ops side of the server that is causing this issue
he has provided no code at all
that does not mean it is not a code related issue
Here it is
??
you act like we work on that
My question is simply how do I consider 180 as being in between -170 and 170??
(facingAngle + 315) =< (angleOfTarget + 360) =< (facingAngle + 405)
idk people was using pitch and yaw too much i forgot which one
oh gosh
example for 45 degrees
where did you get 315 and 405
add 360 to each side
random numbers generator
i think in your case facingAngle would just be 0
yes probably
and fecing angle is 45
i cant even spell facing correctly
getYaw returns -180 to 180 right?
-170 + 360 = 190
360 + 170 = 530
190 <= 360 && 360 <= 530
try this?
wait you need the angle in there too
the angle of target would be the pitch i would assume
pitch is not important
but then how are you gonna see if its in range
Yaw
ok you want yaw thats fine
well you cant turn around in mineraft by just moving your mouse down and doing a backflip but reverse
doesnt the yaw lock at 180
yeah
im pretty sure you'd just change 360 to 180
I already had the solution to that
if (minYaw < -180 || minYaw > 180 || maxYaw < -180 || maxYaw > 180) {
if (minYaw < -180) {
float extra = minYaw + 180;
minYaw = extra + 180;
}
if (minYaw > 180) {
float extra = minYaw - 180;
minYaw = extra - 180;
}
if (maxYaw < -180) {
float extra = maxYaw + 180;
maxYaw = extra + 180;
}
if (maxYaw > 180) {
float extra = maxYaw - 180;
maxYaw = extra - 180;
}
}
I have this BukkitRunnable now, How can I run init of this class and run runTaskTimer?
My smol brain reached new sentryTask().init(entity); but I can't think of it anymore.
Why do you have an init method and not a constructor
Java Coding Conventions: https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html
i have no idea where should i place constructor
change class name to SentryTask to follow UpperCamelCase naming convention
instead of an init method, create a constructor
where do you get 360 and where do I put playerYaw?
didnt you already solve it
new commands?!??!?!?!?! WHERE IS OTHER COMMANDS LIKE ?DDG?
Anywhere?
Generally at the top, but they can go anywhere
this command has been here for months
?learnjava when
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
yes but youre comparing 360 to 190 and 530?
oh i mean it isnt that necessary to learn java just to know where to place a method lol
sorry
theres a lot of other commands, sam disabled the list sadly a few months back
give list
I cant see any 180 or 540?
well now you said you wanted yaw
which locks to 180
if i want the range to be between 160 and 20
im no genius here
as i said, sam disabled it months ago
i wonder
160 + 180 | (the degrees to compare) | 20 + 180
Yes Sam is real. I was not programmed to say this by Sam.
No, Choco is not real. I was not programmed to say this by Sam.
340 | (degrees) | 200
then
wait, what is the range you mean?
got a question with custom events
if your event is cancellable and you dont want to do anything if a plugin cancels it how do you wait for every handler to do their thing?
160 and 20?
if (340 >= degrees && 200 <= degrees) {
}
?
like
160 is 20 less than a full 180, then resetting to 0
:( i see i didn't give you enough informtion yesterday
is private LivingEntity entity is not a constructor?
yes
k wlel first lemme see if what im rambling on about works
What are you rambling on about
how do I prove that 180 is in between -170 and 170
a constructor is a method that has the same name as your class, it lets you have arguments in the new NameOfClass() calls
Well it clearly isn't
well it is.
if a custom event is cancellable and you dont want to do anything if a plugin cancels it how do you wait for every handler to do their thing?
or does callevent block?
So you mean between -180 and +180 then
yeas
and now i have to prove that 360 is in between 10 and 350
This is so fucking simple but nobody has an answer for it not even me
how did i forget this
Because their question does not make sense
Mr bishop answer this
minecraft does not make sense
You have 340 degrees of freedom and you want to rotate 360 degrees is what you're saying?
damn
i forgot how to calculate this
help
like
Calculate what
for ex: 4^8/4^6 =?
4^2
I want to kill player if he does a 180 too fast...
or bedmas
snapped neck plugin
sexy
You could've just googled index laws lol
dunno the words
YES
:sadge
but there are more than snapped neck...
static ArrayList<String> modules = new ArrayList<>(Arrays.asList("playerPunchedAir", "playerTooHigh", "playerBrokeTooSlow", "playerAteTooMuch", "playerOverworked", "playerSlipped", "playerTookDamage", "playerTooHealthy", "playerSwam", "playerNeckBroke", "playerCrouched"));
parentheses
exponents
multiply / divide (left to right)
addition / subtraction (left to right)
technically pemdas doesnt apply to that
4^2 = 16
Oh i see
you devil
1/16(16) could be left to right or 16(16) then divide
You'd have to track the angle of rotation, which may be impossible if the player does a 360 quicker than the event fires
yeah but even mathmaticians say that it could be (1/16) * 16 or 1/(16*16)
which doesnt make any sense to me
i would just go left to right, right
how I learned it would be 4^8 / 4^6 which would end up as 4^2 which is 16 ¯_(ツ)_/¯
Free Exponents Division calculator - Apply exponent rules to divide exponents step-by-step
yeah you subtract the exponents
yea what i learned back then was like 4^8 - 4^6 = 4^2 so that i can get 16
n^a * n^b = n^(a + b)
n^a / n^b = n^(a - b)
n = 4
a = 8
b = 6
kk
4^(8 - 6) = 4^2 = 16
why are we doing elementary math in discord
dunno
why not
lmao
wait it is elementary in your school system?
well i was a nerd back then
mine is secondary, in grade 6 or 7 i think
so i just googled math stuff to impress my teachers
🐲
I feel this in my soul
i cant understand that system we still use numbers for scores and stuff
dunno A or B,C,D+
Z
ServerCommandEvent
def isMiddle (a, b, target):
a = a+360
while a > b:
a = a-1
print(a)
if a == target:
return True
return False
print(isMiddle(10, 350, 360))
FINALLY LMAO
@quaint mantle
That just looks like a lengthy way of writing a + 360 > b && target > b
YES BUT IT WORKS
Right
Left
politics
Anyone familiar with bstats?
Cause I am getting this awful error when trying to intialize my plugin and I placed everything correctly https://paste.md-5.net/sejufucawa.rb
So I know about ways to spawn in entities which are custom models through blockbench but I was wondering if there was an equivalent for that for blocks
or structures placed around the world instead
Noteblocks is the common method
any links to guides or info on this?
how do I know if player crouched?
ExhaustionReason.CROUCHED only fires when player is walking and crouching at the same time
Toggle?
dont that only fire if they set their crouch to toggle mode?
No
does anyone know how to check the player a snowball hits
they dont do damage anymore im pretty sure
nvm 😄
u dont even need damage for this event
what is a ip
i didnt even try but it works now, i think it was broken one patch
You want to know what an IP is?
ok but do you have the ip?
Hi :) I've been trying to use Genson in a plugin for a while today, and it only works up to a point, which I'm trying to debug
Here's a small code snippet:
Genson genson = new Genson();
String serialized = genson.serialize(playerWarpList);
List<warpObj> listhappy = genson.deserialize(serialized, List.class);
player.sendMessage(listhappy.get(0).getWarpName());
and here's the errors: https://hastebin.skyra.pw/rolafexure.css
Basically everything works perfectly fine until the last time where it's unable to do .getWarpName() which is just a getter which returns a String.
deserializing works fine, in the debugger I see my listhappy and its full content, perfectly deserialized, and if I try to print listhappy.size, it works, but as soon as I try to get a specific parameter inside warpObj is prints errors, even if I can see in the debugger that they're all perfectly set.
Anyone got any idea what's happening? Me and a team of 2 other friends have been googling for hours without success.
No idea wtf genson is, but you likely need additional work to deserialize generics
With gson it would be, eg, a typetoken
I want to bring all the entities in the server as a Collection.
What method i should use?
seems like a newer JSON lib
although one of the first commits
the .gitattributes
was 9 years ago
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getEntities()
or
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/World.html#getLivingEntities()
probably.
afaik there is no way to get all of them in the server with a single method, need to do 1 world at a time, also this is only going to return loaded entities.
We couldn't get gson to work, that error kept coming back: Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.Object java.lang.ref.Reference.referent accessible: module java.base does not "opens java.lang.ref" to unnamed module @3ad8a16b
it seems to be an issue that arrived with Java 9, so downloaded and switched my project to Java 8 to no avail
That’s an issue with newer java, is genson updated to support that
Maybe, at least it didn't seem to cause any issue, while with Gson as soon as we tried serializing it directly gave that error
Not helpful without the full error
Are you trying to serialize a class with a non primitive field
Thanks :)
More specifically a Reference
https://hastebin.skyra.pw/gogozatiru.prolog my bad
I'm serializing a list that contains warpObj, which contains 3 fields, a String, a UUID and a bukkit Location
what did the STATIONARY_WATER and STATIONARY_LAVA materials turn into?
You can't just throw a bukkit location in and expect it to work
Because that contains a World and how is that gonna get serialized
WATER and LAVA
thats what I thought I just wanted to check
Also how badly do you need json
Anyone know a way to move a players velocity towards another
Not quite sure how to do it logically
The API contains extensive yaml infrastructure, which will handle such things automatically
I'll have to look into that, thank you, I tried to go with something I already knew a little, but I see how that's not a great idea
You can get a vector between two points with vector2.subtract(vector1)
so basically subtract the players velocity with the other players and use the difference as a midpoint?
wasn't there a trick to giving entities unbreakable hats by giving them a material could be put in the hat slot but didn't actually display in-game, though it still counted as a helmet so it wouldn't break in sunlight?
Or you can just cancel the combust event
EntityCombustEvent
does that prevent the visual combustion as well?
Should
my entities with fire resist are still always on fire which is a bit upsetting
hey im trying to use the player.sendtitle. is the int fade. fadeout and stay time in seconds?
ticks
ok thnx
is it just me or the sun in minecraft movement is not linnear
is there any way to make ShapelessRecipe or ShapedRecipe has ingredient of ItemStack?
RecipeChoice.ExactChoice says it can be allowed only in ShapedRecipe
thx
WHY IS THE SUN MOVEMENT NOT LINEAR
How do you know it's not linear
How to fix this?
?
ive gotten the time at when the sun is at 0 pitch, and the same but on the other direction. I get the time per pitch, then I set the time, and Time and Pitch does not match... They only match when it's noon...
ive also found a reddit post about this. https://www.reddit.com/r/minecraftsuggestions/comments/1f3pr4/make_the_sun_and_moon_move_linearly_across_the/
23 votes and 13 comments so far on Reddit
That's a 9 year old thread...
yes
What are you trying to do
When you said "handles it automatically", what did you mean? I'm trying to Google it and familiarize myself with how it works, but it all seems to point out to the idea that I could split up my Location into x, y, z, world name, and serialize those, then reconstruct from that, but I feel like that is handled just as well using json, am I missing something?
That’s exactly what spigot does for you
Either change that or run the server with the full path
Do what Coll suggested
Have you tried googling it
Do you perhaps have a wiki page or something like that to kickstart my learning? I've been looking around and from what I see it all just repeats the same idea "You can't serialize a block, you need to [break it up into its component]" for example and I don't see where that would be done automatically
How to change default java version?
the sun is not linear :<<
is it legal to open plugin code and take help from it?
yes
as long as you are following the license and in most cases not redistributing it
You can’t take the code directly thought
Unless the license allows it
In which case it’s probably open source already
i wont be uploading it anywhere
then you're fine
Oh look default profile picture buddies
A catfish or a catfish
like
set my profile pic to a woman
last time this desperate dude wanted to date
only on spigot grove
is there any event that fires if the player looks at the sun
or something that tells the sun location?
not getTime(). the sun movement is nonlinear and it sucks...
Hey, don’t expose me like that
You’ll have to do math using the time
Didn't it work normally without putting anything inside getWorld() ?
I told you.. sun movement is nonlinear. I already did some maths
Non linear equations exist
f(x) = x^2
No, which world is it supposed to get
A server has many worlds
the sun doesnt move like that...
lmao
my server have only one map, then just input 0?
nope
Actually you would use getWorlds.get(0)
so much for killing players when they look at the sun
What do you mean “nope”
its only for forge
Then take the code from forge
NOPE
Also no, it does look like it’s in the vanilla server
Yep, it is
Not exposed in the Bukkit API thought I assume
If the server is forcibly turned off with task manager, etc., may onDisable() not work properly?
Yes
It will only fire during a proper shutdown
DecimalFormat
can i make a nbt-different coal can't smelt anything?
What's the best way to check if a player is falling when they login (using the playerjoinevent)
isOnGround() may be useful
(Deprecated, but good enough for this purpose)
or Number.isInteger(int) can be useful i think
Might just use this, in conjunction with isFlying()
How do I hide specific tab commands?
the attack method for living entities just simulates an attack from the entity directly regardless of circumstances right
it's not going to actually make it walk up to the player and attack?
Correct
What?
if entity Unloaded by some reason, what return entity.Isvaild will?
i guess false?
Yes
isValid will return false of the entity is dead, no longer loaded, or removed for some other reason
Its, cause lag?
what about when the entity dies 🙂
Did you not read the docs
It is still there
It clearly says “returns false if the entity has died”
Make that array outside the event
cause lag? or no
no im talking about pdc'
😒
Even if it is false, can I still access the entity?
I mean, you have to have an instance of the entity to call the method
But no, most other methods will probably fail
so sad
a terrible idea, but something you could do if you need the entity to remain valid would be to keep the chunks loaded that the entities are in, but this could use up lots of ram if you have lots of entities in different chunks
Can anyone say whats wrong with this code? my player is not recieveing the title message and in console it says - Could not pass event PlayerJoinEvent to my-plugin
Post the full console error
Not running Spigot
i dont get it
You're not running spigot server software
but im running paper
is that the problem?
Right and this is spigot
ur running paperspigot and using spigot api i assume
paper changed their methods to kyori
oh 1.8.8
nvm then
im using the api version 1.12
Well that’s why
sendTitle didn’t exist in 1.8.8
You can’t just magically use it by referencing a newer API
Also, we don’t support ancient versions
Do you want to get the amount of Blocks placed for a specific type?
int placedStones = player.getStatistic(Statistic.USE_ITEM, Material.STONE);
how all blocks?
idk iterate over all blocks and sum the statistics
ok, thanks
Something like
public long getTotalAmountOfBlocksPlaced(Player player) {
return Arrays.stream(Material.values())
.filter(Material::isBlock)
.mapToLong(type -> player.getStatistic(Statistic.USE_ITEM, type))
.sum();
}
Thanks
i mean.. that's actually quit insane holy crap thanks
how block break?
How would I be able to spawn a Client Side Armor Stand in 1.18 Mojang Mappings?
armorStand.setGravity(false);
armorStand.setCustomName(text);
armorStand.setCustomNameVisible(true);
armorStand.setInvisible(true);
armorStand.setSmall(true);```
WorldServer is outdated and I don't know what the new Mojang Mapping for it is
How can I make a count of how many blocks have been passed? flight and walk
@lost matrix
@ivory sleet
https://timcloud.ddns.net/mapping/
wait until the sub-page is loaded and then use the search box on the top left
Hey
is there a way I can make this variable?
String tpa.p.getName() = player.getName();```
being able to use a variable inside the declaration of another variable
you want to names to be the same variable ?
or you wanne set the tpa.p name to player.getName() ?
for example
with my name
String tpa.Akex06 = Test123
I was able to do it in skript
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
ik python and js
java is a bit different
if you want to set a String you can do this:
String playername = player.getName();
yes
but my idea was to do
String tpa.sender.getName() = player.getName();
and like this when I used the var
tpa.Akex06
thats not possible
could you give me a hint on how could I make it?
you define variable names once and fixed .... not changeable or smth
what do you want to achieve with a variable like this is the problem
In which event and how should I order an item to be smelted regardless of whether there is a recipe using it?
i dont think there is an event for this (you could try listen to inventoryclickevent and check if there is an item .... but its a bit complicated) .... you could add a recipe for that ^^
Okay, but still without a recipe, what function(s) can I use to start smelting an item? I'm already handling burn and smelted, but I haven't found a way to start burning
like i told you ... there is no automic event that get called if there is an item every time .... you will need to listen for InventoryClickEvent/InventoryMoveItemEvent too and check if there is a item at the furnace burn slot
then check if furnace is not burning and reduce the burn-slot by 1
if the process is finished you can listen for a Furnace event probably and check if it should start a new one
Reducing the itemstack's amount by one does nothing, would setSmelting work?
itemstack.setAmount(amount-1) should work unless you dont have a copy of the burn-slot
you will also need to set the Burnticks of the furnace ^^
So I have this
player.setAllowFlight(true);```
How would I detect that the player has flight mode activated?
player.isFlying()
ty
but this will work even if the player is in the ground?
No
can I detect that?
flight mode activated is that the player is flying or generally allowed to fly ?
then its player.getAllowFlight()
Ah, alright thank you.
By default getAllowFlight(); is null or false?
true or false O.o
you will also need to check if there is fuel, if the fuelticks > 0 and if not set it all .... way to complicated ^^ should just use FurnaceRecipe
How can I make a count of how many blocks have been passed? walk
ah yes, the famous null primitive
what do you use as coding platform ? i hope you have smth like IntellIJ or Eclipse ... and not notepad++
intellij xd
i've been using intellij before even starting to code on java
for compiling plugins
then you rly need to learn java .... you should know what a boolean is and that it can only be true/false
Can't do, it's a custom item and recipes only accept material
use ExactChoice ^^
well now I know
As far as I've heard it's discouraged to use in plugins
Oh actually no i was reading for recipechoice, my mistake and yeah I'll definitely use that, thank you!
is there any event called when block destroyed (triggered by any approach)?
BlockBreakEvent is just for players ...
BlockBreakEvent seems only be called when player destroy it
so I want to include things such as crop break by water flow etc. as well
BlockFromToEvent is smth you can look for
BlockExplode/EntityExplode ...
for what do you need this ?
you can also listen to BlockDropItemsEvent ... if you think there are always items that drop
hmm I am making a plugin which can custom drop item for users
BlockDropItemsEvent would be the best then
but like, what if that block doesnt drop anything? is it still will be called?
for example, mining stone by hand
uh so maybe I need listen to both of them and work out how to resolve potential been called twice?
If BlockBreakEvent is canceled then no Drop Items event will be fired
seems reasonable
I will look into it, thanks
seems both event does not triggered by water flow destory crops
yes because no player is involved
._.
for water try BlockFromToEvent
i have created a gui but i can only access it with a command how can i make it accsessable by clicking on a item?
use PlayerInteractEvent and detect when they click on the specific item you want
ok thx
Spigot 1.12
How can I set slab position top or bottom?
ok, I am not too experienced with resource packs, do you have to use the SHA1 option to get the server to update resource packs at all?
Yeah I belive it's used to know when to update the existing pack
boy these are a bit of a hassle
How so?
additional loading screens upon joining the server, having to generating a new SHA1 every time you modify the pack, having to deal with the possibility that users aren't using the pack...
anyone?
if a user has the resource pack installed and activated upon logging in would that bypass the extra loading screen?
Check wiki vg
i did
also how can i use it so that if a player comes and then they will get it i tried player joint event but whenever they join the server they get the compass one more time
no
if you're on a server that has one resource pack, and while in the server you switch to another server that has another resource pack, you will get 2 loading screens
ah I assume the same is true if you're on a server that has no packs and a server that has a pack?
it looks like it is the case
going from no texture pack to no texture pack I have 0 loading screens but no texture pack to texture pack and from texture pack to no texture pack I get 2 loading screens each time
do you make resource packs for servers?
I do now I guess
what style?
custom boss model style
wdym
Is it possible to get a entity by its custom tag?
I'm being facetious, I am just dealing with resource packs because I just added custom boss models to my plugin
and I need to worry about distribution
you speakin big words there pal
Hello i need som help, is there a way for the consol to know who has done a certain event, OnRightClick i want the consol to execute a command on the player that rightclicked but idk how
ty!
hey, i'm a bit confused, in the ChannelDuplexHandler, what method handles incoming packets (client -> server) and which one handles outgoing ones? (server -> client)
google how to use config files
or yaml
it does
you read a line from config.yml
and you send that on enable
why properties
and what is the reason why you need a .properties file
well anyways if you really want properties file, there are probably libs online
is it a json file or just properties ?
public class Info implements CommandExecutor {
@Override
public boolean onCommand(CommandSender cmdS, Command cmd, String s, String[] args) {
if (cmd.getName().equalsIgnoreCase("info")) {
Bukkit.broadcastMessage("1");
if (args.length == 1) {
System.out.println("<AC+> Checks.Info command was run by" + cmdS.getName().toString());
Player tPlayer = (Player) Bukkit.getPlayerExact(args[0]);
Bukkit.broadcastMessage("2");
if (!(tPlayer == null)) {
Bukkit.broadcastMessage("3");
if (cmdS.isOp()) {
System.out.println("<AC+> Checks.Info command was run by server staff");
//staff Info
} else if (cmdS.hasPermission("Player.info")) {
System.out.println("<AC+> Checks.Info command was run by standard user");
//player info
} else {
cmdS.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e<!> Warning, You don't haver permissions to run this command."));
}
} else {
cmdS.sendMessage(ChatColor.translateAlternateColorCodes('&', "&e<!> Warning, player " + args[0].toString() + "&edoes not exist." ));
}
} else {
//info of self
}
}
return false;
}
}
Command show up... but doesn't print anything into console. No errors. nothing
Idk what happens
I put like checks in there : Bukkit.broadcastmessage("1")
etc...
Nothing
Please help lol
did you register the cmd in plugin-yml and onEnable ?
if AC+ stands for anticheat, i'd reconsider your choices until you become more experienced
huh?
you mean save data inside blocks?
wdym on enable
blocks are saved in chunks tho
Like ik what it is
then you need to have a reference to some custom blocks
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you can use an hashmap
save it to a yml file
ok
also it's not true that all blocks don't have a pcd
only tile entities do
anyways you can use NBTapi
it has support for custom nbt in blocks
Didn't register it in onenable ty
it's not persistent
nbtapi offers persistent data saving for blocks
nah
the dev is a great guy and i've never had any issues with it
May I introduce you to
if you need a PDC for blocks check out my tiny lib https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
you can put whatever you like
from 1.16.4+
i've personally used it and it worked fin
i have no idea, but persistent nbt on non tile entity blocks only works from 1.16.4 and above
don't ask me, ask the dev of nbt api
Same way that library does it
Saves it in the chunk
well,
- backwards compatibility
- You cant easily migrate old data from nbtapi to pdc
True
Create yoru NamespacedKey as a Field so you only create it once
What api is that
ClipboardFormats is WorldEdit. I've never used it
The method sendMessage(ChatMessageType, BaseComponent) in the type Player.Spigot is not applicable for the arguments (ChatMessageType, String)
the line of code: java owner.spigot().sendMessage(ChatMessageType.ACTION_BAR, Utils.chat(actionBar));
the problem is literally written in that error
utils.chat returns a string
look
public static String chat(final String s) {
return ChatColor.translateAlternateColorCodes('&', s);
}```
oh
wait
i read that wrong lmao
😄
i thought it needed a string and it was saying that it returned a basecomponent
Yea, i told you
is it possible to lower some entity on the y axis? I mean actually lower it, but that it behaves as if it was not lowered. For example a pig that walks normally on the ground / blocks, but its texture and hitbox is slightly underground. I don't want to use packet teleporting here as the server still thinks entity is above and it doesn't allow me to build there.
should i do all my db queries async?
isnt that how the scheduler works with async?
Yes
i'm making like help methods to execute queries 💀
prob not a bad idea tbh
I dont do sql as I think it sucks, for Mongo at least, I do all m queries automatically in methods so I dont have a chance to screw it up
i'm doing stuff like
java.lang.UnsupportedOperationException: null
at java.util.AbstractList.add(AbstractList.java:153) ~[?:?]
at java.util.AbstractList.add(AbstractList.java:111) ~[?:?]
at me.generallyblinky.realmofeternia.stats.PlayerStats.calculateStats(PlayerStats.java:62) ~[?:?]
at me.generallyblinky.realmofeternia.Main.calcStats(Main.java:62) ~[?:?]
at me.generallyblinky.realmofeternia.Main.lambda$0(Main.java:45) ~[?:?]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:81) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:400) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1179) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:394) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1127) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:966) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot.jar:3096-Spigot-9fb885e-296df56]
at java.lang.Thread.run(Thread.java:831) [?:?]```
that line is: ```java
equipment.add(owner.getInventory().getItemInMainHand());
doing mutable stuff on something immutable?
how can I send people to another server from spigot api (the server is behind bungeecord)
what does mutable mean?
Modifiable
plugin messaging channels
how? I couldn't find much information
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
here's equipment: ```java
List<ItemStack> equipment = Arrays.asList(owner.getInventory().getArmorContents());
oh wait
thats not the line which throws an error
this is
ImmutableList#add probably
im not setting contents
kinda
cloning their armor contents, then adding to it
but do you want that to be on the player?
then looping through, getting stats and adding their stats to bonus stat variables
new ArrayList<>(Arrays.asList(owner.getInv().getarmor()))
Arrays.asList returns an immutable list
Use this
bad
obv dont forget the capitalization of Armor but yeah
i know thats not even the method
in which way?
single responsibility. The storage byitself shouldnt run async tasks
yea i'm too lazy to type that whole thing
or just to prevent implementing it in every class?
does anyone know what's the packet for when a blockstate updates? (using protocollib)
i did, i thought it was block change but turns out it wasn't
Kinda.. For example, what if you have multiple storage implementations? Then in every implementation you'd have to write the same code which can share same bugs, to run async tasks. Also, sometimes you may want to run operation synchronously, but, you cant because async is controlled by storage itself
i dont even know why i would run queries sync
If you want to run them step by step, all of them in the same thread?
so like multiple operations after each other which may effect eachother?
Yea, needless to say that starting single async task is faster rather than starting 5 for every operation
Also you probably want them to be sync on shutdown
i dunno if that would matter
as always forgetting to register the listener
how do i read from MultiBlockChange packet in protocollib?
Check PacketWrapper
Hey, I'm making a plugin that will cancel item despawn event, if the item is dropped by a player.
When a player dies, are they the thrower of an item?
I was gonna send this
xD
So you don't know? ok
Waiting for them to despawn is too much for me xD
spigot
Can't remember... one of them
but I want to cancel it forever, so the items remain on ground when they die or drop it
Lower it for testing
well my project is now sitting at 54k lines
it looks like I've finally gone past rewriting to be under 50k
how do i cancel a block from being destroyed from a createExplosion() explosion
One or all of them
just one
Remove it from the list on BlockExplodeEvent
yeah but i need it to be circle like
Maths
anyone?
//stuff
}```
Are anyone good at luckperms because i kinda need help
luckperms api?
So basically what i am trying to do is i am trying to make a permission paper so when you right click on it you will recive essentials.fly for a week. But for example if I am in the default group I dont have permissions for /fly but i want the player that used the paper to have /fly
It doesnt allow it
custom made or using plugins to do it?
plugin
You will want to ask in #help-server then
okey thanks
yeah uh... what is the c for? im SO sorry
It’s just the variable the example I copied used
oh well i kinda need to know what its used for
x y and z?
Center
ohh oka
I love those forums posts like "I tried xy but it doesn't work, plz heeeelp"
how can i cancel planned task (runTaskLater), for example
new BukkitRunnable() {
@Override
public void run() {
//cancel it here
}
}.runTaskLater(plugin, delay);```
run cancel()
public void run() {
if(shouldCancelNow()) cancel();
}
or cache the task
BukkitTask task = new BukkitRunnable().runTaskLater(); since any of the runX instance methods from BukkitRunnable returns a BukkitTask instance
No reason if you are canceling from within the task tho
yeah you don't even need to use BukkitRunnable::cancel in first place as the task is already in the state of running
@Override
public void run() {
cancel();
System.out.println("test");
}````System.out.println("test");` is executed, it is not canceled :/
Yes
you don't understand what cancel does
you must return if you just want to stop there
oh, ok
I thought you wanted to cancel repeating tasks
Oh yeah it’s a delayed task
Why can a variable be changed in a for loop but not a lambda? Not getting very specific answers off google.
well lambdas actually copy the variable
so if you mutate it, the lambda will not know which state to copy
thus the effectively final state on the variable is needed
👍 thx
and how can i do this so that if this task was called but not done and if it is called again then the previous one will be canceled?
by called you mean it ran?
yeah
Save it to a variable
task, or task ID maybe?
Then you can use variable#isQueued and variable#isRunning
just use an atomatic if you need to change stuff inside the lambda
?
I don't "need" it really lol Was just questioning it.
Kk, and I just wanted to mention how you could change "that" variable anyway^^
Or just create a delegate, shouldn't use volatile unless you need to
BukkitTask variable?
Yes
tasks that were delayed
so I dont have that methods, like isQueued
tasks that were scheduled with the bukkitscheduler to the main server thread during plugin startups
Yeah my go to if I really want to use a lambda and change variables is just put the variable outside the method.
''l0
for instance
@Overridew public void onEnable() {
this.getServer().getScheduler().runTask(this,() -> sout("hi"));
}
@rough basin
Oh then it must invoked it
Ah, looks like it’s Scheduler#isRunning(task)
Or isQueued, etc
what kind of cursed class is "initializeSentry" lol
well it only applies to tasks scheduled with the api
Forgive me lmao
getLoadedSentry getLoadedSentry = new getLoadedSentry()
RIP java
here is my issue:
I have a getter and a setter for a boolean.
Everyting of that works fine and all. But now im making a player chat event thing.
and the boolean returns false in every scenario, even if i set the boolean to true. any ideas? I had an idea that it is Thread Safety, but i havent encountered that issue ever so idk how to fix it
Any suggestion to how can my server support 1.8.9+ versions?
ViaVersion
Ok
Do not support 1.8.9
Have you tried an atomic Boolean
Ig it support
uhh... idk how to make it work since i havent worked with atomic booleans ever
boolean[] bool = new boolean[] {true};
Oh god why
Read the docs?
sure