#help-development
1 messages · Page 187 of 1
what?
btw it is now fixed :D
there is a need for it
if your code works for some situation that doesn't mean its good or have no bugs
it might be violating several rules
be slow
Just set JavaPlugin to Loader - this is my main class -, and now it works :D
Thanks :D
not efficient
https://www.google.com/search?q=how+to+convert+a+sentence+into+individual+words+java and click on the first result
and weird(hard to read and to refactor)
thanks
String.split(" ");
or that
would return array of all words
a second monitor is honestly just skill issue
and never close it
i code on laptop yeah
just alt tab
no second screen available
👀
well i can take my PC monitor
But that would be hard to take the wire from pc and plug it to laptop
I'd love a second monitor
or for some type of developer that has extremely tight dead lines
Absolutely useless for most cases
i guess for web devs would be useful
get a hardware upgrade or save up for college
or save up for other useful things
Not really
well my friend usually does that
College is free here :)
Same
where do you live lol
Algeria
Sweden
Алжир
shuvetsiya
oh
where c = ts, not k
im getting better at russian tho
a few days ago i didnt know how to pronounce most letters
now i know the whole alphabet
Б
what lol
yeah
б b
thats obvious
Ahaha i know what you can't pronounce
except its weirdly written
Ъ Ь
has no pronounciation
hehe smart
srry i suddenly written on english
thats ss in german afaik
rr
ya
wanna try pronouncing Russian R in vc
oh
say rust 🙂
rust?
but with strong russian r
that's like r in rrrrrampage
send stack trace
full
https://paste.md-5.net/urorofifuz.pl
Getting this error, line 101 is
ChatUtil.sendMessage(player, "&cInvalid usage! These are the Arena options:");
static function in src folder
you can try Ребёнок
run it in translator and try to repeat
did you reload your plugin with plugWoman again @untold jewel
plugWoman?
did u see my issue?
yeayea
nope
It does not exist in your classpath
How are you building your plugin?
I'm making custom knockback in the context of custom enchants, but I'm running into an issue. At the moment, I'm using Entity#setVelocity, but this is bad for a few reasons, the main reason being that it affects npcs and non-survival players as well. How can I check if an entity is damagable? I've tried using Entity#isInvulnerable, but to no avail. What should I do from here?
also i'm getting IllegalArgumentException: x not finite despite nothing being infinite or divided by 0- why is this? is there some internal division thats happening that is causing this?
npcs by Citizens?
Entity target = even.getEntity();
if (target instanceof NPC/* requires Citiznes API imported */ || (target instanceof Player player && player.getGameMode() == GameMode.CREATIVE)) return;```
basically done
oh true
thanks, that works
do you know anything about the x not finite?
which line throws this error
f.setVelocity
17:10:21 ERROR]: Could not pass event EntityDamageByEntityEvent to SuperItems v1.1.2-ALPHA
java.lang.IllegalArgumentException: x not finite
at org.bukkit.util.NumberConversions.checkFinite(NumberConversions.java:118) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.util.Vector.checkFinite(Vector.java:814) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity.setVelocity(CraftEntity.java:452) ~[paper-1.19.jar:git-Paper-65]
at me.zenox.superitems.enchant.EnchantRegistry.shootSkull(EnchantRegistry.java:94) ~[superitems-1.1.2-ALPHA.jar:?]
at me.zenox.superitems.enchant.EnchantRegistry.darksoulExecutable(EnchantRegistry.java:81) ~[superitems-1.1.2-ALPHA.jar:?]
at me.zenox.superitems.enchant.ComplexEnchantment.useEnchant(ComplexEnchantment.java:97) ~[superitems-1.1.2-ALPHA.jar:?]
at me.zenox.superitems.events.PlayerUseItemEvent.useEvent(PlayerUseItemEvent.java:36) ~[superitems-1.1.2-ALPHA.jar:?]
at me.zenox.superitems.events.PlayerUseItemEvent.lambda$new$0(PlayerUseItemEvent.java:24) ~[superitems-1.1.2-ALPHA.jar:?]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:669) ~[paper-api-1.19-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.callEvent(CraftEventFactory.java:248) ~[paper-1.19.jar:git-Paper-65]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:986) ~[paper-1.19.jar:git-Paper-65]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleEntityDamageEvent(CraftEventFactory.java:963) ~[paper-1.19.jar:git-Paper-65]
at org.bukkit.craftbukkit.v1_19_R1.event.CraftEventFactory.handleLivingEntityDamageEvent(CraftEventFactory.java:1186) ~[paper-1.19.jar:git-Paper-65]```
there's more, but i've cut it off just to avoid discord's message character cap
yeah, I really don't understand why it would do that- as I'm not doing any division that could lead to infinite values
print your initial.toVector()
and result of subtraction
normalize and multiply probably have nothing to do with this error
alright
https://cdn.discordapp.com/attachments/853740198659883008/1031319690682830929/unknown.png - so uhh... where do I put plugin.yml now (just converted non-maven project into maven project)?
don't use Eclipse convert
Eclipse convert is fine. plugin.yml goes in resources
probably should be in src
it is currently in the src folder
should I make a main and a resources folder?
(as like how maven works)
i guess you'd better create new maven project and just copypaste files
...........
ymls to src/main/resources and classes to src/main/java
not gonna take long
try creating resources folder in src and put your ymls there
https://cdn.discordapp.com/attachments/853740198659883008/1031321300339265588/unknown.png - this is like everything I need to redo then :D
however some of them are discontinued xd
Is archetype important?
no, skip it
might have
why you don't just use Citizens tho
it's like the entire NPC system with giant api
Remapped is ServerLevel
I mean
if there is one system to replace, it would be NPCs
and worldedit is only used on demand
wdym by that
while npcs are constantly there
ye
yeah
I like had no troubles with it's API
Or it's functionality
tho
it was kinda popular
all of the time
why not? 🙂
look at the updated javadocs
New error is always progress
why don't you just google mojang mappings
Is there any consistency in how much time/ticks passed between AsyncPlayerPreLoginEvent and PlayerJoinEvent?
no
Okay, I'm sure I'll be better off just listening to both events rather than using arbitrary task delays then
How did you get that format?
on the prefix
oh :(
sorry but thats less cool I was reaaaaaaally hoping there was a way to make this
XD
weirdly enough - target instanceof NPC doesn't work
is that Citizens NPC?
Bukkit#getOfflinePlayer() has been removed from api?
no, it requires an arg
do you mean getOfflinePlayers() ?
there has never been a getOflinePlayer()
No I'm not
Check the docs bruh
argue all you like but you will realize you are wrong after a while
there is getOfflinePlayer(String) and (UUID) there has never been a ()
How would a no arg getOfflinePlayer even work 😛
You are using a getOfflinePlayer(UUID)
Yes i mean i didnt mention the args because its smth obvious haha
I just was asking if was removed because i forgot to put a first map to get the uuid from the user
yes
There 100% is
omg, No there is not
I've used it multiple times
there is getPlayer() in OfflinePlayer class only
Or im trippin
look again and read it properly
he just fucks because it has an argument but is the same shit
I mean he is make to lost time
🤣
Its nto teh same shit. Its completely different
same as me i guess
a method has a specific signature. no args is not the same as a String arg or UUID arg.
Cya
Ofc you cant, you would have to put their name or uuid into the argument
Which is precisely why we are saying there is no getOfflinePlayer().
and never has been
loop the List and check for a contains
List#contains()
only correct, if that is the full line. He asked to find the word so you can assume its a partial entry
Gotcha 👍
ok, so he should do it via regex or smth like that
nah
contains is fine but he needs to do it on each line not the actual List
yes
Yeah
i just realize
Yeah
list.forEach(s -> if (s.contains("string")) {
// do your code
return;
});```
brave those is my man
Not using shity fors
tho sometimes fors are better
no
forEach loops only work with final variables if they are declared outside of forEach
i mean i as asked to recode a plugin which has for int to loop thru list, etc
And i have to decline it because it was too much haha
cuz of no final limit
Dont you know?
i know
for (int , , a++)
for int i = 0; i< 99; i++
Doesn't spigot have a commandbuilder? Without adding the command to the plugin.yml? Can't find it for some reason
Afaik you have to inject your commands with reflection like the rest of us
😔
CommandMap getCommandMap() throws Exception {
Field field = this.plugin.getServer().getClass().getDeclaredField("commandMap");
field.setAccessible(true);
return (CommandMap) field.get(this.plugin.getServer());
}```
And then go ahead
Collection#forEach i guess
why not just register command in plugin.yml
JREE FRAVA LESSONS
??
depends on the context but probably by streaming filtering
var newLore = itemMeta.getLore().stream().filter(s -> !s.contains("-")).toList();
itemMeta.setLore(newLore);
basic java
?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.
or take FREE JAVA LESSONS from me
Good luck 🙂
That's for Java > 8
if you are on java 8
instead of var do
List<String>
and instead of toList() do collect(Collector::toList) or smth similar
don't remember
it works now
wdym
i filter strings here
yeah
technically its not "removing", its just making sure each string does not contain -
then i just collect filtered stream to list
is there anyway I could move an entity exactly 1 block with a velocity? that way the movement is smooth but still exact
well you can move it +- 1 block
?
well just use setVelocity(entity.getLocation().getDirection().normalize()); i guess
velocity gonna be 1 in the direction
But that doesn't mean the entity will move 1 block in that direction I thought?
yeah that wouldnt move it 1 block
Thats different then moving an entity 1 block is ze problem
well use Vector#multiply unless you get something similar to 1 block when applying resulting velocity to entity
the velocity is equal to meters per tick, but the question is what is the deceleration of velocity
google is just providing me with boats
😭
anyone off the top of their heads know what a dragon head would cast as? It doesnt cast to Skull
declaration: package: org.bukkit.entity, interface: EnderDragonPart
i guess
tho you can just place var and then check what variable type is
oh i meant the block itself called dragon head.
oh
Trying to see what direction its facing
Block?
isnt that Directional
Im trying to get a blockface direction from it
Im not sure how to get the direction of a block
skull has methods like .getRotation
it can be any direction
its a placeable block, skulls like that are not entities
well yeah but skulls are not entities
maybe dragonhead is an entity same as armorstand
try getting it as EnderDragonPart and then get it's direction
what error do you have when casting it to skull tho
just typed /kill @ e on my server with both a dragon head and armor stand placed, very scuffed but I did confirm dragon heads are not entities
hmm
.
maybe we can get it from stack trace
java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.impl.CraftSkull cannot be cast to class org.bukkit.block.Skull ---- is the exact error
cya
You don't have to use NMS.
The DRAGON_HEAD Material has a Rotatable data class, so you should be able to do
Rotatable rotatable = (Rotatable) block.getBlockData();
System.out.println(rotatable.getRotation());
oh cool, that works too, thanks
Only reason Skull has its own type is because it's both Rotatable and FaceAttachable
Actually I lied. They're also Rotatable lol. I thought player heads could be placed on walls too?
Ah there's a PLAYER_HEAD and a PLAYER_WALL_HEAD, Rotatable and Directional respectively
I have an event handler, PlayerInteractEvent, and I have an if statement in there, it checks if the player's item in their main hand is equal to material.compass. I have some test messages up because it did not work that tell me what happened in-game. The first test message tells me the item in my hand is ItemStack{COMPASS x1}. The if statement checks if the item in the hand is a compass and the if statement returns false for some reason. Can anyone tell me why and how to fix this?
@EventHandler
public void onRightClick(PlayerInteractEvent event) {
Player player = event.getPlayer();
player.sendMessage("§8TESTING PURPOSES - " + event.getPlayer().getInventory().getItemInMainHand());
if (event.getPlayer().getInventory().getItemInMainHand().equals(Material.COMPASS)) {
player.performCommand("gameselector");
player.sendMessage("§8WORKS");
event.setCancelled(true);
}
}
Get type
You are comparing an itemstack to material
Change
event.getPlayer().getInventory().getItemInMainHand().equals(Material.COMPASS)
to
event.getPlayer().getInventory().getItemInMainHand().getType().equals(Material.COMPASS)
Use == when comparing enum values
damn I just found the maxHealth setting in the spigot.yml, why is that like a secret? never heard of it
Elo
What is the best way to make sure that when calculating the total percentage of doing 2 stats that if one I have eg 500% done it only limits it to 100%?
if(actualAmount > requiredAmount){
actualAmount = requiredAmount;
}
Would this work
you could use Math.min
How would that work then for calculating the percentage?
cause the result would only return 1 number
lol
What do you want to do exactly?
I meant something like this.
Math.min(actualAmount / requiredAmount, 1) unless I'm misunderstanding your question
According to your explanation, looks like that you want to limit your percentage to 100,even if it went further
yup
Ok that makes sense
if you wanted to make sure it doesn't go over 100, then divide the number by 100, if it is 1 or greater then its above 100%
simple maths :')
and i can just make percentage = that x 100
as long as the number is float, it should get you the right percentage
or even a double
Hi all! I have a question how to make it so that if an item from an ItemStack was right-clicked, for example a chest, then the opening of the chest was canceled
check for the inventory open event, check what the player opening the inventory has on the main hand, cancel when appropriate
Is there a way to disable damage in the EntityDamageEvent ?
cancel the event
Yeah, but no
set the damage to 0
Thing is there you have a problem with endless repeating
no you don't
there you get no damage but knockback
If you want I can show you
I would rather say something nice about @echo basalt than get on voice chat with you
and I would rather start ww3 than say something nice about him
hää?
??
how the hell did he look like me then
same face, beard
if he did not return your look with intense disdain and hatred then he looks nothing like me
as it turns out game dev is a lot of work, who'd've thunk it
the thing that kills me the most is the art style, I am not artist and I just can't get myself to commit to anything
i dont understand you guys
and I don't understand how setting the damage of an event gets you an infinite loop
make a plugin which cancels every projectile damage
get a bow and arrow
alright I went back in time and did that 5 years ago
yeah no shit
that's what you told it to do
a) not an infinite loop
b) your fault for not removing the projectile on the damage cancel event
How will you e.g. remove the void?
try that sentence again
you are just rude and dont understand anything bb
@tender shard oh no I've accidentally impersonated you
Bro can't figure out how to cancel a single event 💀
he ain't getting away that easy
meanwhile, in a different discord...
discord is the worst at snitching on people
😂
it appears I am missing
I hope you go on a journey to find yourself then
generally it helps to specify the requirements and not just keep adding more requirements as they give you solutions to your problem
they haven't
is he back?
if they weren't here I wouldn't be able to ping them
seems like they're not here to me
also he's only on paper on my mutual servers
no they were gone for a while, I am certain of it
nah he's on
I know, it was just not working
did you finally find a cliff?
for us to meet at the rap battle event next year
we'll do a couple battles
that is not the kind of battle I was thinking of
have some mom's spaghetti
also I am leaving this place next year
because your palms will be sweaty
running away from the war because you know you will lose
I heard that loseritis is infectious and I noticed you were on this continent
so I'm out
🤓 axually loseritis is very infectious and I'm scared to catch it
bud... I have bad news
it's terminal
putting you down would be a small mercy
shame I can't make it to the rap battle
I'll die happy knowing I've never seen your face IRL
that is the real terminal disease
yeah sounds like you're really infectious
you know what they say, never meet your gods
frostalf is determined to use every gif today
it is just going along with the background theme
frostalf is determined to kill all the mobile data
you're on mobile?
should be glad these aren't even super HD gifs
A noble goal, to be sure.
if you're on mobile I have a manifesto that I really, really want you to read
it's about 5pb large
is it lorem ipsum?
you haven't lived long enough to have a 5pb manifesto
I first read pb as "pebble" and I will not go back to petabyte
watch me upload a zip bomb and disguise it as logs
they say an image is worth a thousand words so I filmed my manifesto in 8k 120fps and then converted it into raw text so illusion can read it
weird way to flex the capacity of your porn storage server but ok
they say a picture is worth a thousand descriptions, but words last forever
Ima be real I don't think they do
ah right the hieroglyphs are fake
That's drawings get it right 😏
words last forever unless the medium they're on rots away or people forget how to speak the language
Idk I can write something and nobody will care and it will fade away in history
While technically still existing
I wonder how much of an effect an EMP would have on your ssd
🤔
how to get note/instrument of noteblock in BlockBreakEvent?
No matter where you write it the thing you wrote it on will eventually fade into nothingness, like @echo basalt 's braincells
Relatable
weren't you the one asking me for nms help
me?
get its blockstate and cast it to noteblock
i'll give it a try.
It works! thank you
Hey is there any api or anyway make a repices unlocked on player screen with different title , icon?
i want to use it for my quest plugin
but i can't find any api for that
do a toast
like send a popup this messager with different title and description
You have to use. Packets
No built in api on spigot for it
I think theres a few libs for it though
custom advancements are possible right?
probably could just make use of advancements for custom toast messages
do advancements have the item icon?
they have a icon iirc
oh im bugging then
somewhat of an api if you use Bukkit#getUnsafe
I think I'm starting to be influenced by illusion
I was wondering where the package for my usb power plug was, checked amazon, amazon says they delivered
check the tracking number, tracking says it was delivered a month ago
I look under the desk, the power plug is there
can i have this api plz
declaration: package: org.bukkit.advancement
Do you have any video or guide for this ?
nope
this is where you just need to learn more about Java
or understand how to read and use API's
int x = 0;
for (; x <= config.getInt("menu.items_amount"); x++) {
if (slot == config.getInt("menu." + String.valueOf(x) + ".slot")) {
break;
}
}
player.sendMessage(String.valueOf(x));
1 should be sent to the player, but 0 is sent, why and how to fix it?
++x
This is written in the loop parameters
you have x++ you need ++x
Does it really matter?
I tried it, but it also outputs 0, not 1
Get and increment vs increment and get
int x = 0;
for (; x <= config.getInt("menu.items_amount"); ++x) {
if (slot == config.getInt("menu." + String.valueOf(x) + ".slot")) {
break;
}
}
player.sendMessage(String.valueOf(x));
Can always just start x at 1?
Thanks, it seems to work, but why didn't it work when the value was 0?
Idk what you're doing so I can't say
since x is assigned outside of the loop, the operation doesn't work the same because x isn't being overriden value wise
if you have x being outside of the loop the more appropriate way would be to do x=x++
it is the only thing I can think of unless you are not implementing it properly
or just change the for statement to for (int x = 0; x <= config.getInt("menu.items_amount"); ++x) {
Imo just setting x to 1 is less work
Is there any method to be able to spawn custom mobs with a specific amount?. Or do I have to use a loop?
while true, it is always nice to have these discussions so that others become more enlightened to the nuances 🙂
for loop seems the most logical solution
I think so, too. It's just that if there is a method, it might be better.
would be the first time I hear about one
another method you could probably do is mark the entities spawned so you know they are spawned from your plugin and then just use the entityspawnevent to keep spawning more would only need to keep track with a value somewhere in how many have been spawned. only other way I could think if you really don't want a for loop lol
Oh nice
when I try to use ConfigurationSerialization for ItemStack none of the data from the ItemMeta actually goes with it. do I have to save that data myself?
actually, dont answer that just yet
meta is saved from what I remember, but only in yaml
I do remember meta being lost when using json
I was just not setting the meta to the item
my bad
Im using yml
even the pdc gets serialized
anyone can help me?
i am unable to access .spigot()
it give error
if i also type p.spigot()
@ancient plank
How do you expect us to help without any code or errors
presumably some dependency is pulling in bukkit ? provide your dependency tree
don't ping staff for development or server help
ItemStacks are FULLY serializable
with NBTs PDCs meta and stuff
@ancient plank can you help me with my topic
set 6 hours slow mode on it
you cant
who says
Hola, does walk speed/fly speed effect how quickly you move in water
Also what's the default walk speed
probably not
Ty
I have a PlayerInteractAtEntity event which I use to make a Villager serve as a join npc for a minigame. However it opens a the trading window which I do not want to happen? How would I prevent this?
Default walk is 0.2f, default fly is 0.1f
How do you get the bungeecord API jar?
I don't think there's an API jar in specific, bungee isn't an abstraction layer
I remember having one in the past, just not sure where to get it
should be in the spigot nexus repo
Thanks!
Bungee does have an API module
maven?
Done via Maven, yes.
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.19-R0.1-SNAPSHOT</version>
</dependency>```
oh ok thx
hi, i have a string that is a player uuid. how do i get a player by that uuid (which is a string)
UUID.fromString
this?
how might I set a radius for the user? and paste schematics within that radius?
should work, yeah
how do i set new scoreboard as main scoreboard? or does that happen automatically?
declaration: package: org.bukkit.entity, interface: Player
im dumb its just stscreboard LOL
Be careful so you don't break other plugins
oh you sent it too
I have a server network, and I'm gonna use an ender pearl for the game selector menu in the player's inventory. I have canceled the event when someone uses an ender pearl in a PlayerInteractEvent. When I use the ender pearl, however, It puts the little white overlay on the item slot in the hotbar. Is there any way to remove this?
the screen shot is kinda bad, sry, it goes so fast its hard to get a good one
maybe setting the cooldown of the item to 0 could work?
hm, how do I do that?
ok
declaration: package: org.bukkit.entity, interface: HumanEntity
Player.setCooldown(Material.ENDER_PEARL, 0);
How might I set a radius for the player?
ah ok thx :)
elaborate
radius of what
he is 360 by default
Trying to set a radius for the player so I can paste a schematic to fill in the gap
yea
and what is the problem
He's creating rooms/maze using schematics but his server can;t handle pasting them too fast. We've told him to use worldgen/chunk loading instead but he won;lt
I can't figure out how to
I tried that last night
just place schemtaic and that's all?
IT doesn't work
depends on how big schematic is
Of course it works. You want every new chunk spawned to be a room. How do you think normal chunks are spawned?
16 * 16 * 6
Not sure
If your server can handle generating normal chunks then generating a 16x16x16 as worldgen is tiny
unless you make it very very inefficient, yes
there is no need for radius to fix your problem
No, like no errors pop up, but it doesn't generate
you can use my Void generator guide
and isntead of air just place blocks where needed
then debug. put messages everywhere in your code and check what executes and what doesnt
for each chunk in generator
it's literally 1 16th of the server load to generate rooms rather than full chunks
ok
The way you are tryign to do it is adding more work for the server to do instead of making it simpler.
you are making the server generate a chunk, overwrite the chunk with your room
instead you shoudl be replacing teh world gen with placing yrou room
oh and on top of the extra work load you are using WorldEdit to paste yoru schematics
Yea, thats my main thing to generate it
Unless theres a better solution
use worldgen and you will actually increase the performace of yoru server
Im switching to it rn
good plan
instead of my surface method do your own realization which pastes blocks
if you also want some biome
wc.biomeProvider(new NetherProvider()); // Here is biome provider we need to create```
wait
Collections.singletonList :(
@fluid river
?
I'm trying to convert my project to maven but I am having trouble with nms. Maven in intellij cannot find "org.spigotmc
1.16.5-R0.1-SNAPSHOT". I have run the buildtools with the mappings flag and supposedly this would put the mappings into my local maven repository.
how might I use my own that pastes blocks?
instead of your surface thing
did that
so
and any random y you want
so try (EditSession editSession = WorldEdit.getInstance().newEditSession(world)) { Operation operation = new ClipboardHolder(clipboard) .createPaste(editSession) .to(BlockVector3.at(loc.getChunk().getX() * 16 + , 40, loc.getChunk().getZ() * 15 + 8)) .build(); Operations.complete(operation); }
instead of loc.getChunk() you now have chunkdata
so data.getblockdata?
Don't use worldedit inside a worldgen. It will attempt to use getChunk which is not safe
how??/
I think Bukkits Schematics are fine to use in worldgen
bukkit has schematics?
data.setBlock(x, y, z, Material.STONE);
then how do I add the varius corridors, etc?
world edeit or bukkit?
bukkit
k
where may I find the bukkit schematics usage?
and the string list in a schematic.yml file 🙂
I cant find it
and then manually built locations from strings and placed blocks
wheres the bukkit schematics usage doe
as you have all yrou rooms as schmatics you may be better off reading those, but not using worldedit
so I take what I already have, and convert them into .schematic, instead of .schem?
no
The way I'd do it is convert all your current schematics to structures and use teh Bukkit API to paste them in yoru worldgen
So how could I do dat
yea, so I could read from my current schem and create it as a structure?
The individual Structures are how you place them https://hub.spigotmc.org/javadocs/spigot/org/bukkit/structure/Structure.html
oki
yea so?
so place with worldedit, then use StructureManager to create a Structure, fill (copies the block data) and StructureManager to save it
Could I have an example?
Im still extremely confused
look at teh two javadocs I pasted
So place it one time
what event triggers if u do /reload?
so
createStructure()
none
yes, Bukkit.getStructureManager().createStructure() gives you a blank Structure Object
you know the server is reloading by seeing if worlds.size() > 0 in JavaPlugin::onLoad
Then use the returned structure to fill
no, i mean like if u do /reload confirm
what returned structre/
like to reload the plugin
maybe in paper
cuz always if i reload my list gets reset and it gives all players free 100 levels 😳
my plugin breaks too on reloading
just put Runtime.getRuntime().halt() /j
people will do everything to reload their server
same thing like using 1.8
Structure newStructure = Bukkit.getStructureManager().createStructure();
newStructure.fill(loc1, loc2, false);
NamespacedKey key = new NamespacedKey(...);
Bukkit.getStructureManager().registerStructure(key, newStructure);
Bukkit.getStructureManager().saveStructure(key);```
instead of loc1, loc2, can it be intx, intz?
just make those coordinates and a world into a location object
There are two fill methods
one takes two Locations, the other takes an origin Location and a vector length
you would probably use the second
wdym?
fill(loc1, new BlockVector(x,y,z), false)
hi, I have a question ... I have a hub with spigot and obviously a bungee connected ... I am learning to do pl bungeecord and therefore, I was told that for a pl for example for the hub I have to do it entirely in bungee, but can I put the bungee pls in the plugins folder of the hub in spigot? otherwise what's the point, I can't put it in the bungee otherwise it affects all modes
I have to do them in bungee for connections to modes
with compass
so like htis?
if (Bukkit.getBukkitVersion().split("-")[0].split("\\.").equals("8")) {
System.out.println("ew 1.8 im outta here");
Runtime.getRuntime().halt();
}```
@eternal oxide
wait what does that do?
@eternal oxide is this right?
dont try it on a server you want to keep playing on ig
trying to generate rooms
no the generate surface method is for generating the world. The code I gave you is how you copy your schematics to Structure types
What you want to do is use the void generator.
then after the void is generated, place your structure
That removes all generation code so its super fast
and 1 tick later pastes in the Structure
hi, I have a question ... I have a hub with spigot and obviously a bungee connected ... I am learning to do pl bungeecord and therefore, I was told that for a pl for example for the hub I have to do it entirely in bungee, but can I put the bungee pls in the plugins folder of the hub in spigot? otherwise what's the point, I can't put it in the bungee otherwise it affects all modes
I have to do them in bungee for connections to modes
with compass
ok
so where might I put ``` Structure newStructure = Bukkit.getStructureManager().createStructure();
NamespacedKey key = new NamespacedKey(loc1, new BlockVector(60,40,60), false);
Bukkit.getStructureManager().registerStructure(key, newStructure);
Bukkit.getStructureManager().saveStructure(key); ```
@eternal oxide
you use that to convert yrou current schmatics to Structures
and thats not how you create a NamespacedKey
;-;
public Structure generateStructure(Location loc, String name) {
NamespacedKey key = new NamespacedKey(plugin, name.toLowerCase());
Structure newStructure = Bukkit.getStructureManager().createStructure();
newStructure.fill(loc, new BlockVector(16,16,16), false);
Bukkit.getStructureManager().registerStructure(key, newStructure);
Bukkit.getStructureManager().saveStructure(key);
return newStructure;
}```
ok so this is my main class so far
thats just a util method to create and save a Structure
of size 16 at teh provided loc
varchar max brr
I set loc as the player location
silly billy just use Text
no, that should be the corner of your schematic
yea, I just deleted the variable
for player loc
that method is just a step for converting yoru schematics to Structures
so
ye figuring out pros and cons of varchar/ text, isnt text an sqlite specific thing tho?
ie, paste in your current schematic (at loc) call that method to copy it/save to a Structure file
kk
so I have to do it in game
someoh
at 16, 16, 16?
is that corect/
at whatever location you want
you just need to convert all yoru current schematics to Structures
be sure to remember the names you give each Structure
mayhaps
its at 16 16 16, but its not quite 1 chunk exactly
add an offset to the generation coords
if it's 1 block short you can't have got the loc or the vector quite right
paste at 0,0,0
simplest
its got an offset on the schem im guessing
looks like
you offset when you copied the schematic
so paste at -1 in whatever direction its off
-1 0 -4 i would guess looking at that
but be sure to save the Structure at 0,0,0
i was correct lmao
stand at -1, 0 -4 then paste the schem
should paste exactly at 0, 0
actually 3 blocks
once you get it correct, load each of your schematics one by one, and save as Structures, giving each its own name
quake pro
Why isn't this working?
package com.marqus.cubicscoreboard;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.*;
public final class CubicScoreboard extends JavaPlugin implements Listener {
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
createBoard(player);
}
@Override
public void onDisable() {
// Plugin shutdown logic
}
public void createBoard(Player player) {
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective obj = board.registerNewObjective("FangeBoard", "dummy");
obj.setDisplaySlot(DisplaySlot.SIDEBAR);
obj.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&a&lCUBIMC &8- &f&lPRISON"));
Score name1 = obj.getScore(ChatColor.translateAlternateColorCodes('&', "&7Dit navn &8»"));
name1.setScore(3);
Score space = obj.getScore("");
space.setScore(2);
Score name = obj.getScore(ChatColor.translateAlternateColorCodes('&', "&a" + player.getName()));
name.setScore(1);
player.setScoreboard(board);
}
}
I am using 1.8 I know I should update to a higher version, but I am keeping 1.8
Ok there, ima just ask because all other people here are probably tired of it. What is not working
The scoreboard isn't showing up.
how do you know its not working?
No errors, but the sidebar is not just showing up.
are you reloading the server?
maybe put it on a delayed task
How do I do that? 😄
when a player just joined they may not receive the Scoreboard correctly
The bukkit scheduler
Ehhh
now save it as a Structure
?scheduling
ah
@nimble oxide this should help
Only the top part is at 0 0 0
is that fine?
oh
but this is a multi y level schematic
so if it's 16 tall paste it at 0,16,0
each schematic is 16 tall yes?
I'm assuming you have a seperate schematic per room type
Well I have no idea how yoru schematic is setup
What do you mean by it's a multi level?
if it's just 16 tall then paste it at 0,16,0
It’s 7 blocks tall
Ok I did that
What now
ok, now call that method I gave you using the correct values
So 0 7 0?
if it's 7 tall then change teh size in the BlockVector too
To 16 7 16?
yep, pass a Location of 0,7,0 and a Vector of 16,7,16
so I just gotta add this to my method or what?
Thread.sleep(1_000L);
no
Try the Bukkit.getScheduler.scheduleSyncDelayedTask method
public Structure generateStructure(Location loc, String name) {
Location loc = (0,0,0)
NamespacedKey key = new NamespacedKey(this, name.toLowerCase());
Structure newStructure = Bukkit.getStructureManager().createStructure();
newStructure.fill(loc, new BlockVector(16,7,16), false);
Bukkit.getStructureManager().registerStructure(key, newStructure);
Bukkit.getStructureManager().saveStructure(key);
return newStructure;
}```
so this:
BukkitScheduler scheduler = Bukkit.getScheduler();
scheduler.runTaskLater(plugin, () -> {
Bukkit.broadcastMessage("Mooooo!");
}, 20L * 30L /*<-- the delay */);
runTaskLater if you don;t want deprecated
Pseudo code rn on my phone
yes, that would delay by 30 seconds
loc of 0,7,0 unless you use a negative vector of 16,-7,16
You would most likely only need 5 or so ticks at most
actually using a negative vector is probably a good idea
as it will cause the Structure to be placed from bottom up, meaning no chance of things like sand falling
so saving the structure using loc (0,0,0) and vector (16,-7,16)
and whatever name you want
all lower case
the resulting Structure file will be saved into your world folder
Then you can write your code
the simplest is to use teh void generator you were given earier
so, how do I set loc to 0, 0, 0/
?
The simplest implementation...
use the void generator (without any modifications)...
add a ChunkLoadEvent listener
"Void generator" sounds like a cool end game item in some mod pack XD
in that is isNewChunk() use the StructureManager to get yoru Structure and place at teh chunk coords
ik
but how to set loc to 0 0 0
yea
I gave you the full method to save it
How do I make it go at 5 ticks
public Structure generateStructure(Location loc, String name) {
Location loc = (0,0,0) //this part gets an error
NamespacedKey key = new NamespacedKey(this, name.toLowerCase());
Structure newStructure = Bukkit.getStructureManager().createStructure();
newStructure.fill(loc, new BlockVector(16,7,16), false);
Bukkit.getStructureManager().registerStructure(key, newStructure);
Bukkit.getStructureManager().saveStructure(key);
return newStructure;
}```
you pass the Location to the method
you don;t set it in the method, and thats not valid anyway
also if using 0,0,0 don;t forget to change the vector to -7
Set delay to 5
public Structure generateStructure(String name) {
NamespacedKey key = new NamespacedKey(this, name);
Location loc = (0, 0, 0);
Structure newStructure = Bukkit.getStructureManager().createStructure();
newStructure.fill(loc, new BlockVector(16,-7,16), false);
Bukkit.getStructureManager().registerStructure(key, newStructure);
Bukkit.getStructureManager().saveStructure(key);
return newStructure;
}```
still an error at
Location loc = (0, 0, 0);
like the 20L * 30L to 5L * 5L or what?
thats not how you create a Location
figured
new Location (worldName, 0,0,0)
You set ticks with 30 times 20. 20 ticks is one second, 30 seconds. You would just put in a 5
