#help-development
1 messages ยท Page 1480 of 1
Not timew
no?
ScheduledExecutorService#schedule
I see. Thank you
System.currentTimeMillis() or as roller said, an Executor service as that runs on the system clock
Yh a scheduled executor uses its own thread so is separate from the main thread of the server and yh ^^
based off ur system clock
just make sure ur not making tons of different scheduledexecutors because you only need one and each one you make will create a thread. So just use one instance to schedule all your stuff.
ok
so if I want something to be ticker based I would want
scheduleSyncRepeatingTask
correct?
Why does it have to be sync
idk specific spigot methods as i havent used spigot in like 4 months ngl lol
lemme check docs
Yh.
async schedule methods are deprecated
Ah gotchu
Wait so what is the different between using that and ScheduledExecutorService#schedule
A ScheduledExecutorService is based of real time and runs on its own thread
The bukkit scheduler uses ticks
Found out that setChestLocation is not the issue because it can't even be called? Something must be wrong with the BlockBreak event class (arenaManager.setChestLocation(event.getPlayer(), event.getBlock().getLocation());)
If you schedule using the bukkit scheduler and have 10 TPS it'll run later than with 20 TPS. That doesn't mean the bukkit scheduler is obsolete though. You should still be using it unless you need something to be based off real-world time
You'd use a scheduled executor service for things like daily quest resets, island top recalculations, etc.. things that people will be annoyed if they change time over a longer period
Gotchu
so what do I use if I want something to run based on ticks
Bukkit.getScheduler().scheduleSyncDelayedTask(Plugin plugin, Runnable runnable, long tickDelay)
or a different method if you want it to be repeating
Couldnโt you use runTaskTimer as well
oh yh for that you do
^^
its pretty sure your arenaManager var
which is just null
Don;t destroy player entities
is there an event for a player getting put out of their fire?
EntityExtinguishEvent I think.
nope :/
Does someone know how I can clear default's pathgoals of a mob using NMS?
that doesnt exist lol
how do I reduce a player's invincibility time
like whenever they get hit
since EntityDamageEvent is before they get hit
Oh thats surprising
how do I like change their damage tick instead
i dont get ;-;
wat
wat r u trynna do?
dont think you can do that
not sure
hm
there is no built in api
at least for this
nodamagetick... sry i feel liek i should kno wat taht is but i dont :I
it they turn red
then you can hit them again
o.o
he wants to shorten that
oh
in that time they can't take damage again
ok i see xD
Hey there, what would be the best way to detect if a block get's updated by redstone? E.g a trapdoor or door opening/closing. I looked at BlockRedstoneEvent, but that's not quite it it seems
sounds like u might need a server patch for taht :I
no I dont think so
a lot of plugins already do this
all the duels plugin with combo
they remove player's damage ticks
how do I find a biome in 1.8.9?
or how do I make a biome?
ik that much but on what event
wat
Biome as in, similar to what /locatebiome does?
I know, but I asked if you're looking for similar behaviour
I happened to have worked that out recently
nice
albeit for 1.16, but it should give you a good sense of what direction to look in
im assuming its an entity method since it says entity.
I give up
idk if it's a one time thing doe :I
Imma figure it out myself
@white maple Here, this should help https://github.com/TheDutchMC/WorldFinder/blob/master/src/main/java/nl/thedutchmc/worldfinder/world/WorldAnalyser.java
@jade perch oi u posted it xD cn u halp us we r noob
is there any method we can check if players inventory is full or not. I found getSize() Method but i think its a constant as per entity
whut
thnx
you do realize bukkit dev threads and spigot threads answer this question 100x over
omg hai ๐ so yea this post:
https://www.spigotmc.org/threads/setnodamageticks.416224/
u say entity.setNoDamageTicks(0); but guy dosent kno wher 2 put that
I use a little tool ReflectionLib to help me here, this is now also available jitpack (Working on mavencentral too) https://jitpack.io/#TheDutchMC/BukkitReflectionUtil
on the entity -.-
hmmmm
@keen kelp try putting it on th entity damage event .-.
if it dont work then put it inside a Runnable taht runs on th next tick
(is wat id try)
ah :I rite ok yea next tick then
Anyone know how I can force open a written book 1.8?
update to 1.16 and use the Player#openBook method
maybe not a question here, but did the assets folder change when 1.16 released?
in what way?
Don't want to really
well, 1.8 is unsupported here
Oh ok, my bad
genuine question, what is the point of staying on 1.8?
pvp
surely you can just get a plugin that gives 1.8 pvp on 1.9+
I could but why would I?
because then everything else becomes a lot easier
does anyone have a nice plugin coding idea or ideas? Not too hard?
yes
nvm just decompiled smth wrong
code a vault implementation plugin skullcrafthd
hologram plugin
ye I think so
Hello everyone. I want to confirm something about Skins on BungeeCord. I have a offline server and I'm trying to change player's skins. Investigating about it (it doesn't change my skin) I found that Bungeecord doesn't allow to change player skin. Is it correct?
You would need to use SkinRestorer
Since it's in offline mode, the skins are not loaded
oh yes okay true
The plugin basically apply the texture getting it by name on the mojang api and then modifying your server profile to update the skin
how do i know with try catch error i need to use for what?
You should check the documentation of the methods you're using
depends what you have in your try
And the IDE will also give you an int
doing catch(Exception e) will work for any error
But don't do that ^^'
but generally its good practice to be as specific as you can
okay and why?
you might have an error which is different than the one you're expecting to catch
Because it could cause bugs and remove the whole purpose of exceptions
and then you miss out on it
if you do have a catch(Exception e) I recommend doing e.printStackTrace
this is mostly for IO and such
if you expect catch to happen more often, either be more specific with the exception or try to avoid it in the first place
ideally the latter
If for example, you return a certain value from a certain exception and you catch all exceptions, if you run a method inside your other method, that could catch a runtime exception on the method you've called inside and totally bug your initial method
so in the docs where do i have to look for the Exception?
Normally
what are you putting inside the try?
It always says "throws xxxException" in the doc
If you have a function which throws an error, intellij will tell you what it is when you hover over it
It will work for any exception
oh okay thx
Not true, it will not tell you about the runtime exceptions
if the method javadocs dont show up then click on the function call and press ctrl+q
it will only tell you what the function signature says
But hopefully all unchecked exceptions are documented
Hopefully ^^'
The problem is that unchecked exceptions are not in the signatures ^^
yea in that case you shouldn't be using a try/catch, instead check if the input is valid before sending it to the function
I mean sometimes you have to try catch an unchecked exception
Not necessarily, an unchecked exception, is not always about the input
An unchecked exception, is an exception that should never happen but that you place here to be sure that doesn't get ignored if that happen
Is it neccesary? I don't want to use others plugins.
For what you want to do yes
What do you mean exactly?
this was old lol
I just want to set a Skin. Before I got Bungeecord, I was doing it, and it works perfect. But know it doesn't work. Is there another way?
wdym by "set a skin" to a player ?
Change its skin
By mojang website ?
Yeap
Your server needs to be in online mode
to allow the server to get the skin stored on the mojang server by the uuid
When you're in offline mode, the uuid changes
And so the skin doesn't exists in the mojang's database
Which returns an Alex/Steve skin
I have done by my way and I got all texture about player. The problem is, when I try to put to player, doesn't change. Before I got bungeecord, it works. So, my question is, is about bungeecord that it doesn't work?
What have you done by your way ? Be more precise pls ^^'
I make a method that get "texture" and "signature".
Ok, so you got a custom plugin to change your skins
Exactly
Then, you should update the player profile once you did get the new skin signature and texture
Is the player "health scale" purely a Bukkit construct? I can't seem to find anything in nms and all i see is in CraftPlayer, changing the MAX_HEALTH attribute and sending packets
I would suggest looking at the SkinRestorer code on their github
Thanks for that
simple question but for some reason i cant find online
how do i remove the item in the players hand
Set it to air
yw
Does someone know how I can clear default's pathgoals of a mob using NMS?
is someInventory.getContents().length always gonna equal someInventory.getSize()?
any ideas how to edit generation loot tables instead of manually editing loot tables
or if its connected to an event maybe?
lootgenerateevent?
Player inventory contents also includes the armor slots
Not sure, you can always experiment
and they're not included in the getSize?
Not sure
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
Hey guys, what is the best way you think to auto update a config file when there is a new plugin version with new config lines ?
make them regenerate it if you're using default config api
yes but if it regenerate it it will clean all settings ?
so I have to save the settings before
right ?
set the config's (file) defaults (internal), then copy defaults (so all values set in internal but not in file are copied to the file), then save the config (file)
Hum. Thanks but I'm not sure If I understand everything haha
all config file methods are pretty tricky xD
Ok I think I understand
I copy my file to default, I recreate my file and I copy default to my file
right ?
p.getItemInHand().setType(Material.AIR);
dur--;
p.getInventory().addItem(Main.getItem(dur));
p.updateInventory();
This is giving me the item I want, but not setting the main hand to air
how do i fix this?
it is just putting it in the first available spot
null also does nothing
thats not true
null is the same as deleting something
whats going on currently is as if nothing is happening at all
p.getItemInHand().setType(Material.AIR);
this does nothing tho
yes
So I am spawning an fallingBlock and throwing it. most of the times it lands normal but sometimes it breaks. Can I somehow place a Block there where it breaks, so it looks like it didnt?
because calling getItemInHand gives you a new ItemStack which isn't coupled to the one the player actually has in their inventory
you should do p.getInventory().setItemInMainHand()
what happens is that i still have the item in my hand and I get a new item in my inventory
ill try that
p.getInventory().setItemInMainHand(null);
p.getInventory().addItem(item you want to add);
and then update it
npnp
I expose my problem once again haha : D
So, I'm using default config file for my plugin
When I update my plugin I add new config lines and I want my plugin to auto update my users config file with new lines. But the data my users already put in the config file have to not change !
If you can tell me how I can do it : D because I don't understand anything about the doc haha
Well didnt phoenix tell you
yes but I don't understand how I can do it x)
what methods I have to use
Oh well I think you'd use
MemoryConfiguration#options#setDefault or smtng
how can i make a gui without the inventory part? i only want to show the encercled piece
not possible
Impossible I think you can just set the number of lines displayed
hmm
but you can put glace panes in empty part for a more aesthetic rendering
So I am spawning an fallingBlock and throwing it. most of the times it lands normal but sometimes it breaks. Can I somehow place a Block there where it breaks, so it looks like it didnt? pls ping me if you answer thank you
is it possible to set a variable to an item? I have a "Teleport wand" with 100 durability, it works fine until you try to have another wand, then the durability links.
What methods I have to use exactly ?
is there a way to pass information from the attacker to the attackee
like when a player attacks a zombie
if the player is wearing a leather cap, the zombie doesn't get damaged
Yeah with listener
Listening to what
EntityDamageEntityEvent
then?
you check if damager is a player and have a leather cap
and so you do event.setCanceled(true);
Might aswell write the plugin for him lol
thx
You also need to check if attacker is instanceof Projectile
You can check what entity it is aswell if needed.
the bane of my exisistence
if Projectile get shooter
@eternal oxide for my lock command ๐ should i store the lock on the pdc of the player or not?
so i cant get unloaded just like a chunk
That's like who shoots an arrow the player or the skeleton.
@ me if you know anything for me
What's up?
No, you had it all done days ago on the Chunk PDC
.
So I am spawning an fallingBlock and throwing it. most of the times it lands normal but sometimes it breaks. Can I somehow place a Block there where it breaks, so it looks like it didnt? pls ping me if you answer thank you
yes but if the chunk unloads what happens to the lock?
What do you mean by links?
it stays on the chunk PDC
If the chunk is unloaded it doesn;t matter whats in there
Say i have a stick with 27 durability left, i make a new one, i use it, the new one has 26 durability
as if i never made a new one
Oh yeah you should able to just get the current value and add then new value on top.
wdym
so what is this doing?
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
PersistentDataContainer container = event.getChunk().getPersistentDataContainer();
BlockState blockState;
for (NamespacedKey key : container.getKeys()) {
if (key.getNamespace().equalsIgnoreCase(MagmaBuildNetwork.getPlugin().getName())) {
String[] data = key.getKey().split("/");
if (data.length != 3) continue;
blockState = event.getChunk().getBlock(Integer.valueOf(data[0]), Integer.valueOf(data[1]), Integer.valueOf(data[2])).getState();
if (!canLock(blockState)) {
MagmaBuildNetwork.getPlugin().getLogger().warning(String.format("Unknown Lock removed! %s.", key.getKey()));
container.remove(key);
}
}
}
}
hmm maybe paste was better
Something like this ```java
p.getInventory().getItemInHand().setDurability((short) (p.getInventory().getItemInHand().getDurability() + 100));
Removing any old locks which are no longer valid
@cedar hamlet
the problem is that its a stick
oh wauw
sticks dont have durability
what's the difference between raw slots and slots
raw slots cover both inventories
public static ItemStack getItem(int usesLeft) {
ItemStack tpStick = new ItemStack(Material.STICK);
ItemMeta meta = tpStick.getItemMeta();
meta.setDisplayName(ChatColor.LIGHT_PURPLE + "Teleport Wand");
List<String> lore = new ArrayList<String>();
lore.add(ChatColor.DARK_PURPLE + "===========================");
lore.add(ChatColor.LIGHT_PURPLE + "Teleport Wand that allows");
lore.add(ChatColor.LIGHT_PURPLE + "You to teleport in any direction!");
lore.add(ChatColor.LIGHT_PURPLE + "Uses: "+usesLeft+"/100");
lore.add(ChatColor.DARK_PURPLE + "===========================");
meta.setLore(lore);
tpStick.setItemMeta(meta);
return tpStick;
}
}
Stick
Aha so you could update the lore each time
if rawSlot != slot then its Bottom Inventory (or top I forget)
I do, hence why one works
but when i introduce another item, it has the same durability
The problem is that im setting the durability value to the player
I'm wondering if i can set it to the item
so it's like relative coordinate and absolute coordinates?
I guess you could use NBT data to create the custom item and add a custom value to it.
yes
Bump
Attributes
any idea on how to do that
GENERIC_MAX_HEALTH
ty
np
But what's the difference between the attribute and the health scale method?
If you have the players inventory you use slot
so....... I want to import the Packets Module here.. to my API, how do I do this in the pom.xml?
I tried this, didn't work.
@vestal dome you would make it a dependency instead
but if you really want it as a module, just make a copy of it directory wise and put it in the same projects directory I suppose
so if I do p.getInventory().getItem(), I use normal slots?
yes
and this is the reference to normal slots?
https://wiki.vg/Inventory
I got the link from here
https://www.spigotmc.org/wiki/raw-slot-ids/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yes
thanks
uhh... any one knows how to do it?
.
java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.equals(Object)" because the return value of "org.bukkit.inventory.PlayerInventory.getItem(int)" is null
bruh
did I get the slot wrong?
what did I do wrong
https://paste.md-5.net/sitineneqe.cs
thats not how u import things on ur computer as a dependency...
isn't it suppose to not damage the entity if Im wearing a leather cap?
IT'S A MODULE
MODULEEEEEEEEEEEEE NOT A DEPendency...
ok gota lil bit pissed sorry.
yea but u can still use it as a dependency but just telling u thats not how u do it
:facepalming:
@EventHandler
public void onJoinEvent(PlayerJoinEvent event) {
if(event.getPlayer().hasPermission("ssmp.donator")) {
event.setJoinMessage(ChatColor.translateAlternateColorCodes('&', "&a" + event.getPlayer().getDisplayName() + " " + this.getConfig().getString("join-message")));
} else {
event.setJoinMessage(ChatColor.translateAlternateColorCodes('&', "&a" + event.getPlayer().getDisplayName() + " " + this.getConfig().getString("join-message")));
}
}
@EventHandler
public void onQuitEvent(PlayerQuitEvent event) {
if(event.getPlayer().hasPermission("ssmp.donator")) {
event.setQuitMessage(ChatColor.translateAlternateColorCodes('&', "&a" + event.getPlayer().getDisplayName() + this.getConfig().getString("quit-message")));
} else {
event.setQuitMessage(ChatColor.translateAlternateColorCodes('&', "&7" + event.getPlayer().getDisplayName() + this.getConfig().getString("quit-message")));
}
this will return in-game: "{username} null". any tips how to fix this? tried some cheap hacks but none work
also modules only work if the folder with the files in it is with the pom.xml
the join-message in the config must be null
or the config is null
ยฏ_(ใ)_/ยฏ
something is null tho
join-message: |-
&fhas joined.
quit-message: |-
&fhas quit.
then tell me what I should do
do it
put the api ur using in the root directory where the pom.xml file is
then idk
If you need all of the modules in a jar use the maven shade plugin
no they are different modules...
one is for a spigot server..
one is for bungeecord ,etc.
but the packets one is in every single one of the others.
since I need it to communicate between them
Hi, Anyone knows how can i make a tablist plugin?
So umm Im confused
I was trying to see how PlayerInventory.getHelmet works
so I looked into the source
try this <dependency> <artifactId>artifactid</artifactId> <groupId>groupid</groupId> <scope>system</scope> <systemPath>c:/your/dependency/jar/file/full/path</systemPath> </dependency>
but in PlayerInventory.java, all they did is declare the method
Thank you
but the method doesn't contain anything?
Im confused as to how this works, can someone explain?
You are looking at the API
how do I look into the source or whatever it is
the folders BT created
uhu
lmao i went to https://github.com/SpigotMC/Spigot and it says Repository unavailable due to DMCA takedown
wtf
im pretty bad at coding myself lmao
tho why is spigot repos dont work
on github
wtf is a .patch file lol
Normal, it does patch on Bukkit
if you want to see source code of Bukkit, just go on Bukkit repo
on the same link
@vestal dome reason I suggested dependency is because it is the easiest way to let other projects have access to it. Build it in the appropriate project that does contain the module, only change for its pom is you are going to want to have the install goal for it so that it installs the jar into your maven repo. Once it is built and placed in the repo, all your other projects can use it as a dependency super easily.
Tried formatting the message by ''. Still same result
i really dont know why it isnt working dont ask me
but make sure in ur server the config files are in the plugins/plugindirectory/
oh quick question, is player receiving tiny amounts of downwards velocity from fire/poison/falldamage etc normal?
is bukkit still alive anymore?
Everything is formatted correct, so its the code right?
Im pretty sure it's a bug that was never fixed since iirc vanilla doesn't do that
oh looks like its not XD
bukkit is dead
it says the last commit is in 2014
lol
bukkit is only alive via spigot, otherwise no there is no more bukkit staff members that work on bukkit anymore. They all left
look into spigot if youre talking about the api
what i dont get is how patching nms code is not illegal while using nms code in your projects is
You can;t use Mojangs code in yoru own project, Nor can you distribute it
However Altering it on the PC is not
because you are allowed to modify other people's code
you just can't copy their code into your project and then do nothing else to it
think the iPhone lighting to headphone jack addon
you can't produce your own iPhone with a home button
but you can add one to it
shouldnt it be illegal both ways?
or like Gameboy, you can buy a gameboy and change it's screen and speaker
but you can't make your own gameboy
with pre-changed screen and speaker
i dont even know why u cant i mean isnt the gameboy like real old now
a patch file is just a list of changes to files
Spigot is not allowed to distribute mojang code because of the agreement
knockoff is not the same as producing it yourself
copying != modifying and making it better
it is, but it is an example. During the time gameboy was popular it was patented. Meaning you can't just make your own gameboy and sell them. But you can sell modifications to them however or make modifications without repercussions
anyone can make a knockoff minecraft
true
but not use original minecraft's code to do it
exactly
isnt the assets copyrighted to tho
indeed
basically, you can't touch minecraft's code
they arent distributing anything except the changes
server.jar has to be in tact
the changes themselves are stored as patch files, and the patch files dont have copyrighted or licensed code by mojang- only spigot code
but voxel games are not patented or copyrighted. In other words a cube world on its own is not copyrightable. The elements and graphics you use on those cubes are
it's kinda like buying a PC
when you run buildtools it applies the changes on your computer
you can plug whatever the f* you want into it
but if you open and modify it your warranty gone
and in mc's case if you open it and modify it
boom sued
here look at this
this is a PaperMC patch for spigot
instead of forking spigot and adding changes directly, then redestributing spigot
unless u fix the warranty seal if there is one and do a good job to cover the changes u made
they are distributing the CHANGES in their purest form
well in the case of minecraft you can't
well they also distribute the jars but
since you know.. hashing is a thing
now while although we are telling you what you are not allowed to do, quite honestly there is nothing any of us here can do in what you decide to do. Your biggest worry should be if whether or not mojang is going to come after you or not lol. We can only tell you what is against Mojang's EULA
if I wanted input from the chat what would I put as parameters for the new Scanner()
has the mc server jar been decoded once?
been decoded numerous times
You don;t use a Scanner for reading Chat, Its not a console
you cant use Scanner
use an event
AsyncPlayerChatEvent
Okay and how do I grab the message?
?jd
package index
search for the chat events using the search bat @floral schooner
i think u do event.getMessage() in that event
unrelated question to the discussion you guys are talking about, but is it possible to encrypt a Socket's data? like the data sent between the server and client?
oky ty
@vestal dome yes
yes but idk how
how..
use ur mind???
you encrypt the data before it gets put into the packet
and the on the other end you need a mechanism to decrypt it
?lmgtfy how to encrypt data for sockets
?google test
oh it got disabled ๐ฆ
bruh not event
How can i add nms to my project? (I'm using IntelliJ)
buildtools
depend on the spigot server jar instead @quaint mantle
but dont really use nms
I'm using 1.8.8
it only really supports one version and if u want to make to support more its really hard to do that i mean reflection isnt that hard but it isnt worth it
spigot has 1.8.8 api??
@quaint mantle that doesn't change my answer
ofc
just use the spigot api
actually is older minecraft versions supported
they are not supported no, but you can still build against the old api's if you want
if u using maven Add this to your pom.xml:
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>```
so it's only suppose to support the newest
no spigot has apis from 1.8.8-1.16.5 stored in there maven
what that means is you can make a plugin for 1.8 if you want to @keen kelp however don't expect to get much support here for any problems you encounter
I see
there is a spigot 1.7 but its not hosted in the repo's ๐
ik
why is VSC opening my discord link cringe
yep that much is true
its probs gonna be removed in future tho
probably not
maybe
hopefully
but it isnt really supported
anymore
so they could remove it
its kinda there choice
build tools will most likely be updated to not build the old versions if anything ๐
to do it or not
Been on this for quite some time now and I honestly don't see what is null or what is even wrong
player.getWorld().spawnFallingBlock(spawnLoc, Material.GRAY_CONCRETE_POWDER.createBlockData()).setVelocity(vector);
Why cant I do .setDropItem(false) and the setVelocity ? Or how can I do it?
setVelocity doesn't return an entity
store the returned entity from spawnFallingBlock in a variable, then call setVelocity on it
then go on with your life as usual
Is player#spigot a thing?
package index
any specific versions its not on?
so then its not on org.bukkit.entity.Player
interesting then
it's not part of the bukkit api, it's included in spigot api
so when InventoryClickEvent fires, I need to cancel clicks in both inventories a user has open (their inventory and the open inventory above it), but the click event only happens in one. how can I get the other
wat
InventoryClickEvent is dispatched regardless of the inventory that was clicked
so does getClickedInventory() vary and getInventory() always represents the players inv?
getInventory will always give the top inventory afaik
getClickedInventory does what it's named after
ok that should work for me, if getInv is always the top
I think I figured out why and it's extremely dumb
In short: Hash collision
I was using o.hashCode() == hashCode() as my equals() override function
I know better now but at the time I wrote that code I didn't
๐คฆ
Anyways I'm gonna be pushing a fix for it today
Use buckets
Or whatever they are called
You know
???
Related data structures: Hashtable, Array
Ah nvm itโs a different bug
Lmao
I thought you implemented your own hashing structure
Does the spigot gradle api not include craftbukkit?
It was my fault for implementing a bad equals function
api is api, not implementation
craftbukkit implements the bukkit api, spigot extends craftbukkit and also implements the spigot api (which extends the bukkit api)
so how come its not included
Yes I can see that
because it's illegal to distribute a modified minecraft binary
if you want to play around with the server internals you need to run buildtools
?bt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
bt will install it in your maven local in your machine
can anyone suggest a good resource for learning to apply mathematics to programming
just make it
i cant lol
i mean i can try
you can make a 2d graph in swing
So
My .jar is 130 MB due to dependencies
Is there a way to have these downloaded automatically or something so that my jar isn't as bloated?
You can always minify your jar to remove unused classes
Why so many depends?
only one
What one?
well, its not a spigot api
i need to detect languages and i want to avoid api
so ๐คท
sucks to suck
life hits hard sometimes ๐
You could always download it at server start and inject it into the ClassLoader
seems like it is on maven central
won't work on all java versions
yeah.......... id love to say i understand that - but i don't
where does it do it
is block.getBlockData() a clone?
I want to change the facing direction of an existing block
i dont think so no
so this should be enough then?:
BlockData blockData = e.getBlockPlaced().getBlockData();
if(blockData instanceof Directional) {
((Directional) blockData).setFacing(facing);
}
should i just copy this?
You could, its not complex
You guys support built tools correct?
if it doesn't have an update method, it's not a clone
update or set method or something to that extent
iirc you need to do Block::setBlockData to update it
this downloader thing is a hack and it's broken, that plugin will no longer work on 1.17 (onwards)
okay so this should be fine
BlockData blockData = e.getBlockPlaced().getBlockData();
if(blockData instanceof Directional) {
((Directional) blockData).setFacing(facing);
e.getBlockPlaced().setBlockData(blockData);
}
Really? oh
mhm
Probably not
it is
It uses reflection and will likely break in 1.17
"will likely break" my ass
it won't
Java 16 enforces strong encapsulation, you can't reflect to it anymore, that same hack was used by LuckPerms and that's the reason why Luck implemented the jar-in-jar system, also the reason why SlimJar was made
your ass?
lmao
You are contradicting yourself with this comment
thats what i thought
I say it will likely break, you say my ass, then you say it will break
I say its likely as I've not tested it on 16
You don't have to be a mathematician to know that 2+2 is 4
allegedly
what is Load in the plugin.yml?
Yep it blows up on 16
when the plugin should be loaded
like
Load: STARTUP
huuuuuhh
loads the plugin b4 the world
However, it still downloaded the jar, just can;t inject it into the classloader. so it won;t work till a restart
Wat
b4? was by?
So you can still use that code to download your jar, if it doesn;t exist, just call a restart after instead of injecting
FAKE IT'S 22 FUCK
Ngl it would be hella easier if the plugin classloader exposed addurls
it would
Hhhhhhhhhhh
could i:
throw new IOException("Error, could not add the library to system classloader");
Just call a restart then?
Line 35 of Downloader just schedule a task 1 tick later to call restart
Nope
idk ๐คท
Java 16 you can;t get reflective access
i mean if not the user is gonna end up with an uber jar
lots of plugins are able to load whole jars modularly
f.e placeholderapi and its extensions
is there actually a way to restart, not just stop the server
yes, somethign like Spigot.restart()
there is but it doesn't work properly
Why would a restart magically add it to the classpath tho
and is generally ill advised
All jars in the libs folder are loaded by Bukkit at startup
Wdym it works just fine
except when it doesn't
lmao
Can you use BuildTool with gradle?
i don't remember the exact issue but it spawns like a child process or something that fucks with console readers and the system environment or something
but what does it exactly return cause I cannot store it in an Entity
BuildTools is a jar that you run. But the result will be added to your local maven repo so yes
so... do i leave the existing ln 35 which adds it to class loader or just not bother
you delete it
kk
let me look at what placeholderapi does
How do I connect it to my project?
Just like anything else
Or.. use gradle and you get to use slimjar ๐
So I just add it to my library
I believe it does what Bukkit tho
But worse
Depends on what you mean by that
If you have a module-info.class it fucks up lmao
Do I add BuildTools.jar to my library
External libraries or in the build.gradle
How can I add it to build.gradle?
Run it
player.getWorld().spawnFallingBlock(spawnLoc, Material.GRAY_CONCRETE_POWDER.createBlockData()).setVelocity(vector);
Why cant I do .setDropItem(false) and the setVelocity ? Or how can I do it?
Nothing happens
Does anyone know how to setup a contabo vps?
What does it tell you
Nothing
like this ?Bukkit.getScheduler().runTaskLater(this.plugin, () -> Bukkit.spigot().restart(), 1L);
I've already ran it before and have all the files
I literally told you what to do
yep, just make sure you only do that when you download the jar, and not if it already exists
If you're gonna ignore people's advise then don't bother asking
I did not understand it tho
Do you not know what a variable is?
If you've run it change spigot-api to spigot in the build.gradle
yes
even if I don't know it off the top of my head
i mean, this is in my main:
// Download dependencies.
Downloader down = new Downloader(this);
if (!new File("libs" + File.separator, "lingua.jar").exists()) {
down.install("https://github.com/pemistahl/lingua/releases/download/v1.1.0/lingua-1.1.0.jar", "lingua.jar");
}
yep
ok, let me test it
but then all my imports are messed up now
They won't be after you reload your Project
what do I put infront like the "int" at public int distance = 2
what?
do you reckon i should load on startup so it skips all the world stuff the first time
Heyo, so I have an abstract method, onCommand(), that gets passed a CommandSender object.
abstract void onCommand(CommandSender sender);
The CommandSender paramenter is prechecked as to whether it's an instanceof Player or not. I'm wondering if there's a way that I can make it so I don't have to type cast the command sender in the onCommand method if they're a Player.
Basically I just want to have the option to either write:
public void onCommand(CommandSender sender { }
or
public void onCommand(Player sender) { }
based on predetermined typing. Is this possible?
create a child class loader or something and load the module classes with that
Does anyone know how to setup a contabo vps?
using the shedule means it will wait till the server is fully started before it restarts
if I do:
Entity entity = player.getWorld().spawnFallingBlock(spawnLoc, Material.GRAY_CONCRETE_POWDER.createBlockData());
it does not work so what do I need to put instead of Entity?
ahh ok
its still is
Well what does spawnFallingBlock return?
Wrong channel have patience
where
Hover your cursor over the method I guess
What channel should I use
General
ok
Make sure you have mavenLocal() as a repository
Well it returns a FallingBlock
Then did you run BuildTools for that version
yea
Send your build.gradle
have you tried creating a new url classloader and setting it as a child of your plugin classloader and using it to load the classes of your module
whats up
thank you alot for explaining it so detailed and spending you time helping others
Hi :)
hi oliva
Olivia Pierce ๐
the Skripter
repositories {
mavenLocal()
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
}
dependencies {
compileOnly("org.spigotmc:spigot:1.8.8-R0.1-SNAPSHOT")
}
Still doesn't fix it
1.8 plebian detected
:^)
When you ran BuildTools did you tell it to build 1.8.8
yea
hahaha
my catalogue of 1.8 users to ping at random expands
Well then good luck
How get skull with custom texture? (no texturepack only optifine)
education edition
do i have to do something to load the lib folder
its just i keep getting ClassNotFoundExceptions
create a child class loader and use it to load the jar
yea and I must create account to upload paintings
yea well then create an account and upload paintings
im not really what that is
tbh
the answer that doesn't have a million comments screeching about java 9+ reflection
ok, so what is myJar, a file path?
presumably a File as it has a toURI method
ok
so then idrk about these:
com.MyClass
and myMethod
what are they placeholders for?
they are reflection shit
com.Myclass is the full name of the class you want to load
mymethod is the name of a method, but I don't think there is any need to get a method out of it
just loading the class is enough
and instantiating it
can i point it to the main class and have it handle all the subclasses
i am really out of my depth
you need to point it at some class that is in the external jar
i'm not 100% on how that's going to work with dependencies rather than modules
what are you doing exactly
i need to load a .jar that i use inside of my plugin, however it is like >130 mb so i cant shade it really
so i am downloading it with a method ElgarL showed me
how do you interact with the classes of that jar
what, like this?
com.github.pemistahl.lingua.api.LanguageDetectorBuilder.fromAllSpokenLanguages().build();
?
i just use it like any other maven depend atm
i don't quite remember how classloading semantics work exactly
a module would be something that is a component of your project
ah oj
Class classToLoad = Class.forName("com.github.pemistahl.lingua.api.LanguageDetectorBuilder", true, child);
Object instance = classToLoad.newInstance();
should i just try this and see
that will load the class with the child class loader
but i'm not sure which classloaders then have access to that already loaded class
fuck around with it some I suppose and see what works
it may have worked but i just realised it is written in kotlin
and now it is having a hissy fit about that
link the image, not the webpage
it is an image
yes it is
literally not an image
dude who cares
it's a webpage with a million trackers and cookies and laggy shit
here's the image
actually thats fair enough
i don't need to nor do i want to see a feed of "newest most viral" images
fuck you and your cancerous webpage
the link I put in chat is was it gave me
so any ideas?
what are you even running
buildtools
^^
that's not how you spell buildtools either
how are you running whatever you're running
in a bat file
@echo off
IF NOT EXIST BuildTools (
mkdir BuildTools
)
cd BuildTools
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
java -jar BuildTools.jar --rev %Input%
pause
what if I want a specific version
?bt
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
^
then run buildtools and tell it to build a specific version
reading the documentation helps
java -jar BuildTools.jar --rev %Input%
surely you don't need a bat file to put your input here for you
ok
run it normally
its the same thing
surely not
show
just so you know, we can't read your screen
again with the cancer webpage
where's that
the page
hm I think so
lmfao
just checkin
now that you say that im not too sure
is the buildtools jar in that w directory?
wait there is a jar?
lmao
omg
read the docs
hold up
come back in a few hours
it would tell him the file wasn't found if not
why did java uninstall it self
please go to #help-server
if you don't have java installed it'd say java is an invalid command
^^
i can't see shit in your screenshot because you've fucking sketched all over it but I'm not seeing any response message from the command
common sense
of course the 100mb dependency would be written in kotlin
i don't know what i fucking expected
what does it say exactly
ill get it
one sec
java.lang.NoClassDefFoundError: kotlin/jvm/internal/DefaultConstructorMarker
at java.lang.Class.getDeclaredConstructors0(Native Method) ~[?:?]
at java.lang.Class.privateGetDeclaredConstructors(Class.java:3137) ~[?:?]
at java.lang.Class.getConstructor0(Class.java:3342) ~[?:?]
at java.lang.Class.newInstance(Class.java:556) ~[?:?]
at com.oli.xlang.XLang.onEnable(XLang.java:56) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:480) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:493) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:407) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:555) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:257) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:928) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$0(MinecraftServer.java:273) ~[spigot-1.16.5.jar:3059-Spigot-4225eac-7ea8b96]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: java.lang.ClassNotFoundException: kotlin.jvm.internal.DefaultConstructorMarker
at java.net.URLClassLoader.findClass(URLClassLoader.java:471) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:588) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[?:?]
... 15 more
wdym, the one i am loading?
yes
that's strange
by my understanding of how classloaders work it should have that classloader try load the kotlin class first
try loading that kotlin class directly and see if it says something different
i dont know how to do that - sorry
kotlin/jvm/internal/DefaultConstructorMarker
load this instead of the class you're loading now
ah ok
ClassNotFound
[23:03:56] [Server thread/WARN]: java.lang.ClassNotFoundException: kotlin.jvm.internal.DefaultConstructorMarker
[23:03:56] [Server thread/WARN]: at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
[23:03:56] [Server thread/WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
[23:03:56] [Server thread/WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
[23:03:56] [Server thread/WARN]: at java.base/java.lang.Class.forName0(Native Method)
[23:03:56] [Server thread/WARN]: at java.base/java.lang.Class.forName(Class.java:398)
[23:03:56] [Server thread/WARN]: at com.oli.xlang.XLang.onEnable(XLang.java:54)
i asked you a while ago whether the relevant kotlin class is in the jar you download
and you said yes
oohhhh sorry i misunderstood
i thought you meant the class that had been written in kotlin
im so sorry ><
this.getClass().getClassLoader().loadClass("com.github.pemistahl.lingua.api.LanguageDetectorBuilder"); gives a classnotfound which is weird
that is to be expected