#help-development
1 messages · Page 2182 of 1
Thsi is the only code you have show which concats the name to anything java public String getDisplayName() { return getColorForTier(tier) + name + " " + SUtil.toRomanNumeral(tier); }
So I found out that the reason the schematics get corrupted after I extract them is that they get uncompressed, usually they are compressed in GZIP format, can I tell intellij that it should export them "as they are"?
how do i get all the lines in a sign, they return component but i cant get a string from it
ye
the boss name health stuff
was a bit boring i just revised the whole time lma
how would I go about creating world border in my plugin
in the meantime ive solved the hp displaying by adding a health goal to the scoreboard and adding every player to the board
timinator
🤣
how to get a lectern in 5 block radius of a block?
By looking at every block in the radius and seeing if it is a lectern
is there any method for it or i gotta loop?
get the block, iterate every block in a 5 block radius so from -5 x y z to +5 x y z and check for their blocksata
data
@limber owl World#getWorldBorder
AI spigot plugins when :D
Alternatively, loop over the TEs of the chunk and check their distance
This is just sidebar scoreboard. Nothing to do with mobs, other than the dragon
iterate the blocks with the 3d matrix @golden kelp
thanks
Why is there no getUniqueId when calling the command and how can this be solved?
Command senders aren't necessarily players
do you mind elaborating a bit more?
idk look up the lectern wrapper class
xD
getBook or so
idk
no its for the boss spawning name, egarl asked for it
The console is a command sender, but obviously doesn't have an uuid
can i see Sutil.Commaify?
ty
BukkitCommands having a uuid?
Check and cast to player, then invoke the method
wat
or wherever you format damage as a text
i got a better idea, can we check if theres a itemstack (dropped item) at X location? as ill just drop a book and quill and read from it
no file like dat
just set the displayName of the mob to your health and to cast the format of 1500000 to 1.5 use your brain
yooo you;re coding hypixel skyblock? lmk when you release itr
xD
im getting help mroe than doing it
either that or holograms to implement it in a better way
he might not finish lmao
^
he cant figure out where to put code we spoonfed him
why u gotta do this
He should git gud
ill try tho
Because it's true
only the mob health
minion spoonfed my storage hehehhehehe
timmynator
@quaint mantle Do you have this code in a github or something? Asking you for bits will take forever to find the section we actually need
nah man hes right enough spoonfeeding if you really dont know about this then well
🤷♀️
how can I open the creative inventory for a survival player
oh o
ya
but to lazy to pull the link
maximum advantage?
yea like ton of stuff, like close to OP
make a custom command
um not that way , i still want them to have health and stuff
oh
i m making a plugin which gives a random player addvantage for a YT vid
u can still make them invincible by either
he wants them vincible
can you send any less words in a message?
alr
uhm, u know u can set the gamemode for a player with the bukkit api right?
like with a custom command or event or so
N
damn
okay im just gonna try to ask again now🤣
ik that
does pdc support global namespaces?
player#setGameMode(GameModeEnum)
alr thanks for feeding me minion, yada and timmy
not that I know since it takes a plugin instance as a parameter
without putting a string as namespace which is deprecated
I dont understand how you don't know where you should put the code
no problem
thats anoying cause like i have 1 plugin that manages item behavior and another one to generate those itemstacks with nbt flags but since tbe custom behavior is managed by pdc flags, errr yea...
Maybe let the other plugin access the namespace
and i dont always wanna target plugin nr1 with plugin nr2 as theyre supposed to still be able to work independently
Hm
but i also dont wanna use nms anymore since its anoying to break ur plugin with every major patch
xD
my tip is to set one of them as a dependency to the other and get the plugin instance
no
everything is self written
🤣🤣
i mean i "can"
put a string as namespace
and use the generic minecraft namespace
ive done so to override the vanilla emerald block crafting recipe
but thats nasty
If i were u I'd do it and worry abt it when it's no longer supported
haha
putting strings as plugin instance does work cause its overload is supported
but its marked as deprecated
How to get the text from a Component returned by Sign#getLines()
obv
xd
Are you still trying to format the health?
hm well i mean ive wanted two dedicated plugins, item management and custom entity so technically the boss plugin is dependent on the item plugin but id still avoid dependency if possible
theres no method for getting a string
usin paper or spigot?
spigot
if its paper you might wanna use the paper component serializers
u put the code in the plugin.yml in the resources folder
net.kyori.adventure.text.Component
I get a list of components
hes asking for the return value
like which object type exactly
literally not
huh?
wdym
xD
and the method is then called lines() merely
Uhm no thats deprecated
??
declaration: package: org.bukkit.block, interface: Sign
then you're using paper
I am using spigot
this is NMS
how
how to seralize?
Nms for a sign???
what else can I do 😭
what are u trying to do
just tryna get the lines off of a sign
how
it is in NMS
the getLines() method
thats done
Get the state and cast to sign
thats not nms
Sign.getLines
Lmao
i can feel conclures frustration in my bones
that’s not nms lol
how
i m at peak of dumbness
apparently not
like for the third time now, anyway use https://jd.adventure.kyori.net/text-serializer-plain/4.10.1/net/kyori/adventure/text/serializer/plain/PlainTextComponentSerializer.html#plainText() @golden kelp
got it, thanks
not the BukkitSerializer?
i am sorry
I mean, what???
you use the wrong Level class
no
then why tf did it said I use the right logging class

Does someone know how to compress a file back to GZIP format from the jar or how to prevent it from getting uncompressed in the first place?
btw invalidated chaches and it worked lol, not with error but with that loging level
🥲
lmao i followed the guide to using nms on spigot
and i have no idea how
but it worked
seems like magic tbh
maven reobfuscates nms methods
well, you're no alone 😄
maven does not do it by default however
Hey, i have a very simple code that is supposed to strip the color codes of a string. For some reason the ChatColor.stripColor method does not actually remove the color codes (image)
getLogger().info(data);
getLogger().info(ChatColor.stripColor(data));
Does anyone know what im doing wrong/how i can fix this?
Those errors are not from that code
Yeah i know its just logging a colored string and both logs are showing the color
But the second log is supposed to strip the color
What is data?
Its just a string
Does it contain color codes or not?
then its not even getting to that log code
It does as you can see from the image
It is as you can see from the prefix of the log
Thats my plugin name in square brackets
If it does then strange, otherwise (e.g. if it uses ANSI-colors) it is the cause
Plus depending on the logger settings it might not be even influence-able by you
are you saying "An entity is..." is the actual data you are passing to this?
yes exactly
ah ok, makes sense now
Anyone with custom biome generation experience using NMS?
More info: Im getting the string (data) by hooking into log4j, so maybe data contains a weird charset or encoding so the stripcolor method cant recognize its a color code
Just use Datapacks at this point
I would, but I'm using 1.12.2
What exactly is the string?
theres no super clear difference but basically, the brain and behavior abstraction is a bit more capable than the goal one
(including color escapes)
are you using md5 Color import or Bukkit?
its data: An entity is required...
and minion
yes?
Without color escapes?
brain/behaviour might be saved persistently
might?
import org.bukkit.ChatColor;
bukkit
Then it is a logger issue and nothing you can influence - though that would be strange considering that INFO should be white, not red
how does it even do that?
can you show us the full data you are passing? show us where it comes from
it uses dataupperfixer or whatever its called
I just want to remove the color codes of the string data. I am not actually changing the log im just relogging it
I KNOW
even without my plugin?
But what the hell is the string
ye I mean its part of nms
Not the variable name, I know the name of the var
I want to know the contents of the string
This
and as you can see it contains a color code
even after calling stripColor on it
Show us where this data is coming from. we need to see the source string
@ivory sleet my custom goals can work without my plugin?? That doesnt make sense to me
I told you its from an appender that hooks in to log4j
oh no
not that but thought u were asking about the behavior "framework"
@pine forge Do
data.codePoints().forEachOrdered(x -> {
System.out.println(Character.toString(x));
});
what does that do
but youll ofc need your plugin loaded in your case
Print the true string
Shows every single character in the string
Obtains the stream of characters
However I assume that you have an ANSI escape somewhere, so of course ChatColor#stripColor is not going to recognise it
Ype, as its from the append of Log4j its's already console formatted
i think its this actually \x7Fc
Dont ask me where i got it from but that is inside of the string
unicode
Wouldn't unicode be \u?
um, true
But im sending the string over to another application and it shows this in the console there
I searched for that char encoding on the internet but i couldnt really find anything
Apparently its some delete char
but idk
Which means you need an ASCII strip method
your custom goals obviously only work with the plugin. have you solved the issue that on server restart the entities get reverted back into their vanilla copy?
not /rl but full restart
I think theres like an option to specify the logging charset of an appender using a layout
I'd just do a .substring(2)
but im not sure how that works
Conclure was telling me the goals are persistent
no
It doesnt contain color coes 100% of the time
but behaviors might be
difference?
behaviors are like goals, but they might store state in an entity's brain
then just check if the first char is 0x7F, and if it is do substring(2)
ohh
which is saved and loaded persistently
so that's probabyl why theyre separe
mye
goals are persistent beyond /rl ive tried that, but the problem is when you save and shutdown all entities get serialized into the world file, and this is where the custom entity gets stored as its vanilla superclass
i had a stroke with that last sentence
yeah ill try that
Maybe on shutdown all custom entities can be serialized yourself and the entities killed
and respawned on startup?
Is there some issue thingy for spigot? Maybe theyll fix/add this in the future (ascii color code stripping) @quiet ice
thats not the point
when theyre being serialized there is nothing to kill
because the server is down
I mean on your plugin disable
then they dont get serialized
if u wanna save your custom entities
no kill them on disable
and save them yourself
and spawn them back on enable
safe in an external file?
yeah
data = data.replaceAll("[\\p{Cntrl}&&[^\r\n\t]]", "");
because of its stupid double backups
because multicraft makes multiple backups
and restores the entity
and then u have 2
1 custom
wtf
and data = data.replaceAll("[^\\x00-\\x7F]", "");
This will remove all color codes or convert to utf8?
don't entities have uuids as well?
@humble tulip ideal would be to inject the custom entity with its behavior in the vanilla map thats responsible for storing the entity but well idk how yet ill figure when its time
guess u can save those
ye they do
both, first removes all control codes. second removes all ASCII
non
true
and then let the vanilla server handle the serialization
but would you plugin have to load before thethe world loads then?
Any way how to combine those two replace methods?
to inject it into the map before deserialization by mc
do as the website says to do
No easy way to combine
well how would mc know how to deserialize it?
I have a custom villager trade plugin, any idea how to cancel manual input of items in the trading window, but allow selecting the items from the trade list?
the idea is that you register the entity to the responsible map onEnable, and then when the server shuts down it automatically stores the custom entity
and then because its stored custom
it gets loaded custom
at least thats my theory
xD
but how will it know how to load
obv ull have nullptr errors if u remove the plugin then
if it loads the entities before your plugin enables
possibly text = text.replaceAll("[^\\x00-\\x7F]&&[\\p{Cntrl}&&[^\r\n\t]]", "");
you'd have to inject it into the map in onLoad
ill keep the multiple replaces. its more readable because i can add comments
ive had to use a tasksheduler to inject my custom /list command to fix the multicraft /list console spam
because it didnt override onLoad
or onEnable
and i guess its the same
for any map
not just commands
^^
whats the possibility that generating a random uuid has the same uuid as an entity on the server
if thats even possible
the lotto is 1 in 45,057,474
Hello friends, im running 1.18.2 and im wondering if I can set the player's overhead name to their display name?
lmfao
Well, a UUID is 128 bits in length, which is a huge possibility of numbers, the chance of having two the same is very unlikely, even with the pseudo-randomness of computers which increases the chance it's negligible with the way most algorithms generate them
Thanks!
Problem: The actual color char doesnt get removed so i have something like cAn entity...
I've no idea what that extra c is in your text
oh
another thing, how are listeners with the same priority level handled? multiple listeners with the priority set to highest
in that case you need to match the ASCII and replace that +1
remove the color char and the char after then
so just an additional section on the regex to match a color code
maybe registration order or plugin name
not sure
Does anyone have an example of how to set a scoreboard teams name?
isnt there a scoreboard javadoc
its uncool
?
why are you doing this at school lmao
u want to set it or create a team with a name
create a team with a name
team#setPrefix()?
thank you you're a life saver
oh right u meant
what color codes are there? 0-9 +a to?
f?
a to f
real ones use &g
only ones i know are 0 is black f is white and 4 is red
i know them all hehe
&g is pink or yellow or something?
Try [^\\x00-\\x7F]+[0-9a-f]
its neon white 😛
whiter white
0 is black
1 is dark blue
2 is dark green
3 is dark aqua
4 is dark red
5 is dark purple
6 is gold
7 is gray
8 is dark gray
9 is blue
a is green
b is aqua
c is red
d is light purple
e is yellow
f is white
LMFAO
no that won;t work
a b c e d g f
l is bold
m is strikethrough
n is underline
o is italic
k is obfuscated
r is to reset all codes
what happened to q
no clue
¯_(ツ)_/¯
notch hats p and q
maybe he is dyslexic
or maybe he used r cus reset starts with r
Can I use p.getUniqueId and use that as the name?
alright alright
I've actually never worked with scoreboards
how?
Yes
Is it allowed to upload a premium resource which downloads schematic files from a google drive folder?
I don't see another way without corrupting the files
I dont see why not
been trying for 2 hrs now but seems like everything corrupts the .schem files when exporting them from the jar
maybe include them seperately ? might compile weird
i had issues with schematics before
I used schematics from my plugin before and it worked
Yep this should work Try [^\\x00-\\x7F]+[0-9a-fA-F]
regex funny
ur big brain tho
funny joke joking
HOW
I'm either getting that it's not a GZIP file format
or some other error messages
Weird
okay thanks
gzipped schematic --> added to resources of jar --> jar runs on server --> schematics get extracted --> are uncompressed / corrupt
I'm not sure but are all schematics gzipped?
Which worldedit?
fawe
Idts
?
I'll send sone code in a bit
thanks
ItemStack item = new ItemStack(Material.GLASS_BOTTLE, 1);
ItemMeta itemmeta = item.getItemMeta();
itemmeta.setDisplayName("Magnifying Glass");
itemmeta.addEnchantment(); // This
How do I make an item have the enchantment glow but not really have an enchantment?
public void addGlow(ItemStack itemStack) {
itemStack.addUnsafeEnchantment((itemStack.getType() == Material.BOW) ? Enchantment.PROTECTION_ENVIRONMENTAL : Enchantment.ARROW_INFINITE, 1);
final ItemMeta meta = itemStack.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
itemStack.setItemMeta(meta);
}```
@iron glade can i see how you're compressing the schematics?
they get compressed when I create them
with //schematic save [name]
I then directly add the created file to my resources in intellij
sure
anyone have knowledge of renting dedicated servers ?
how can I add green stained glass pane material to itemstack in 1.8
But it would also strip numbers if theyre after some other ascii character not just after the paragraph §
right?
that will only match to any ascii followed by a color code
how could i create animated hologram which displays item(i know i can use armorStand but how?)
you could modify the first part to only match that specific ASCII control code
yeah exactly, so if i have another ascii code thats not the § character (color code character) then it would also remove the number
which is not what i want
display name above it and remove the visiblity of the body
item not text
oh, still, remove the visiblity of the armor stand and let it keep the item
how can I know when a villager levels up?
also, i kinda want to convert the ascii characters to utf8 and then remove only the color codes
instead of removing every ascii char
sec
sex !
so maybe i could just do java new String(data.getBytes(), StandardCharsets.UTF_8)
didnt work
Any idea what to do here?
still messing with regex
i dont think regex is the perfect solution here
Because i want every ascii character to be parsed correctly not just the color codes to be removed
use the Charset api perhaps?
ChatColor.stripColor(new String(data.getBytes(), StandardCharsets.UTF_8))
``` I tried this but it didnt work either
Does anyone know how to use log4j appenders/layouts?
I think theres an option to specify a charset
you use it wrongly in this case
that thing presumes data is already utf 8 compatible
Ive read on stackoverflow and some other sources that ascii is compatible with utf8
In this tutorial, we'll take a look at how to encode a String to UTF-8 in Java - using StandardCharsets, getBytes() with ByteBuffer and Apache Commons with examples.
myeah it is altho im still quite unsure if thatd work
^^
Hey guys, whats the fastest way to set blocks?
ive saw that setting blocks by NMS is faster than settin Bukkit Blocks, can anyone give me a example?
oh thanks
anyway Lianecx what exactly are you converting?
since String(byte[],Charset) should work unless you feed it with a malformed input or sth
which is why you might wanna use the CharsetDecoder explicitly
I fear that they want to convert an UTF8 string to an UTF8 string
Since they do not know that java uses UTF8 by default for almost all strings
that too
@ivory sleet when i build with maven, it takes a .schem file from my resources folder and modifies it when putting it into the jar
i'm not sure how to properly explain it
i guess i can open the file for u in n++
Its an ascii string apparently
Sure?
no how can i check
Use a byte array
\x7F This is one of the chars
?
what ends up in the jar is larger as well
Ah I see I got confused there
minion
Myes, and that is also a UTF8 char
disable compression
ok
So how can i check if its an ascii string
It is irrelevant?
did you extract the schem from jar to your plugin folger
Why doesnt it show up as a real char then?
Java uses an encoding-agnostic String API
it should be §
Blame windows
yeah
Did you want to use 0xA7 instead?
the problem is whatever is packaging my jar (maven) though
Okay, well stripColor cant recognize the char
because if i copy the schematic to the packaged jar everything works fine
What can i do about that
but if i rebuild with maven the schematic is broken again
Because 0x7F is DEL in 90% of non-windows charsets
Because it isn't §
It is that char but just encoded, it shows up as a color code when i log it.
Only minecraft uses § for color codes
?
The terminal you use probably only accepts ANSI escapes
this is not what im talking about
Im trying to remove the color codes of the string. The colors show up in the console when i log the string but after logging the stripped string (ChatColor.stripColor()) it still shows the colors
Just prepend a ChatColor.YELLOW to your string and check if it goes yellow - if it does then discard my advise otherwise you should rethink whether this is really the right way to do it
what way
The string shows up red in the console because its prefixed by a §c i dont really know what youre trying to test
My assumption is that an earlier logger adapter converted the $c to 0x7F c
Like 700kb bigger
wouldnt really make sense. Why would it do that? Also, like i said when i log the string with the \x7c it STILL shows up red
Try using mvn clean package
so minecraft / log4j still recognizes the color code
Me?
Yeah
That's what i use
Strange
I can send the schematic
Lianecx do you have like a snippet of code or sth we can go on?
But my assumption you have something like
-> "§c XYZ"
-> "0x7Fc XYZ" (modified by spigot/paper/whatever)
-> (you log this string) (modified by you)
-> "[WHATEVER ANSI] XYZ" (modified by log4J)
-> log4j writes it to STDOUT
https://paste.md-5.net/axumimonub.xml#L83 and there we have the issue
does VillagerAquireTradeEvent gets called when a novice villager changes his trades on its own?
Set it to false and see what happens - afterwards you can apply the filter to special files (or just exclude the schem file from the filter)
Applies placeholders
Oh but there should t be placeholders in a schematic file
I guess we should still exclude it
Think this is the solution
oddly simple, you shoudl just be able to §[0-9a-fA-F]
§ is 0xA7 iirc, not 0x7F
However at this point it would be easier to use a javaagent for this
um yeah. I wonder where his delete is coming from
so its not actually the §. Thats confused me
so that means he can use \x7F[0-9a-fA-F]
Hey, does anyone know why I am getting this error? https://gist.github.com/Christian-Madlansacay/cb5d024e15e34b6262cedd15b3c55fd1
Cannot invoke "org.bukkit.plugin.java.JavaPlugin.getResource(String)" because the return value of "me.kewlkidchristian.hidentag.HideNTag.getPlugin()" is null
Extends Spigot???
messages.yml is not embedded in your jar perhaps
It's apart of an API I am using
Wdym? I have it in my resources directory
its saying the Plugin reference is Null, not the resource
Oh nvm I’m blind
That actually worked but what about other characters, how are they gonna be displayed?
try it an see?
okay any example char?
Player[] heroes = (Player) event.getRaid().getHeroes().stream().toArray(); why doesn't this work?
The console says Caused by: java.lang.ClassCastException: class [Ljava.lang.Object; cannot be cast to class [Lorg.bukkit.entity.Player; ([Ljava.lang.Object;
and idk what that means
event.getRaid().getHeroes() returns?
it should return Set<UUID> but idk how to work with it so I tried to turn it into an array
you can cast an entire array to another type?
ok, you can;t cast a UUID to a Player
you have to foreach the heroes set and get the player by their uuid
actually you are trying to cast an Arrayof UUID object to a Player
this is possible?
you can if you use a stream to map to a player
but no you can;t cast as he's trying
What are you wanting to do with the Heroes?
so I should do it like this?
Object[] heroes = event.getRaid().getHeroes().stream().toArray();
Player player = Bukkit.getPlayer((String) p1);
}```
no
Lol
replace Object with UUID
LOL
the IDE says
stream.map
What precicely are you wanting to do withe these Heroes?
lol
give them some effects
heroes.forEach(id -> {
Player player = Bukkit.getPlayer(id);
if (player == null) return;
//do things here
});```
but if its gray youre not implementing it
does the class youre trying to register as a Listener implement Listener
OwO?
no
Ok
only UwU
ÜwÜ?
yes, but youre on thin ice
Understandable
this
thats what i was expecting
it logs correctly though
But its encoded again
no
You have no events to listen to and you are not registering the command
?notworking
"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.
find a better tutorial? Video ones are usually bad
register the command using getCOmmand("commdname").setExecutor(this)
and get rid of all the event listener stuff
there are plenty on Bukkit/Spigot site to follow
This is what i receive by the logger. It logs correctly in the console though just like the paragraph did before
wrong reply
Do you know what i can do about that and why im not receiving the characters that are actually logged in the console?
Please, can anyone help me here? I'm trying to deserialize an object from my Protection class using what I saved in yml file
public class Protection implements ConfigurationSerializable {
@Override
@Nonnull
public Map<String, Object> serialize() {
Map<String, Object> stringObjectMap = new HashMap<>();
stringObjectMap.put(this.toString(), this);
return stringObjectMap;
}
private final Block block;
private final Player owner;
private final Set<Player> playerSet = new HashSet<>();
public Protection(Block block, Player owner) {
this.block = block;
this.owner = owner;
}
public Block getBlock() {
return block;
}
public Player getOwner() {
return owner;
}
public Set<Player> getPlayerSet() {
return playerSet;
}
@Override
public String toString() {
return "Protection{" +
"blockLocation=" + block.getLocation() +
", owner=" + owner.getName() +
", playerSet=" + playerSet +
'}';
}
}
C2d93faa-eecf-6f70-9abe-67abcfd01f2f:
- &id001
==: me.armando_sales.primeiro_plugin.eventos.Protection
? Protection{blockLocation=Location{world=CraftWorld{name=world},x=10.0,y=-60.0,z=-1.0,pitch=0.0,yaw=0.0},
owner=Armando_Sales, playerSet=[]}
: *id001
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
if (CustomConfig.getContainersConfig().getList(onlinePlayer.getUniqueId().toString()) != null) {
List<?> list = CustomConfig.getContainersConfig().getList(onlinePlayer.getUniqueId().toString());
for (Object object : list) {
getEventoBlockPlace().getProtections().add(((Protection) object));
}
}
}
-org.yaml.snakeyaml.error.YAMLException: Unexpected referential mapping structure. Node: <org.yaml.snakeyaml.nodes.MappingNode (tag=tag:yaml.org,2002:map, values={ key=<org.yaml.snakeyaml.nodes.ScalarNode (tag=tag:yaml.org,2002:str, value===)>; value...
You have somethign odd going on. As all your colour codes are partially processed but everythign is in ASCII and not encoded to UTF8
all colour codes have been replaced by ASCII 7F
public Map<String, Object> serialize() {
Map<String, Object> stringObjectMap = new HashMap<>();
stringObjectMap.put(this.toString(), this);
return stringObjectMap;
}
WTF
but the actual colour c,a,e etc are still there
that's not how it works lol
you have to put the fields into the map
e.g. map.put("block", block) etc
map.put("player",player.getUniqueId());
the yml key?
and then you need a static deserialize method that turns the map back into an object
why are you checking the commands name in your onCommand method? o0
and why do you return false?
Yeah... Any idea what to do about that?
and why is your code in turkish
I'd have to see more about how you are getting the string
I already tried setting a custom charset in my appender
idk what language it is
anyway it should be in english 😄
Player oyuncu = (Player) sender;
so what exactly isn't working?
any error messages?
did you register the command in your plugin.yml?
What exactly do you want to see?
I can send you the console logger file
yep, I'll take a look between cooking
yes
can I serialize a block?
no
but you can serialize a location and blockdata
thank you
send x y z seperately instead of sending the whole info about location
guys how can i make an item unstackable
player.sendMessage(ChatColor.DARK_GRAY + " " + ChatColor.BOLD + "⬛ " + ChatColor.GREEN + "Player's Location: " + ChatColor.GOLD + "X=" + player.getLocation().getBlockX() + " Y=" + player.getLocation().getBlockY() + " Z=" +player.getLocation().getBlockZ());
if you want double values use getX(), getY(), getZ()
gamers how do I serialize a List<Object>?
serialize to what
I went into a village while I had bad Omen X (10) and started a raid.
I want to be given hero of the village 10 when the raid is done but when I do this the effect amplifier becomes 5 when it shouldn't.
this is the code PotionEffect effect = new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE, 120000, event.getRaid().getBadOmenLevel());
its in RaidFinishEvent
to a string
depends on how you want it
i want to save it to a yml file
I'm doing like that:
CustomConfig.getContainersConfig().set(protection.get().getOwner().getUniqueId().toString(), EventoBlockPlace.getProtections().stream().filter(protection1 -> protection1.getOwner().equals(player)).toList());
CustomConfig.saveContainersConfig();
what?
bump
why can't a raid's bad omen level be above 5?
minecraft
I can summon a raid when I have bad omen 255 tho
Minecraft limits same reason you can't obtain sharpness 100 in vanilla
Put a random uuid in the pdc
you can set the maxstacksize to 1 ig
That's a thing?
thats easier lol
Si senor
there are no such method as maxstacksize iirx
nms class has that field so yeah i think so
oh with reflection
not a part of the api yeah
Yeah but I can get it with plugins and NBT editors so there must be a bypass here too. idk
i think ima go with pdc lol
Would it persist tho
yeah thats easier
Yea
Creative mode
Or
Commands
I meant in the plugin
Just apply bad omen 255 Or something
I made it so that bad omen can go up to 10 and not 5.
I want to make the hero of the village also be up to 10
Mojang probably has hard caps on max waves spanws etc
can I use a formula to get the used bad omen amplifier by the raiders?
does that exist
Hey, I want to create a command for change the max HP nummber of à player. However when I try to use "p.setMaxHealth(args)" I can't because it's an List and not a double anyone knows how I can do for create my command ?
I'm not sure tbh
Integer.parseInt
And whichever arg
Or double or whatever
yeah you cant just put "args" you must have an index
It's a List and not a String so I can't even
args is not a list
its an array
Learn about Java arrays before continuing is my reccomendation
?paste
Really ? I did not even know 😂
you could have put your mouse on the variable and it would have told you
the IDE
So, is my command impossible to complete ?
@river oracle so you think that I need to save the amplifier in the class?
why would it be impossible
just use the array
Anyone knows why this is not triggering?
@EventHandler
public void onMoveWhenAbducted(PlayerMoveEvent e) {
Player p = e.getPlayer();
Location loc = p.getLocation();
Location oneUp = loc.add(0, 1, 0);
if (loc.getWorld().getBlockAt(oneUp).getType() == Material.BLACK_STAINED_GLASS) {
p.teleport(loc.add(0, 2, 0));
p.getActivePotionEffects().clear();
}```
I can't, the functions need a double and not an array...
0_0
An array is a number of variables.
in that case each index in the array is a string.
parse it to double and use it
?learnjava
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.
@livid basin
learn how to use arrays please
array is not a variable type, its a variable structure or whatever it's called in English
c3c73faa-eeef-2f10-9bae-67abcdd00f5f:
- ==: me.armando_sales.primeiro_plugin.eventos.Protection
owner: &id001
==: Player
name: Armando_Sales
location:
==: org.bukkit.Location
world: world
x: 13.0
y: -60.0
z: -4.0
pitch: 0.0
yaw: 0.0
- ==: me.armando_sales.primeiro_plugin.eventos.Protection
owner: *id001 #<<<
location:
==: org.bukkit.Location
world: world
x: 18.0
y: -60.0
z: -5.0
pitch: 0.0
yaw: 0.0
Is this correct? I mean *id001 is a pointer to the address bc is the same player right?
isn't this skript?
you sure about the event does not trigger? Try adding a debug or smth. You may forgot to register the listener
this is a list of Protection that are serialized in a yml file
and do not add to location directly, use Location#clone
I di
I do know
Glass can never be 1 blockabove the plauers feet
Cuz that's where their waist is
Look 2 blocks above
my server gives me an error in console when I join ;-;
play.getLocation returns a clone
ah
ty
I ended up with ```java
Block above = p.getEyeLocation().add(0,1,0).getBlock();
if (above != null && above.getType() == Material.BLACK_STAINED_GLASS) {```
works now
This is the same thing as adding 2
only problem is p.getActivePotionEffects().clear(); is not removing potion effects
yep :d
Maybe iterate thru the list and do p.removePotionEffect
Could be a copy being returned
Also if u just wanna remove levitation, just remove that
Or the effects you added
check ur server properties file
show your whole code
if (player.getGameMode(GameMode.CREATIVE))
is the problem
You have to do a check like this ^^
Lol
@humble tulip btw I tried everything and it*s not removing the potion effect 0.o
Can i see?
for(PotionEffect effect : p.getActivePotionEffects()) {
Bukkit.broadcastMessage("§aEffect: " + effect);
if(effect.getType() == PotionEffectType.LEVITATION) {
p.removePotionEffect(effect.getType());
break;
}
}```
Just replace java if (player.getGameMode(GameMode.CREATIVE)) with java if(player.getGameMode() == GameMode.CREATIVE) {
?learnjava
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 not removed
yep
3215t-x10 tf is this
reminds me of maths in school
reminds me of the year at which i'll be funny
never?
._.
the fact you put a space between those gives me a headache
It's because I don't want to summon the smiley
it reminds me of people who put spaces BEFORE instead of AFTER dots
:)
ah hell no
disable it in discord settings
who uses that feature anyway
old people
you old?
you know how old I am
ikr
debug it ig
How can I update an inventory without setting the cursor to the middle???
that does indeed reset the cursor afaik
Don't open a new one
fock
I want a specific item to be updated
but its worth a try ig
yea, try re-setting it into the inventory
I'm pretty sure setting one item doesn't reset the cursor
yea, but i have no idea if it even updates the inventory automatically
I'm working on a plugin rn where when u click the in its updated and the cursor isn't reset
and i thought my english is bad lol
how do i make a database that saves player inventories
Did you use #updateInventory()???
updateInventory doesn't "update" the inventory afaik
it only syncs some packet-like shit
😦
idk if thats enough to update changed items
Click the inventory*
that makes more sense lol
does the inventory automatically update for viewers when you add/remove items to/from it?
Yep