#help-development
1 messages · Page 717 of 1
bruh
?doesntwork
?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.
got it
ahh
how can I say I haven’t tried this code yet but I’m sure there will be errors and I would like to ask in advance ahaah
i "fill it"
oh i see
correct
ok
So a problem has arisen: there is a possibility that a player may disappear during the cyclic flow, what should I do? Check for null every time?
i mean yea?
if i do anything with player its either in the same tick or its a if(player.isOffline()) return
i dont think the player object itself gets nulled
Don't keep a reference to the player if you want to do something over multiple ticks
Store the uuid and use getPlayer
bruh player object not has equals hashcode too??
what would be the most resource efficent way to create a new completly empty world and load a scematic into it (for mini games if that isnt obvious)
alright
Way it works is that every player is assigned an implementation of the interface PatronHandler. It contains the method bodies for all methods called but no implementations
so my question now is: wtf is going on here?
does anybody know why does it just print 0
you seem to have issues with your package naming case
explain? i really doubt somethingn like that can cause an exception unless the names are identical
its probably not causing your issue, but it makes even your stacktrace hard to comprehend
ah
side note
this error only happens sometimes
i have yet to figure out a consistent trigger for it
even if i dont change the code where it happens
?paste your EventPlayerMove listener
public class EventPlayerMove implements Listener {
@EventHandler
public void onMove(PlayerMoveEvent event){
Echo.getInstance().getPlayerHandler(event.getPlayer()).moveEvent(event);
}
}
like
its just passing through the event to the interface implementation
all listeners in the project do that
line 11 is?
some players have different things happen when they move so i was like 'this is simpler than one massive event method'
the one starting with echo
so your getPlayerHandler returns a PatronHandler?
is that in teh same project or in a dependency?
same project
ive been trying to figure it out for a while now
if it were after a reload it could be some weirdness with not being in the registry thingy like what happened with the log handler
but this is right after server start
if it's after a restart you are not clearing your hashmap in onDisable
its looking at teh wrong class instance after a reload
server start
fresh start?
yea
whcih is why im a tad confused
like normally this is where u thorw at me the 'of course it breaks with reload' but
in that case create a local variable in your move event
{PatronHandler handler = Echo.getInstance().getPlayerHandler(event.getPlayer());
what'd that change?
then only call the moveEvent if not null
cant be
for two reasons
one, the error'S a classNotFoundException
two, if there's no handler it returns an empty implementation
NullHandler, all empty method bodies
do you have the same class in another plugin?
no
then no clue
bleh
your error seems impossible
story of my life bruh
@ivory sleet i think we spoke about this like one or two days ago and either you or mfnalex were like 'its a restart issue', apparantly not
any clue?
uh
today's thread starts here #help-development message
ive been having this on and off sometimes
like sometimes it happens and sometimes not, even if i dont change any relevant code
it appears random
its impossible for a Class to be unloaded at runtime while there are references held
it seems like an impossible error
show where you fetch/return your PatronHandler
your getPlayerHandler
private HashMap<UUID, PatronHandler> playerHandler;
public PatronHandler getPlayerHandler(Player player){
return playerHandler.get(player.getUniqueId());
}
public void setPlayerHandler(Player player, PatronHandler handler){
playerHandler.put(player.getUniqueId(),handler);
}
@Override
public void onEnable(){
playerHandler = new HashMap<>();
}
its part of the class extending JavaPlugin cuz the map's supposed to be a singletron
This getPlayerHandler(Player player) can return null
yes, its just a hashmap
what if someone sends a move packet before you managed to add them to your map?
im pretty sure packets get handled sequentially, correct?
if that is the case, then the player entry CANNOT be null cuz I'm doing this in onJoin
also
its not a NPE
well, yes and no
its a 'class loader missing this'
it kinda is
well not of the handler
do the local variable as I said and I bet you don;t get any more errors
we'll see
just check for null before calling event
alright as usual the error's gone now
but
its always done that
be there, then vanish, then reappear even if im not doing anything different
time will tell
are you running Spigot?
you are using a HashMap so you could use getOrDefault instead of get
then you can guarantee never getting null
that... doesnt help if the error isnt a NPE but a class not found
I'd be returning something the jre thinks is non-existent
class not found makes no sense as it's in teh same plugin
you can open the jar and the class does exist
yea so tf is going on here
PC out window
?
actually
you might be onto something here
what are these and why are they empty
run a clean
already did
you are not keeping the target/build folder open in a window are you?
why would i
i just go into IJ and hit the button
also just to be sure i manually ran the clean and package profiles
the classes are still there when i look into them with the decompiler
No, I'm new to minecraft plugin development
came here to ask
What's the best way to check when an empty glass bottle gets filled with water from a block of water? There doesn't seem to be a Fill event like there is for buckets. And I had trouble using "OnPlayerInteract" because you can't right click a block of water.
actually you can
it counts as right clicking the block behind it, and it also triggers if you right click while holding an item
so you just need to check if a) the item in main hand is a glass bottle and b) the block the player is looking at is water
you're looking for the rayTrace method btw
Hm ok. I'll look into that. Thanks a bunch!
Hey, I'm making a plugin where you can right click a fireball to throw it. I've already made the fireball not be able to damage the terrain with a EntityExplodeEvent listener, but while the fireball is travelling it is able to break powdered snow, and I haven't been able to find a way to cancel that. Any ideas?
you're actually the goat
it was a physics event
actually, do check BlockFadeEvent too
iirc its a event thats extending on BlockPhysics
if it is you should use that
its a lot more specific
hm interesting
no guarantee, its not a physics event
but it is a block event
yeah I checked this asw it's not a blockfadeevent
alright then
its just that its better to use the specific events
less parameter checks
yeah I was really hoping it was
because now I need to figure out how to see if a physicsevent is caused by a fireball
idk where to start w/ that tbh
actually
just print out this
event.getChangedType() + " " + event.getBlock() + " " event.getEventName()
should give you a nice starting point
and maybe a more specific event too
unfortunately you cant just do that with Event event cuz that one's an interface lol
all the events fired when a powdered snow block is broken:
[21:37:03 INFO]: AIR CraftBlock{pos=BlockPosition{x=1242, y=-41, z=912},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
[21:37:03 INFO]: AIR CraftBlock{pos=BlockPosition{x=1244, y=-41, z=912},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
[21:37:03 INFO]: SNOW_BLOCK CraftBlock{pos=BlockPosition{x=1243, y=-42, z=912},type=SNOW_BLOCK,data=Block{minecraft:snow_block},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
[21:37:03 INFO]: AIR CraftBlock{pos=BlockPosition{x=1243, y=-40, z=912},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
[21:37:03 INFO]: AIR CraftBlock{pos=BlockPosition{x=1243, y=-41, z=911},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
[21:37:03 INFO]: AIR CraftBlock{pos=BlockPosition{x=1243, y=-41, z=913},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
[21:37:03 INFO]: AIR CraftBlock{pos=BlockPosition{x=1243, y=-41, z=912},type=AIR,data=Block{minecraft:air},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} BlockPhysicsEvent
not really sure how to narrow down if it's a fireball caused break or not
the third in there marks the block that actually got affected. Not sure why the other locations fire events
yeah I thought that as well, dk why the air is there
but with the data from the third event, there is nothing there indicative of a fireball
huh
Wrong channel. Use #help-server and make sure you're using Spigot
here's what a changeblockevent looks like in the following format: event.getBlock() + " " + event.getBlockData() + " " + event.getTo()
[21:44:40 INFO]: CraftBlock{pos=BlockPosition{x=1242, y=-41, z=900},type=POWDER_SNOW,data=Block{minecraft:powder_snow},fluid=net.minecraft.world.level.material.FluidTypeEmpty@5b8bfdd4} CraftBlockData{minecraft:air} AIR```
cancel the event and the snow should not change
@smoky oak Hey, real quick, are you sure raycast can pick up on blocks of water? I can only get it to return the blocks that are behind the water. The raycast goes right through
thats cuz you tell it to be transparent
what should my parameters be for canceling the event
put into the raycast air only
if getBlock == powdered_snow && getTo() == air?
getBlock().getType()
how?
yeah I figured
can u tell me the class that is in rq? Need to check it
dont have my ide open
I'm using RayTraceResult
no like
what type of object is calling the raycast
its not location
ah found it
youre looking for Player.rayTraceBlocks(distance, FluidCollisionMode.ALWAYS);
or SOURCE_ONLY
nerds
depending if you want to hit flowing water or not
so what ur here too
good point
Ok ill try it. Thank you again!!
Its starting to work! Only thing is if the raycast passes through water and doesn't hit a block after then it doesn't seem to return anything as if it didnt hit the water. Doesn't do that when it hits water then a block though, that still returns the water block
if u have any quick thoughts as to why lmk. otherwise i'll take it from here
Location eyeLocation = player.getEyeLocation();
Vector direction = eyeLocation.getDirection();
RayTraceResult rayTraceResult = Bukkit.getWorld(eyeLocation.getWorld().getUID()).rayTraceBlocks(eyeLocation, direction, 50, FluidCollisionMode.ALWAYS);
uh look into how to format code
lol
```java
then type ur code
then three more ticks and enter
Location eyeLocation = player.getEyeLocation();
Vector direction = eyeLocation.getDirection();
RayTraceResult rayTraceResult = Bukkit.getWorld(eyeLocation.getWorld().getUID()).rayTraceBlocks(eyeLocation, direction, 50, FluidCollisionMode.ALWAYS);
yea just keep in mind. It might be an issue with using World, Entity has a raytrace method too
also
keep in mind player reach aint 50
its 4.5
yea
hm
try adding another arg after the mode
'false'
the world ray trace might not use that by default
ok whats it for?
not collide with non solid
o
i do not claim to know why its not collide with solid instead
FluidCollisionMode.False?
nvm
yea
same thing. no difference
Seems to ignore water if the raycast doesn't hit another block after the water
try the entity ray trace?
How?
rayTraceEntities?
no idea what that is or how to use it
player.rayTraceBlocks
cant find anything on the docs unfortunately urgh
the docs tell me what youre doing should collide with water. dont have my ide rn so cant help you more than this unfortunately
What is a good way to add items to a player without risk of those items getting lost in a full inventory. I need it to add items, but if you inventory is full, drop the remaining items on the ground.
Yes I know this is the most trivial thing ever
But is there an existing method?
Adding itemstacks to an inventory will return a Map of items that did not fit in the Inventory.
You can simply use this map to drop overflown items:
public void addOrDrop(Player player, ItemStack... items) {
World world = player.getWorld();
Location location = player.getLocation();
Map<Integer, ItemStack> overflownItems = player.getInventory().addItem(items);
overflownItems.values().forEach(item -> world.dropItem(location, item));
}
Or simply
public void addOrDrop(Player player, ItemStack... items) {
World world = player.getWorld();
Location location = player.getLocation();
player.getInventory().addItem(items).values().forEach(item -> world.dropItem(location, item));
}
*If all items are stored then the map will be empty, meaning the forEach wont do anything
Awesome thanks!
I always seem methods in here that would be useful in my lib
And then I promptly forget them before I add them
it's World#rayTraceBlocks
First argument is a Location, second is the direction
this seems useful

great food
is there anyone who used NMS and has gradle?
Probably
I used https://github.com/PacifistMC/pacifist-remapper in my last Gradle project
but you can also use Paperweight if you want the Paper API
Spigot is based around Maven so use maven if you use Spigot.
i dont like maven
what does even this mean
Try rerunning BuildTools in an empty folder
is there a way to forcefully disable a world in spigot? i am trying to delete the directory the world is in during runtime and sadly it doesn't let me
seems to be workiung
Did you unload the world first
where on mavenlocal is the nms placed?
oh i see
can i just add netty as dependency?
oh cmon
why dont i have stuff like ServerPlayer
Should I cancel an event on MONITOR priority (I just redirect the output to somewhere else, no processing done)
No, MONITOR is only used to monitor the final outcome. It should never modify anything in the event.
Yeah I know that part, but if I set to HIGHEST there is a chance my event gets ran before another plugin's event that modifies the data in that event
yes
take the chat event, I would need to redirect it somewhere else AFTER all the plugins have processed it
Sure. Just call Bukkit.unloadWorld()
already doing it but apparently you still cannot delete it after cause of some type of locking, btw i managed to get around it by deleting them when the server shuts down.
?jira
It's probably a bug then, report it
instead during the login phase of the player, which event gets called first? PlayerJoinEvent or PlayerInitialSpawnEvent
You can delete the world, the only issue is it tries to save raids.dat and crashes after
because when i try to fetch the player elsewhere using the Bukkit.getPlayer(UUID) in the PlayerInitialSpawnEvent this causes a NullPointerException that makes me thing this event is called before the playerjoinevent itself
You can;t unload the overworld, End or Nether
pain
The world api is kind of scuffed. Loading a world causes IO on the main thread and unloading a world doesnt wait for all resources to be released.
I usually just delete the world folder in a loop after unloading it, until its actually gone.
yep already done thats how i also managed
That's odd, I just
// unload world with save false
// delete folder
and it works 100% of the time
about this?
Yeah that's probably when it loads the location
If you create an adapter which takes all event results into account, then its acceptable to cancel the event.
Not sure why you would want to do that.
For some work stuff I need to redirect some events, but no further processing is done on them
PlayerInitialSpawnEvent is not a Spigot event
uncle pear
What do I need to provide in lootcontext if I want to use the fillinventory method of a loot-table?
I currently try to provide everything possible I see here: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/loot/LootContext.html
chest.getLootTable().fillInventory(chest.getInventory(), random, lootContext);```
But I still get a missing parameters exception:
`java.lang.IllegalArgumentException: Missing required parameters: [<parameter minecraft:block_state>, <parameter minecraft:direct_killer_entity>, <parameter minecraft:block_entity>, <parameter minecraft:explosion_radius>]`
hello there, i have an trouble
I'am trying to start minecraft via console command (javaw)
error:
string(147) "Error: Could not find or load main class cpw.mods.modlauncher.Launcher
command:
This... is a spigot discord. You are trying to start a modded forge server.
This also looks like more of a launch command for a client, not a server.
i'am trying to start client
man
Uh perhaps omit those things if you're just setting them to null
Also no version/stack trace given
I tried just doing new LootContext.Builder(location).build(); before adding all the others
Just use one of the many launchers out there. There is absolutely no reason to start a forge client via a console command.
but it just lead to even more missing parameters in the exception
I'm making my own launcher
which is why I'm trying to run the client through the command
In this case: Make sure you load all relevant jars on the classpath to not miss any needed classes.
What version are you on?
anyome know how to fix this
just saw I'm not on the latest version so Im updating
?whereami
(was just testing something)
can i start in enable class when use config reload command?
This sentence makes no sense...
And what stops you from that?
so I updated everything to the latest version. I did realize that the server jar I'm testing on is paper (the plugin is spigot though)...
I'm trying to switch it now but I guess I'll share the trace anyway for now: https://pastebin.com/s42uzKQE
to reboot me need to run the enable method again
You dont need to disable the plugin to reload it
It can mess up a ton of stuff and lead to bugs if you disable/enable a plugin on runtime
bruh but console do this end all normal
i no need disable plugion
i need restart
enable
Do you think changing to a spigot jar would make a difference? Because I have some other plugins which would break and cause a mess. The trace from the pastebin is with LootContext lootContext = new LootContext.Builder(location).build(); instead of LootContext lootContext = new LootContext.Builder(location).lootedEntity(null).killer(null).lootingModifier(0).luck(0).build();. I want to fill chests when the chunk is loaded so thats why it starts with the chunkloadevent.
is there a server reload event?
oh thats new
I don;t belive its in 1.18
however its only useful for a reload
as you'd not be able to have an active listener for it during a startup
unless it fires after all plugins ran their onEnable.
im trying to implement custom potion effects, what do you guys reckon would be the best way to display them? boss bars are an option, but i don't want to create a boss bar for each effect. if i fit all the potion effects into one boss bar it could also work, but you can't put multiple lines of text on one boss bar and the text will just go off screen. scoreboards maybe? action bar?
yeah
though it doesnt strike me as the best option since you'll be limited to 15 items (not likely that you'll ever get that many but still) and it'll make my plugin incompatible with other scoreboard plugins
Hypixel just does it with tab
can someone help me with nms? i dont have stuff like ServerPlayer
?nms
You probably want mappings
oh frick so i need to rebuild it because i forgot one arg
damn it
smh i still dont have that
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
1.18.2
make sure your pom.xml defines the remappad artefact
i use gradle
Ah
nobody is gonna stop me
the tutorial is bad for you then
You'll need to set up your own thing to remap then
iirc there is some third party plugin for this
Or use paperweight userdev
@tender shard linked it somewhere here
or yea, userdev but that gets you paper
which you might not want, given you are in the spigot discord 
Wait did alex get something working for gradle?
I think that was it
never used it
cannot comment on it
but I think that is what he used somewhere
alright but even tho im using spigot names, the plugin will still work right?
can i keep it like i have it now
Yea I guess
but that is gonna be a terrible experience down the line
given those obfuscated names change on a per-version basis
for gods sake im gonna do it since im missing a lot of stuff
cant access org.craftbukkit.bukkit.v1_18_2 things for some reason
I mean, doesnt hurt to try the plugin
?nms
is there any way to add mavenLocal to pom
Should be automatically included
a pom by default already uses local
did you run buildtools for it?
Did you run BuildTools?
?paste your buildtools log
IJ should be able to find the files if BuildTools completed successfully.
yep its in your local repo
Did you reload your pom?
?paste your pom
/home/koblizek/.m2/repository/org/spigotmc/spigot/1.18.2-R0.1-SNAPSHOT/spigot-1.18.2-R0.1-SNAPSHOT.jar
This button right here will reload the pom.
do u think i dont know how to reload a project
bruh
A lot of people actually don't. ¯_(ツ)_/¯
oh frick
i think i know wheres the problem
i was running it from wsl
but thats weird
that shouldnt be a problem
well
it seems like it is
🤦♂️
Yeah it installed to WSL m2
can i just move the directories
Should work
is this normal
It's been a while since I created a plugin. Do the packages for net.minecraft.block and net.minecraft.entity no longer exist?
?nms
^^
Ah thanks Olivo 😄 Looking for this
For Primed TNT, if the source is a dispenser, how can i get that block?
Listen to the prime event or spawn event and store the block yourself
no method for it? oh damn
*Via pdc tag
So ur saying Dispenser placing TNT = EntitySpawnEvent ?
but there is no getWhoSpawned or similar on the EntitySpawnEvent
So how can i, when the TNT is spawned, get the dispenser that spawned it?
Can't find anything on google...
Im also thinking about how to track that. It must be possible but i cant think of a robust approach...
Maybe its just not possible with spigot? cuz spigot is missing an event for it?
There are plenty events being fired. Just need to connect the dots and get the source of the TNT spawn...
Is there an event executed when a tnt becomes and entity?
it doesnt "become an entity", it always is an entity
Yes, TNTPrimeEvent. But there is no Block being placed beforehand.
the dispenser doesnt place it as a block
else i could use BlockDispenseEvent , that would be too easy
xD
is there a "dispenser getting activated" event with before and after state?
maybe i could use that, save it into a map, and then scan for tnt next to the dispenser
That would be the workaround. But there must be a non-hacky way for this
Can't think of one :/
But BlockDispenseEvent fires everytime an item is dispensed from the Dispenser. You sure it doesnt work with tnt?
What do you mean by "above the inventory slots"
You mean the hotbar?
that's the actionbar
It works, but there is no way to get the spawned entity
true, its for the dispenser throwing items, not placing blocks, my bad.
but tnt isnt an item :(
ItemStack getItem()
returns an itemstack not an entity ..
For what?
actionbar is below, he means above
i dont think text above the inventory without a bossbar is possible
You cant really add text above the action bar without using highly modified resourcepacks
yeah, sounds like something done from within a resource pack
I think the api is lacking in this regard.
Means you need to listen to the BlockDispenseEvent on MONITOR priority, check if the dispensed
ItemStack is of type TNT, flick a boolean to true, listen for the EntitySpawnEvent, flick the boolean back to false
and modify the spawned TNTPrimed.
Ahhh it actually gets triggered when placing tnt and returns the tnt as an itemstack??
Well yeah, the BlockDispenseEvent always gets triggered when anything is dispensed.
ah coool, alright, ill try that
Dont want to ask why a boolean is enough and a collection/map is not needed?
i was trying to find out via google, probably has to do with the MONITOR?. but yeah sure, explain pls :D
The events are all fired consecutively on the main thread, this means that the next EntitySpawnEvent after the BlockDispenseEvent will always
be the spawn event caused by the dispenser. There is no way that something else gets spawned 'in between' those two events.
ahh i see, that makes sense
So when i have two dispensers placing a TNT its
BlockDispenseEvent -> EntitySpawnEvent -> BlockDispenseEvent -> EntitySpawnEvent
Right
Instead of a boolean i'd use a variable that stores the dispenser location and then set that to null again, right?
cuz i wanna add the dispenser position to the TNTPrimed
If you need the dispenser in your context then yes. But manually setting a variable to null emits code smell to me.
There is probably a cleaner solution...
well i guess i can just not set it to null
it will be overwritten anyway
ah wait nah my bad, gotta tell how the entity was spawned
Then you have the problem that every TNT which is spawned normally will have the dispenser as its context.
Me neither... Maybe a wrapper class which keeps a non-hard reference and a boolean.
Any way to add additional tab completion to mojang commands? I want to make /gamemode 0 work
declaration: package: org.bukkit.event.server, class: TabCompleteEvent
Damn, I'm sorry you feel compelled to want to do that
how can i get the command name and args and all of that?
does the command already take /gamemode 0 with no tab complete
No
public class SingleUseUnit<T> {
private T value = null;
private boolean valid = false;
public void renew(T value) {
this.value = value;
this.valid = true;
}
public T get() {
Preconditions.checkState(valid, "Tried to gain access to invalid value.");
this.valid = false;
return this.value;
}
public boolean isValid() {
return this.valid;
}
}
public class TNTListener implements Listener {
private final SingleUseUnit<Location> lastDispenseUnit = new SingleUseUnit<>();
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onDispense(BlockDispenseEvent event) {
if (event.getItem().getType() != Material.TNT) {
return;
}
lastDispenseUnit.renew(event.getBlock().getLocation());
}
@EventHandler
public void onSpawn(EntitySpawnEvent event) {
if (!lastDispenseUnit.isValid()) {
return;
}
Block dispenserBlock = lastDispenseUnit.get().getBlock();
TNTPrimed tnt = (TNTPrimed) event.getEntity();
// Do your stuff
}
}
Woops, spam
This also has a bit of code smell because the renew and get methods have side effects...

I just dont like the idea of having to set a variable to null...
yeah well
null is bug prone for sure
at least it saves on memory
i guess this was the reason null even was introduced to begin with
it does but the gamemode-argument(0) is still shown red
rn im just replacing the first argument in the gamemode command from 0 to adventure, from 1 to creative and so on
When im trying to set a skull from minecraft-heads.com it isnt working what do i need to use?
SkullMeta and PlayerProfile
Sorry i dont understand what you mean
What do i need in here? the value or minecraft url or something else?
https://minecraft-heads.com/custom-heads/decoration/53735-ender-pearl-cyan
You can either use the base64 value or the URL.
Btw the value is simply encodes some nbt into a base64 String.
Example:
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTRkNDhhYzdlNjViOTE0Njc5MDRmMmY0ZDE1NDU1Njc3NmZmYTljZDJkNTI2YjEyYTA0OTliYjU5Y2M2NTZjNyJ9fX0=
Decodes to
{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/54d48ac7e65b91467904f2f4d154556776ffa9cd2d526b12a0499bb59cc656c7"}}}
Spigot 1.18.1 added the new PlayerProfiles class, which finally allows us to use custom heads without needing any reflection! You can obtain them as normal items, or actually place them down into the world. I’ll show you how both works: Creating a new PlayerProfile First, we gotta create a new PlayerProfile object. To do so,...
Thanks
Can someone please help me with getting the center of a block?
When im trying to get the center of a end portal frame and place a head there it isnt in the middle it is placed where the center would be at a "normal block"
public void changeSkullTexture(Block block, URL textureUrl) {
Preconditions.checkState(block.getType() == Material.PLAYER_HEAD);
Skull skull = (Skull) block.getState();
PlayerProfile profile = Bukkit.createPlayerProfile("_DUMMY_");
PlayerTextures textures = profile.getTextures();
textures.setSkin(textureUrl);
skull.setOwnerProfile(profile);
skull.update(true);
}
The URL can be created by using
new URL("http://textures.minecraft.net/texture/54d48ac7e65b91467904f2f4d154556776ffa9cd2d526b12a0499bb59cc656c7");
for example
You cant just change the position of where a block is placed... They will always be placed at the same location.
I don't really understand this. How can a block NOT be placed at the center?
IT is for 1.8 so i can replace PLAYER_HEAD with skull_item right?
I want to place a head on top of a end portal frame and a end portal frame block is a bit smaller than a regular one
You cant use any of that for 1.8
If I'm gonna be honest 1.8 is absolutely shit for dev
?1.8
Too old! (Click the link to get the exact time)
You probably need to use reflections and/or nms for that in 1.8
hi is this server to help making a server and optimize the server for better performance
It's ancient, doesn't support half the modern api, uses outdated code
You can't do that with a real block. Some kind of an entity would to the task for you.
Anyways here is a good guide
thank you
Invisible armor stand with it's helmet set to the head, and do some number tweaking to figure out how low you gotta spawn it for it to be level
Might be able to use display entities in 1.20 but idk I haven't used them yet
so I can ask any question here and people can help me because I'm new to this
This channel is usually just for development related questions
If you're asking server related questions you do them in #help-server
if you're asking development related questions you use #help-development
okay👍
development means to make customize plugins?
Aye
oh ok👍
*Writing plugins, forking spigot, writing any tools. Anything dev related really.
Sometimes also just discussing general java
Is it possible that you could help me with that, i cant find anything on spigot and i havent done that before
@Override
public void setTexture(SkullMeta meta, String texture) {
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
PropertyMap propertyMap = gameProfile.getProperties();
propertyMap.put("textures", new Property("textures", texture));
try {
Field profileField = meta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(meta, gameProfile);
profileField.setAccessible(false);
} catch (NoSuchFieldException | IllegalAccessException ex) {
ex.printStackTrace();
}
}
🥄
shut up choco
1.8 is soon a decade old. Sticking with ancient software simply comes with those drawbacks.
I cant quite remember the details but you need to use nms to create a GameProfile, then modify the profile properties (needs raw byte encoded base64),
after that you need to use reflections to change some field in the meta
This truly catches the diarrhea stained experience of writing 1.8 code
Crazy that there are people who were born after 1.8 was released who play Minecraft
tbf like toddlers play minecraft
Pretty sure that the average 1.8 player is younger than the game version itself 
3 years ago was 1.15
isnt it already?
?1.1.8
?1.8.8
?1.8
Too old! (Click the link to get the exact time)
Im still waiting for someone to actually write a decent new combat system.
It would also make hacking way more difficult if you just introduced completely new mechanics.
Nah it's only 8 years 1 month
like plugin or by default into minecraft?
only
Thats what i picture the average 1.8 player as.
8 years old, ADD driven, just wanna click and run fast.
A mod would be much better for making a new combat system
Since you can modify the client as well
Is LootContext not intended to be used for loot that is generated for chests? If so what should be used to pregenerate loottable loot in a chest (I need it generated before the player opens it because the loot determines the chest type)
I only found a couple of forum posts which use fillinventory to fill a chest inventory but they all failed and I cant find much related to pregenerating loot chests at all :(
This is what I currently have:
chest.getLootTable().fillInventory(chest.getInventory(), random, lootContext);```
I am on the latest 1.20.1 version and this is the error I get:
```java.lang.IllegalArgumentException: Missing required parameters: [<parameter minecraft:block_entity>, <parameter minecraft:killer_entity>, <parameter minecraft:damage_source>, <parameter minecraft:explosion_radius>, <parameter minecraft:direct_killer_entity>, <parameter minecraft:tool>, <parameter minecraft:last_damage_player>, <parameter minecraft:this_entity>, <parameter minecraft:block_state>]
at net.minecraft.world.level.storage.loot.LootParams$Builder.create(LootParams.java:132) ~[?:?]```
Which of those two lines throws the exception?
the second one
Im guessing that the LootTable of the chest requires a primary entity which triggered the loot.
hello how to execute
Have you tried filling the chest in the moment a player opens it? (Adding that player to the LootContext)
Guillotine
That's a Paper bug I believe
I tried adding a player wherever I can but it doesnt change much
Throw a player in a pit full of zombies, dont give him any weapons
whatever
qq, can a itemStack that is specifically not air return null for getItemMeta?
Nope
ok
Maybe if you define a proper question, i can give you a proper answer
I'll have to find a workaround then. Best solution I could think of is using the /loot command to get the items and then place them inside. Anyone have a better idea by chance?
dude i need to make when a player join first time console execute a command
PlayerJoinEvent -> Bukkit#dispatchCommand(CommandSender, String)
As CommandSender simply pass Bukkit#getConsoleSender().
PS: Dispatching a command via code is often a workaround and should be avoided if possible.
my entire codebase is workarounds for spigot nonsense
don't get snappy when you ask a non-question and get a joke answer
hello how to execute
is not a valid question for this channel
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
fun fact
a hard location reference can cause memory leaks when the world gets unloaded
hi so i tried this now and this is the result. it.. kinda works? it stops half way tho (loc is the end of the cable thingy btw, where the block intersects with the cable)
https://hastebin.com/share/iqufoqeqix.java
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Decrease the gravitational strength in the calculation
the Vector gravityForce = new Vector(0, -1, 0); ?
tensionForce.multiply(-gravityForce.length());
->
tensionForce.multiply(-gravityForce.length() * 0.1);
Or simply define
Vector gravityForce = new Vector(0, -0.1, 0);
are you sure it's not because you're flying
Looks really satisfying
😭 yes
that didnt really fix it
this is kinda what i want
Show result
https://cdn.discordapp.com/attachments/825786427648376883/1152643606096646234/Minecraft__1.19_-_Multiplayer_3rd-party_Server_2023-09-16_18-33-20.mp4
does this look good to you guys or is there anything i should improve on it
i think its cute
maybe you should make artificial spell mob particles around you
with custom colors
Remove the red numbers on the scoreboard
you can do that..?
particle effects are neat yeah ill do that
Core shader
Align them in a circle and let them fly away from the player 🙂
This will look great
will core shaders not also remove those red numbers on scoreboards that aren't mine
Is there a way you can make an npc walk to a certain location using all packets? This is the code I have right now. I also have the issue that I can't get him to face a different way.
https://paste.md-5.net/uweparekey.java
cant you just tell it to walk there?
Yes but it is for sure not easy
Good check
lmao
uhh it's fun
How would one do it?
you need a pathfinding algorithm
and then a lot of interpolation for it to look smooth
Oh true, but suppose I make sure all the paths are clear. Like I could just implement some points that he could walk to that are hardcoded
would that make things easier?
The pathfinding isnt the hard part
What is the hard part? Is there like a certain packet that I need to send to make it take a step or to teleport it and then send a different packet to animate?
Revert the gravity to 0, -1, 0 and simply add less on it to the total:
Vector total = tensionForce.clone().add(gravityForce);
->
Vector total = tensionForce.clone().add(gravityForce.multiply(0.1));
Hmm, is there a plugin that has that already implemented so I could decompile it and take a look or would that be hard to do?
or replicate so to say
Uhh
Citizens has the best pathfinder imo
PlayerNPC is client-sided however
ZNpcs is client-sided too iirc
No clue if it has a pathfinder or not
Last time i looked at their code i uninstalled it from my server.
Might be better now...
lol
It was so shit we switched our codebase to minestom
it got the job done I guess xD
damn
isnt there a citizens2 now? or is that the same one
same one
It's still shit
and if you have any suggestions they'll just tell you to PR
If you throw a tantrum about how the code is shit they just tell you they have a limited budget
even though they made like 80 grand in donations
Ok then I guess teleportation would just be a lot easier. Do you have some insight on the head rotation and then how I could make it move since I've tried some things and none seem to work
uhh
head rotation is part of the movement packet
you have body rotation and head rotation
is that this?
public void lookGregory(int npcId, @NotNull Player player, int yaw, int pitch, boolean onGround) {
ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
ps.send(new ClientboundMoveEntityPacket.PosRot(npcId, (short) 0, (short) 0, (short) 0, (byte) yaw, (byte) pitch, onGround));
}
public void moveGregory(int npcId, @NotNull Player player, int deltaX, int deltaY, int deltaZ, boolean onGround) {
ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
ps.send(new ClientboundMoveEntityPacket.PosRot(npcId, (short) deltaX, (short) deltaY, (short) deltaZ, (byte) 0, (byte) 0, onGround));
}
lookGregory
probably
😭
I'll implement a global one soon I was just testing 😂
Yes for sure
tbh I'm pretty sure I did start work on a whole PacketEntities project
Yea that is what I'll do
how many stuff do you make tothe point that u forget what u make 😭
I've got nearly 500 projects
Did you try adding less gravity to the final vec?
~30gb IdeaProjects folder
yes that just pulls me directly to the loc
video incoming
over the span of the last 7 years
.
The thing you sent me talks about server side packets, would that work in my case, I'm assuning not
god damn
why does an abstract class need to instantiate final fields?
fuck i can only send 25mb
There's no guarantee that the child classes will instantiate them instead
something like that
@lost matrix
easy way is to just make an abstract method to create the field
what does the final keyword actually do
and call it on the constructor
you running a scheduled task or just a single method call?
it runs every tick
lower its duration maybe
i cant do that
its a move for a api and that's like auto methods made when i extend the class
p sure the approach I'd take would be making a bezier curve between an intermediate point between the target block
but whatever
7smile7 knows maths more than I do
there are easy workarounds for it though
like making a function to initialize it instead and just making that function abstract
Try setting the type to empty
then its not gettting initialized and still complains cuz abstract functions aint got method bodies
?nms
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
oh does anyone have any up to date core shaders that hide the lil red icons from scoreboards?
the ones online either dont work or dont work fully
Hi, anyone can create for me a .jar for a project of github?
?work
I don't have idea how to make the .jar
Pay for the plugin
Not is pay,
Is a fork for one plugin to work in geysermc (bedrock users)
How to get open book event?
public void lookGregory(int npcId, @NotNull Player player, int yaw, @NotNull ServerPlayer npc) {
ServerGamePacketListenerImpl ps = ((CraftPlayer) player).getHandle().connection;
ps.send(new ClientboundRotateHeadPacket(npc, (byte) yaw));
}
Are there any problems with this code? The code is being ran but it doesnt work on the npc
you need to do the * 256 / 360
thing
Ok but it doesnt even rotate anything when I give it a random value
Alright, I'll try that
Guys, hello. Maybe who knows, how place items like this? menu.setItem(0, item_6); menu.setItem(1, item_6); menu.setItem(2, item_6); menu.setItem(3, item_6); menu.setItem(4, item_6); menu.setItem(5, item_6); menu.setItem(6, item_6); menu.setItem(7, item_6); menu.setItem(8, item_6); menu.setItem(9, item_6); menu.setItem(10, item_6); menu.setItem(11, item_6); menu.setItem(12, item_2); menu.setItem(13, item_3); menu.setItem(14, item_4); menu.setItem(15, item_5); menu.setItem(16, item_6); menu.setItem(17, item_6); menu.setItem(18, item_6); menu.setItem(19, item_6); menu.setItem(20, item_6); menu.setItem(21, item_6); menu.setItem(22, item_6); menu.setItem(23, item_6); menu.setItem(24, item_6); menu.setItem(25, item_6); menu.setItem(26, item_6); menu.setItem(27, item_6);
I need make inventory menu fill with glass panels
Do you know what a for loop is?
No
forEach...
learnjava moment
A regular for loop would be good for this, I'd suggest you look into that
I can send all code
masking is the approach I take for menus
Could you elaborate?
Inventory menu = Bukkit.createInventory(null, 27, "Меню сервера");
ItemStack item = new ItemStack(Material.ARMOR_STAND);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName("§f§lПрофиль");
item.setItemMeta(meta);
ItemStack item_2 = new ItemStack(Material.ITEM_FRAME);
ItemMeta meta_2 = item_2.getItemMeta();
meta_2.setDisplayName("§f§lВарпы");
item_2.setItemMeta(meta_2);
ItemStack item_3 = new ItemStack(Material.BIRCH_SIGN);
ItemMeta meta_3 = item_3.getItemMeta();
meta_3.setDisplayName("§f§lАукцион");
item_3.setItemMeta(meta_3);
ItemStack item_4 = new ItemStack(Material.PINK_SHULKER_BOX);
ItemMeta meta_4 = item_4.getItemMeta();
meta_4.setDisplayName("§f§lКейсы");
item_4.setItemMeta(meta_4);
ItemStack item_5 = new ItemStack(Material.BOOK);
ItemMeta meta_5 = item_5.getItemMeta();
meta_5.setDisplayName("§f§lДонат и помощь");
item_5.setItemMeta(meta_5);
ItemStack item_6 = new ItemStack(Material.PINK_STAINED_GLASS_PANE);
ItemMeta meta_6 = item_6.getItemMeta();
item_6.setItemMeta(meta_6);
menu.setItem(0, item_6);
...
menu.setItem(12, item_2);
menu.setItem(13, item_3);
menu.setItem(14, item_4);
menu.setItem(15, item_5);
menu.setItem(16, item_6);
...
player.openInventory(menu);
}```

it is time to
?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. https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
oh shit i thought that i don't know java...
my menu engine lets me work with selections directly
I know, it's bad code, i'm noob
I can also load menus from the config
someone did this to me earlier
:)
Yea even with this added, nothing happens. I think it's the wrong packet even though it says I should use this one
oh yeah, thanks
Who can remake this code..?(
?spoon
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
we're not your personal developers
ok..(
Learn java before you start with bukkit.
Rate my rewrited code: ``` ItemStack glassPane = new ItemStack(Material.GLASS_PANE);
ItemMeta glassMeta = glassPane.getItemMeta();
glassMeta.setDisplayName(" ");
glassPane.setItemMeta(glassMeta);
for (int i = 0; i < menu.getSize(); i++) {
if (menu.getItem(i) == null) {
menu.setItem(i, glassPane);
}
}```
If you take this approach to inventories then there is not much that needs change in this code.
Maybe try to use better names for your variables and create a few more methods to make it a bit
less repetetive.
Better
pink glass panels == cute furry server menu
Wait, are you russian?
would it better be having
- items hashset and then loop thru them in one bukkitrunnable repeatable task to update what it needs
- would it be the same if each instance of custom Item has its runnable and check if item need to be update
Second option would avoid checking if item is updatable and will not need to be looping thru all items in hashset
I need to update place holder at that item instance once a second
Personally I'd use 1
Keeping references to ItemStacks can be very miserable.
well I got customItem class
which hold all data about items lore display name and so on
and each secon then new item would be created and set in specific slot if custom inventory is still opened
If we generalize this problem, then having one runnable with many tickable objects is always preferable to having one runnable for each object
ok thanks looks like will go with that solution
and making one Hashset contaning updatable items
Why a hashset?
wold you propose ArrayList ?
wdym
Depending on how you implement the eviction i would maybe propose a LinkedList
what is benefit of LinkedList ?
cant you initialize it by doing this.thing = determineThingValue()?
O(1) removal of elements while iterating
oh yeah I see
public class SomeRunnable implements Runnable {
private final LinkedList<Something> elements = new LinkedList<>();
public void add(Something element) {
this.elements.add(element);
}
@Override
public void run() {
this.elements.removeIf(this::tickAndCheck);
}
private boolean tickAndCheck(Something element) {
element.tick();
return element.isDone();
}
}
Something like this
i'm ukrainian
Oh okay
slava to you then
I think a HashSet is fine too. The iterator of a HashSet is just slightly slower iirc.
you could order them on completion and use a linkedlist as a deque
so you can have O(1) tick time
What do you mean by "order them on completion" ?
void onComplete()
order()
Where are those methods from?
Are we talking about the same LinkedList?
you missed the part where you laugh at my humorous joke
Im tiered and confused
added some core shaders to my resource pack and it broke all custom unicode characters
removed the shaders and they remain broken
no errors in logs
i hate this
i guess thats what they usually call a skill issue
don't make them final? final fields have to be initialized in the constructor
final fields need to be either initialized by the class or a constructor
interfaces cant have any fields at all
^
*abstract class
then it has to be initialized in the constructor for that abstract class
they're basically the same at this point
Or you do this:
protected abstract int getFirstCooldown();
protected abstract int getSecondCooldown();
Otherwise you need a constructor
oh thats smart
ill probs just keep them not-final and init them if appropriate
unfortunately u cant extend two classes which would solve this dilemma
weee automatically public static final
(and no, having an intermediary abstract class wouldn't work since i am already doing that for a much larger feature)
You can make it an interface. Those can be used for multi extensions.
urgh i do NOT want to refactor my code for that
fuck you too minecraft
but
i can make an interface for the timers
requires some instanceof but not much luckily
actually that wouldnt be instanceof would it?
can instanceof check if a class is implementing an interface?
No idea what you are doing but there is probably a clean abstraction model you could come up with that doesnt involve instanceof checking
well
is there a way to place sugar cane without water ?
place block without physics update, theres a parameter for that somewhere
guys, who know how to make random? (let's say, drop1 = 50%, drop2 = 25%, drop3 = 25%)
math.random gives a double between inclusive 0 and 1
I'm using a specific abstract class as a 'parent class'
I cannot do this.cooldown cuz that abstract class wouldnt implement the interface
hence i need to know if the current instance of said abstract class is implementing the timer interface
i mean i could put a boolean in the parent class that is like 'you are implementing timer' but that still wouldnt give me access to the fields / methods of the interface
(the real joke here is that all but like 1 in 17 classes probably require said timer, and I'd rather not put it into the abstract class)
Can someone explain to me, why is my for loop not working? Like I have several checks, before and after the loop. It writes in the console, that it looped, but than it should type every player online to the console, but it does nothing. And yes, there are players online to loop through. Here is my method. https://pastebin.com/JYkHL0Dn
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
This is not so easy. This is usually solved by using weights instead of chances.
The general idea looks like this:
Given 3 choices (A, B and C) assign a weight to each choice:
A - 200
B - 300
C - 400
Every weight uses the prior weight as bottom. It uses the previous floor + its own weight as its own floor.
A: (0 - 200)
B: (201 - 500)
C: (501 - 900)
Now create a sum of all weights (max_sum):
200 + 300 + 400 = 900
Generate a number between 0 and max_sum to select a random item
from this weighted table.
Eg. random = 332 -> results in choice B as its within (201 - 500)
The actual chance of an element is calculated as (chance = weight / max_sum)
So the chance for
A: 200 / 900 = 0.222 = 22.2%
B: 300 / 900 = 0.333 = 33.3%
C: 200 / 900 = 0.444 = 44.4%
If you want to create an easy to follow chance system, then your weights should sum up to something like 1000 or 10000:
Best performance [ O(log n) ] can be achieved by using a NavigableMap.
I prefer to use either a TreeMap from Java or a RangeMap from google guava
how could I get the name of the block?
Help pls
result "Invalid Book tag"
book in hand: "ABC"
code:
@EventHandler
public void playerInteractEvent(PlayerInteractEvent event){
Action action = event.getAction();
if(action.equals(Action.RIGHT_CLICK_BLOCK) || action.equals(Action.RIGHT_CLICK_AIR)){
ItemStack playerHandItem = event.getItem();
Player player = event.getPlayer();
if(playerHandItem != null && playerHandItem.getType().equals(Material.WRITABLE_BOOK) && player.isSneaking()){
BookMeta bookMeta = (BookMeta) event.getItem().getItemMeta();
if(bookMeta != null && bookMeta.hasPages()){
ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK);
BookMeta newBookmeta = (BookMeta) newBook.getItemMeta();
bookMeta.getPages().forEach(page -> newBookmeta.addPage(page));
newBook.setItemMeta(newBookmeta);
event.setCancelled(true);
player.openBook(newBook);
}
}
}
}
my pendulum still isnt working.. 😦
- Never catch NullPointerExceptions. Always make sure your code is null safe.
- This code is a mess. Just print out some log messages to see if any conditions arent met (if-clauses)
Blocks dont have names
if this block is container with inventory you can do Nameable block = (Nameable) block.getInventoryHolder()
or something like this
and block.getCustomName()
get the material get the data get the name
What version?
1.19.4
Crimson - npc plugin?
You can rename them?
Can you explain how?
Try to copy the pages in bulk and not with a for loop.
Also set a title to the book
@EventHandler
public void playerInteractEvent(PlayerInteractEvent event){
Action action = event.getAction();
if(action.equals(Action.RIGHT_CLICK_BLOCK) || action.equals(Action.RIGHT_CLICK_AIR)){
ItemStack playerHandItem = event.getItem();
Player player = event.getPlayer();
if(playerHandItem != null && playerHandItem.getType().equals(Material.WRITABLE_BOOK) && player.isSneaking()){
BookMeta bookMeta = (BookMeta) event.getItem().getItemMeta();
if(bookMeta != null && bookMeta.hasPages()){
ItemStack newBook = new ItemStack(Material.WRITTEN_BOOK);
BookMeta newBookmeta = (BookMeta) newBook.getItemMeta();
newBookmeta.addPage("AAAA", "B", "CCC");
newBook.setItemMeta(newBookmeta);
event.setCancelled(true);
player.openBook(newBook);
}
}
}
}
event this don't work
World#setBlock(block, false) or smth
but maybe i should really add title
check api
And do a bulk copy of the pages. Get all pages at once and set all pages at once
yeah ok, thanks
Any reason why you dont want to use clone() ?
ItemStack bookA = ...;
ItemStack bookB = bookA.clone();
i know it, but i tried different methods to solve problem
oh i didn't know about this function but i need to replace some strings from pages
You can still clone the book and replace stuff in there afterwards
Znpc plugin contains api for use?
oh ok, but there are another problem that i have already solved, you need not only add a title to the book but also the author if you want book to work
to clone book you need written book but i'm trying to interact with writeable book ,_,
oh
not to clone
to open book
Alr, I know the code is mess, but it's older code I wrote earlier. I tried some debug, and figured out, that for some reason, when use Bukkit.getPlayer(String) in PlayerRespawnEvent, it just returns null. But if I use it in command, it works fine. Do you have any idea, why is it like that? I event made new listnere class and new code, but it still don't work.
How to close book if book was oppened? If i'm trying to do playerInteractEvent.setCancelled(true);
book isn't closing
Does Bukkit#getWorlds() return a specifically ordered list? Specifically, if run on a server without extra worlds / less worlds than normal, is the order of the returned worlds always normal, nether, end?
yes I'm pretty sure
getWorlds.get(0) usually returns the "spawn" world where new players are tossed
(not part of the specs tho so this behaviour can change)
hm
ill iterate em and check their time then
is it better to do world.getfulltime twice per world, or to cache it in a local variable
/**
* Returns the time in the world with the highest time
*/
public static long serverTime(){
long time = 0;
for(World world : Bukkit.getWorlds())
if(world.getFullTime() > time)
time = world.getFullTime();
return time;
}
cache on a local variable, always
I'd probably implement my own Comparator class
And just sort
actually
would saving em to a list and sorting the list work
or would that be slower
that seems slower
before or in the loop btw
huh i just learned a for loop apparently isn't a separate 'namespace' or whatever you call it in java
Is it possible to add models to NPCs in Citizens?
technically yes
but in practice no
I have a plugin for it tho
because citizens is a bitch and likes to constantly respawn entities
you need to like
make an armorstand that constantly tracks the npc
when that armorstand gets hit, call the npc click event
damage it
whatever
WHen the npc dies, armorstand dies too
and then you just model that armorstand with modelengine
