#help-development
1 messages · Page 2026 of 1
for some reason my escape button isnt working most of the times in discord
how can I do that
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
how can i run a command and turn it on and off with out args
Are those separate questions?
no
Oh you mean a command that toggles a boolean?
yeee
private boolean something = true;
public void toggle() {
this.something = !this.something;
}
how should I load a config without accessing the file later? right now I have static variables https://prnt.sc/R_6HXK0OYqVT
but I'm wondering if there's a better way to do it
wtf is this
funny... nobody codes like that
What in the
You should not need to cache FileConfigurations at all.
fileconfiguration itself is a cache of the file contents basically
What the
How do you read that font
i can only read plugin = this and the word config
is he trying to load a sofaLocation? when did MC get those?
safeLocation
lmao
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/slime_ball"
},
"overrides": [
{
"model": "item/mob_capsule_1",
"predicate": {
"custom_model_data": 11
}
},
{
"model": "item/mob_capsule_2",
"predicate": {
"custom_model_data": 12
}
}
]
}
{
"parent": "item/generated",
"textures": {
"layer0": "item/mob_capsule_1"
}
}
Am I doing this texture wrong or smth?
Doesnt seem to work
are you getting a purple black squared texture?
no but when i set the model data it just stays as a slime ball
no, i am pretty sure it is sofa, it is even calling for closeCell which is a type of foam used in furniture.
Is there a /minecraft/textures/item/mob_capsule_1.png file
i have it for example like this
yep
do you have a json model file for that custom item?
does anyone have any info on how i could fork spigot for a minecraft snapshot version ? or does anyone know someone that could help me ?
Why are you forking it?
Just wait til the update comes out.
Seems kinda redundant.
uh
And you have a minecraft/models/item/mob_capsule_1.json?
yes
i have my reasons but like how would i be able to do that.
{
"parent": "item/generated",
"textures": {
"layer0": "item/mob_capsule_1"
}
}
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
Hmm interesting, maybe try adding "minecraft:" in front of all the item/?
alr
what
Yeah I have a semi-completed lib that generates resource packs
Well, I suppose that's mostly completed, but it really hasn't been rigorously tested yet.
ah
?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.
method in method
sense when could you do methods inside a method?
you can do that?
I see a pyramid in the making
anonymous classes
No. Only if you use a method inside a class inside a method
so class < method < method
public void placeHologram(String type, double x, double y, double z, String worldName) {
String typeL = type.toLowerCase();
World world = Bukkit.getServer().getWorld(worldName);
Location loc = new Location(world, x + 0.5, y + 3.5, z + 0.5);
final Hologram hologram = HologramsAPI.createHologram(plugin, loc);
Material m = Material.matchMaterial(type);
hologram.appendItemLine(new ItemStack(m));
hologram.appendTextLine(ChatColor.GRAY + type + ChatColor.GRAY + " Clicker");
hologram.appendTextLine(ChatColor.GREEN + "Gives 1 coin on click");
hologram.appendTextLine(ChatColor.GREEN + "Cooldown: 1 second");
hologram.appendTextLine("");
hologram.appendTextLine("" + ChatColor.YELLOW + ChatColor.BOLD + "RIGHT CLICK: " + ChatColor.GRAY + "Open Upgrade Menu");
}
public void spawnAllClickerHolograms() throws SQLException {
PreparedStatement ps = plugin.mySql.getConnection().prepareStatement("SELECT * FROM clickerblockslocation WHERE 1");
ResultSet rs = ps.executeQuery();
String type;
double x;
double y;
double z;
String world;
while(rs.next()) {
type = rs.getString("type");
x = rs.getDouble("x");
y = rs.getDouble("y");
z = rs.getDouble("z");
world = rs.getString("world");
Bukkit.getLogger().log(Level.FINE, world);
placeHologram(type, x, y, z, world);
}
}```
It says: ```source.getworld() cannot be null```. Why is my world null? What am I missing here?
class SomeClass {
void someMethod() {
Runnable r = new Runnable() {
@Override void run() {
System.out.println("yes");
}
}
}
}```that looks like a pyramid lol
public static void printSquares(int start, int end) {
class Printer {
public static void print(int number) {
System.out.println(number);
}
}
class Squarer {
public static int square(int number) {
return number * number;
}
}
for (int i = start; i < end; i++) {
Printer.print(Squarer.square(i));
}
}
never understood why to create a new class in a method
You shouldnt
ye >_>
Bukkit.getWorld() might return null if the world doesnt exist or is not loaded yet
then how do i check the bool
As usual
How long you want to cache data really depends on your context and use cases.
if (bool = !bool) kekw
Is the currency only used on one server instance?
im updating the player data of every user to the database every five minutes
Now my resource pack is erroring.
you still have a cache to rely on so i dont think such a low updating time is required
Imma send the ZIP file, somebody see whats wrong ig.
O
M
G
i need mental help
p.sendMessage(toggle()):
i fixxed it but i need to stop going to bed at 4 and waking up at 7
If you plan on expanding then you should not cache it at all. And you even have to do some extra steps to make it concurrent safe.
i need to stop sleeping five hours a day
how do i set the last character of a string to nothing?
Only if the currency is used on a single server at all times
Why would you want to do that exactly?
Just crop the last character away?
the world name is the folder name that holds world data, generally "world", "world_nether", and "world_the_end"
substring + " "?
i'm makin a say "<message>" command for my "virtual assistant"
it's often changed though
Then you cant make a decision about the cache
./say alerady exists in minecraft
Turns out it wasn't loaded
i'm actually making a discord bot
jda api?
yes
nice im working on one atm
Then cache it indefinitely for only players and like 15 minutes for offline players.
@lean gull show code 👀
i'm just expirmenting
For fuck sakes. Can somebody idenitfy the issue with my resource pack?
Or at least give me a link to create one easy?
Well ive been trying for the past hour to fix this.
Is it saying anything or just not working
Not a peasant feeling.
i would but i'm paranoid and idk if that file is safe
'potentially dangerous download'
And it is applying, yes?
scary
As soon as I load into the server, it downloads and states something went wrong.
Then my anticheat kicks up, and kicks me for not installing the resource pack.
how is that dangerous lol
Relaunch Minecraft with the Output Log
Settings -> Show Output Log on Startup
In the launcher
K
jd are you hosting the server on minehut?
where are the custom model jsons?
in models<items
do you need to upload the resource pack as a zip file?
this isnt valid
They can be zip files
i don't think they can, zip files make it so it's in a folder
models>item should contains the json files called as a minecraft item, containing the overriding predicates
can you send the full error
like this
Or is that all it said
Connecting to (n0)
14:40:13.163
Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
14:40:13.270
Unknown custom packed identifier: minecraft:register
14:40:14.368
[CHAT] AnEmerald joined the game
14:40:14.422
Loaded 524 advancements
14:40:16.022
Found file C:\Users\pixel\AppData\Roaming.minecraft\server-resource-packs\0e22f0b8173c51e124ef6169b43f71f05fff084c without verification hash
14:40:16.025
Pack application failed: java.io.IOException: Invalid resourcepack at C:\Users\pixel\AppData\Roaming.minecraft\server-resource-packs\0e22f0b8173c51e124ef6169b43f71f05fff084c, deleting file C:\Users\pixel\AppData\Roaming.minecraft\server-resource-packs\0e22f0b8173c51e124ef6169b43f71f05fff084c
thats all
ye invalid it says
so where do I place custom objects and textures then?
your folder structure isnt good
I wonder if it's failing to delete a cached version of it
im bad at textures
./.minecraft/serverresourcepacks, delete everything in there.
r u using custom resource location? not related to the problem, just asking :)
its empty
Okay
yep, im using CustomModelData for custom items
AKA im making a plugin that acts like a mod
without having to use forge
Ah wait wait, are you using the exact same zipped file you sent us?
Or a folder that you zipped is what you sent
The very same
i mean like a custom folder inside assets
There's your problem then, inside your zip is a subfolder
That's bad
And your assets are in that subfolder, take them out and it should apply it again
how can i reload my server once the build is done?
./reload
auto
under models make sure you have two folders
- item: json files like the one you sent with the overriding predicates, the name of the file should be a mc item name so like
bow.json - custom (or something) which contains the actual model for the item - i assume your items have just a different texture, then put the texture path and stuf in that file, the name of the file doesnt matter
@quaint mantle
Oh, you'd have to setup a script or something to do that for you
oh ok
okay but when i tried that it couldnt find custom
Gradle could do it probably
i mean minecraft > models > custom and minecraft > models > item
that shouldnt be a problem afaik
It is.

So your slimeball is being applied now also?
@quaint mantle even with the weird folder structure?
100% fine
no bugs
yea
have it like this
How can I use getBlockAt(x, y, z).getType() without forcing a chunk load since it causes infinite loading
?jd-s
is there a event that can tell when someone has a elytra and used rockets
Player interact event most likely
rig- nvm
public class Program {
public static void main(String[ ] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
System.out.print(Converter.toBinary(x));
}
}
public class Converter {
public static int toBinary(int num) {
String binary="";
while(num > 0) {
binary = (num%2)+binary;
num /= 2;
}
return toBinary(num);
}
}``` what is wrong with this code
Use StringBuilder
Also that toBinary method will always throw a StackOverflowError or an OutOfMemoryError in accordance with the JVMS
yes it is
I recommend to return unconditionally if num == 0 and to return a String and not an int
yes
You should also change it in a way that you need to pass a StringBuilder instance to it
just set the rocket damage to teh durability on the elytra to 75% and your users will tell you themselves!
not sure if that works for rockets myself as they are propulsion
yes
oh actually you cannot use StringBuilder as-is but if you precompute the expected size of the int you can do it anyways
you would get a glide after the rocket stopped though
it will trigger with tridents YSYK
as rockets and tridents are both the same type for elytra
What
would this save recouses? bc im spawning a particl
i heard it 2 days ago and have no clue about that.
riptide from trident and rockets are both propulsion
Yes
To check when they start gliding
i want a particle to spawn when they use elytra
Or stop
fancy elytra
No
Entities can glide too
It’s an NBT tag you can set on them
That makes them glide when they start fallling
Is there a way to create fake world border that are only client side? Like to show the border of a claim for example. And can I have multiple of them?
phantom
Phantoms don’t glide
we could put zombies riding phantoms?
yes
fall gracefully?
i can accept that
i cant think of any other entity that has a glide-type behaviour
... maybe minecarts off rails ?
hmm
They won't render any differently though they might fall as though they're wearing an elytra.
i wanted to have a particle that would stay still untell it disapeared, does anyone know how to do that?
lava just blast everywhere
i want a trail of particles behind the player, like iron man and his trail
do particles have gravity?
Some do
They have certain properties. Some can have a direction and velocity. In your case it would suffice to just set the velocity to 0
(double extra)
?
Here are some suggestions:
CLOUD
ELECTRIC_SPARK
END_ROD
FIREWORK
INSTANT_EFFECT
POOF
WAX_OFF
SMOKE
SNOWFLAKE
REDSTONE
Best suited for you is probably REDSTONE or FIREWORK
Caused by: java.lang.IllegalArgumentException: data should be class java.lang.Void got class java.lang.Integer
dripping lava has no data
oh lol
Do you want a rocket-type effect? With flames and smoke?
imma try his list
uh i want like a trail behind the player, like iiron man
Just a white jetstream?
There is a spawn particle event with a parameter of type double called extra
That controls speed for most particles
...
how do i add it
try this one. Curious on how it looks:
public void spawnJetStreamPointAt(Location location) {
double roll = ThreadLocalRandom.current().nextDouble();
if (roll < 0.9) {
spawnFlame(location);
}
if (roll < 0.1) {
spawnSmoke(location);
}
if (roll < 0.025) {
spawnSpark(location);
}
}
private void spawnFlame(Location location) {
location.getWorld().spawnParticle(Particle.FLAME, location, 1, 0D);
}
private void spawnSmoke(Location location) {
location.getWorld().spawnParticle(Particle.SMOKE_NORMAL, location, 1, 0);
}
private void spawnSpark(Location location) {
location.getWorld().spawnParticle(Particle.LAVA, location, 1);
}

do i call it?
I think getting the player location and just subtracting its velocity will make it follow the player in a decent way
Yeah but then wing tips
@EventHandler
public void ElytraFeetParticle(PlayerMoveEvent e){
Player p = e.getPlayer();
if (p.isGliding()){
p.spawnParticle(Particle.ELECTRIC_SPARK, p.getLocation(), 10);
}
}
i put it right above this
now what
it looks cool i think let me get a pic
whats word to break bukkit scheduler?
Hey, ive got a question, im currently working on a system where player can report other vis a gui, now i want that every reporteds players head is in a seperate gui with the reason they have been supported for, do you have any idea how i could do this ?
this is a wild shot: cancel()
Save the whole report as one serializable object including the player texture.
lightning rod effect
Would you reccomend using a database ?
Depends on your scope. But sure.
A file is also viable
How would I do this? I haven't seen anything for this before. Packets?
No, it should be removed when a moderator for example types /reports remove [name]
Yes packets
And it'll let people see multiple borders at once? Also can I make custom shapes with them or just squares?
Nope one border per player
also no custom shapes
ive tried it with a file but then deleted it , cause i didnt know how to get each value, cause i set the file like this Playername : reason.
Ah okay. Thanks
Create one data object "PlayerReport" with a bunch of fields that can be easily serialized.
yea, but i didnt know how to create a function that gets every players uuid and the reason, and sets a playerhead in a gui with those values.
public record PlayerReport(UUID sender, UUID receiver, String reason, long timestamp, Location location) {
}
Like this
Can i set an itemStack with those values more than once, cause i wanted to set a playerhead for every report
Particle.DustTransition i = new Particle.DustTransition(Color.RED, Color.WHITE, 1);
p.spawnParticle(Particle.ELECTRIC_SPARK, p.getLocation(), 1, i);
Caused by: java.lang.IllegalArgumentException: data should be class java.lang.Void got class org.bukkit.Particle$DustTransition
effectively immutable
[18:10:49] [Server thread/ERROR]: Could not pass event PlayerMoveEvent to ParticlePlugin v1.0-SNAPSHOT
org.bukkit.event.EventException: null
if you pass a mutable instance to it, its ofc still gonna be mutable
How would i set an PlayerHead on each Report, with a different Displayname ?
public class ReportManager {
private final Map<UUID, List<PlayerReport>> reportMap = new HashMap<>();
public List<PlayerReport> getReportsOf(UUID playerID) {
return List.copyOf(reportMap.getOrDefault(playerID, Collections.emptyList()));
}
public void addReport(Player sender, UUID receiver, String reason) {
PlayerReport report = new PlayerReport(sender.getUniqueId(), receiver, reason, System.currentTimeMillis(), sender.getLocation());
reportMap.computeIfAbsent(receiver, key -> new ArrayList<>()).add(report);
}
}
And then store this data class in a manager class
woops
I 'might' accept a multimap here. But if i would write it right now i would create a new class to encapsulate the list instead
okay, thanks a lot for your help
You can store the name in the record too if you want to.
But storing player names is quite tricky because you have to constantly update them when they join (because of name changes)
From then on you can get the OfflinePlayer via the UUID and create a head with it afterwards.
mob's locations get updated to players every tick right
I think there is a restriction. If they dont move then the position wont get updated.
yea my problem is the creation of the heads, cause when i use that 1 itemstack, how do i change it so that its different for every head
What version?
1.12.2
Then you need to search in old forum posts. No idea what the api looked back then.
Probably
ItemStack get-> ItemMeta (cast)-> SkullMeta #setOwningPlayer(OfflinePlayer)
Then set the ItemMeta back on the ItemStack
thats a client side limitation right?
yea but do i have to do this in a functio ?
yes
you can also write it on a piece of paper if you think that yields better results...
writing on paper helps me to remind things a lot better
No. A wrapper wraps the packet. Its not an instance of it.
So you will just have to call the constructor of the wrapper class with a packet to wrap as a parameter
Yeah. Or write your own wrapper. They are literally just calling the packet methods internally. Just with descriptive method names.
Uhm... there are plenty events for that
BlockDamageEvent, PlayerInteractEvent, PlayerAnimationEvent, BlockBreakEvent
Those all can be used in one way or another to detect if a player is digging
Anyone know how to get a BoundingBox of a chunk? It dosen't seem like there is a builtin method, should I create one, and if I were to, would I do something with getting the minX block inside of it and etc, because I cannot get a center block or anything from a chunk
Yeah you can create a bounding box from two corners
A chunk has no center Block. I would just go with the 2 Blocks on the corner
how could you get those two blocks though? I was going to get center and subtract 8
public static BoundingBox boxOfChunk(Chunk chunk) {
Block low = chunk.getBlock(0, 0, 0);
Block high = chunk.getBlock(15, 15, 255);
return BoundingBox.of(low, high);
}
This is for pre 1.18 worlds
ohh, I thought that they were normal coordinates not chunk coords
okay thank you
im not doing anything with the y in this plugin so it won't matter the version. thanks
What do you need the BoundingBox for?
well I will later on actually
just realized
but the server is 1.17
and if it updates il change the y
Whats the use case for your box?
custom factions plugin
I think then you should not use BoundingBoxes but only a single long that represents the chunk coordinate
Def better performance
i was going to combined all the claimed chunks into one boundingbox
Meh. If its completely chunk based then you are probably better of with longs. Also you cant combine BoundingBoxes into a single object because
they are axis aligned.
to combined them, I was going to use a custom comparator and some inefficient ways of checking multiple min and max coords
if I were to use this, why would I use a long, and what chunk coordinates would they represent?
Just the x and z coordinate of a chunk bit shifted into a single long.
Then a group of chunks or a 'region' can be defined using a LongSet from FastUtils for
blazing fast lookup times.
public static long getChunkKey(final int x, final int z) {
return (long) x & 0xFFFFFFFFL | ((long) z & 0xFFFFFFFFL) << 32;
}
public static long getChunkKey(final Chunk chunk) {
return getChunkKey(chunk.getX(), chunk.getZ());
}
public static long getChunkKey(final Location loc) {
return getChunkKey(loc.getBlockX() >> 4, loc.getBlockZ() >> 4);
}
public class ChunkCluster {
private final LongSet chunks = new LongOpenHashSet();
public void addChunk(Chunk chunk) {
chunks.add(UtilChunk.getChunkKey(chunk));
}
public boolean contains(Chunk chunk) {
return chunks.contains(UtilChunk.getChunkKey(chunk));
}
public boolean contains(Location location) {
return chunks.contains(UtilChunk.getChunkKey(location));
}
}
I bet you could do thousands of ChunkCluster checks in the PlayerMoveEvent without seeing anything in your timings because its literally just
a little of bit shifting and a contains on a LongSet.
oh okay
ah yeah
thanks for the idea :D
it.unimi.dsi:fastutil assuming this is the dependency
thank you 😄
how could I get the min and max xz coords with the LongSet? assuming it would oposite bit shifting.
this was a bit ago, but what does the # mean?
Method of a object, but you would need to use a instance of a world
its showing to use ```java
myWorld.setBlockData(arguments)
you can get a world with ```java
Bukkit.getWorld("world name");
wym get the world?
You would have to get the world object to use the setBlockData function
just means its a method of the class
yeah
a non static method*
which method
World world = Bukkit.getWorld("world"); // Get world object with the name "world"
world.setBlockData( ... ); // Replace ... with your arguments
well in this case setBlockData
setBlockData is the method of World
still giving me error ._.
show your code
and send the error
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Game extends JavaPlugin implements Listener{
public void onEnable() {
System.out.println("The plugin has started");
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
if(event.getBlock().getLocation().getBlockX() > 5) {
World world = Bukkit.getWorld("world");
world.setBlock(event.getBlock().getLocation().getBlockX(), event.getBlock().getLocation().getBlockY(), event.getBlock().getLocation().getBlockZ(), event.getBlock().getData());
}
}
}
it says I need to import something for World
what IDE are you using?
eclipse
there are 2 options
for what
use the one that has bukkit in it
your code is super verbose it can be cut down
org.bukkit.World
whats the other option
I did the bukkit one
but now I get
The method setBlock(int, int, int, byte) is undefined for the type World
I dont want to getData
not byte
^^, try doing something such as ```java
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Location loc = event.getBlock().getLocation();
World world = Bukkit.getWorld("world");
if (loc.getBlockX() > 5) {
world.setBlockData(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), event.getBlock().getData());
}
}
event.getBlock().getData()
ye
you should define more variables to make your code lines shorter and make it more dynamic for later on
because you are doing setBlock and not setBlockData
this should work
read what i said
that is ChunkData, not World
correct
._.
declaration: package: org.bukkit, interface: RegionAccessor
what is the diffrence
they told you to use world.setBlockData
one is a World the other is a ChunkData -,-
why that matter is chunk not in the world >_<
because they aren't the same thing?
you are reading something completely different
?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.
yea but thats not how programming works?
i see i see
so when would I use the chunk one
or never mind, I think I will just confuse myself
world is world
you would have to get the chunk data
thank you
np
this no work
error?
many
send
I cant send photo one sec
why not use loc.getWorld()
wait never mind just one error
The method setBlockData(int, int, int, byte) is undefined for the type World
it takes BlockData not byte
ye
event.getBlock().getBlockData();
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Game extends JavaPlugin implements Listener{
public void onEnable() {
System.out.println("The plugin has started");
getServer().getPluginManager().registerEvents(this, this);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Location loc = event.getBlock().getLocation();
World world = Bukkit.getWorld("world");
if (loc.getBlockX() > 5) {
world.setBlockData(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), event.getBlock().getData());
}
}
}
not getdata();
getData not getBlockData
declaration: package: org.bukkit.block, interface: Block
getData returns a byte
not BlockDAta
so which do I use
getBlockData
what version are you using
world.setBlockData(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), event.getBlock().getBlockData());
1.8.8
_<
bruh
No
1.8.8 is not fine
is there a work around
1.8.8 hasnt been fine since 2016 man
wait what are you trying to do in the first place
you are setting block data to a block which has been broken
I want to make a block
appear
when you break the block
making the block unbreakable
what version did you guys download for spigot
send me link plz
😫
I think I am just using the wrong stuff
?bt
cancel the event
BlockBreakEvent#setCancelled(true) 👀
where on this do I download something >_<
?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.
I learned the spigot examples from Google and YouTube
Also remember to read the spigot api doc
hi how do you change all pillager skin model into my skin? and how do you make it show for everyone?
with textures?
Ig that requires nms
I need to change the pillager to my skin
you could intercept the entity packet
and instead of showing an entity, show a player with your skin
does anyone know why my plugin is spitting this out
cannot access com.github.yannicklamprecht.worldborder.api.BorderAPI im giving it the repo and the dependency and im getting that
thats when im building the plugin
yeah really weird
can everyone see it?
if you intercept all packets sent
but
you would need to do more work
ok. how would I do that?
yoyo wizardly you got any idea on my problem? just a question since we both smort and work for best service team
You’ve got the repo and dependency stuff right?
ye
Have you tried refreshing caches or whatnot
Believe so
what comes next in iterations? i > j > k > ???
not for an O(n^4+) thing thank god but
I don't think there is any more
I will use m then because it feels official
maybe n
alphabetically speaking...
why do you need this many?
well there's a small problem where you have to find 3 numbers that add up to a target, I'm using a hashmap to flex an O(n^2) solution to all the O(n^3) solutions
yeah no change
how do I intercept the entity packet?
I would use protocollib
guys can someone teach me a bit about WORLDS?
I am making a kbffa plugin and I need that
Worlds?
$WRLD?
?services
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/
sorry yeah looking at that now
hi
so i am coding a repo from git in intellij
but its weird because i cant add a class
What do you mean you can't add a class.
finally made the jukebox play new song after current disc is done
@somber hull whats the random tag
how can i get category of material (on picture)
Idk
Ok
Please ping me if you respond to this
why
Is there a way to check if an item is created in creative
I’m going to sleep
just ask here lol
I couldn’t find anything on this
I'm not the only person on this discord channel lol
saw ur ping last time u deleted ur message
I don’t remember what I said
I was gonna ask a question abt the jukebox
Or compliment you for the cool idea
fair
I don’t remember
Anyway
Whoever responds to this
Ping me
How do I detect when a player takes an item out of the creative inventory
As the creative inventory is client sided
However the player cursor gets sent to the server (I might be wrong)
So how do I get when a item is sent from the creative inventory to the cursor
Inventory click doesn’t trigger
There's an event for that but its limited to client side just like u said
Same with inventory click event
But the cursor is sent to the server no?
Like I get that it’s client sided
But some things are sent to the server
Clicking on creative inventory isn’t
there are seperate events for creative, but limited
due to shitty design the server simply trusts a creative client
how do i export all dependencies of one module to one that includes it
i have something along the lines of
// hi/build.gradle
dependencies {
implementation 'a'
implementation 'b'
}
// another module
dependencies {
implmentation project(":hi")
}
how would i forward a and b to the other module
Integer.toBinaryString(int)
manually
wdym?
just trying to get an int from input and convert it to a binary with method
you would have to find the int's closest power of 2, subtract it and change it's nth place to a 1, rinse and repeat until you finish
String binary="";
while(num > 0) {
binary = (num%2)+binary;
num /= 2;
}```
Sorry
İ made this
dont think that would work
Why
idk give it a try it could lol
does a class have to extend JavaPlugin directly?
no right
the Carbon1181Bootstrap one is the one which will be set as the main class
not the abstract one as thats uninstantiable
No
okay so that will work
Isn’t carbon that old plugin
Neat
it will generate a resource pack with custom model data
All server side?
for texturing
yeah except the optional pack
Nice
but you will also be able to set the base material so it will make sense if you dont have the pack
for blocks it will send item frames with block items to the clients
so theyre not on the server
and modify the attributes for mining speed and stuff
of the player
yeah for the clients
but i will try to optimize the server side as much as possible
to at least not lag it to shit
I would use good old noteblocks
yeah but how many states can they have
and i might add a display strategy for it
because what if you want to add more than like 60 blocks
700 odd
yeah i may add a system for that
but ill make the item frame one the default
only thing is lighting which sucks
so i might look into note blocks more
yeah
if you can't use Integer.toBinaryString(int n) then you can try java int mag = Integer.SIZE - Integer.numberOfLeadingZeros(val); int chars = Math.max(mag, 1); if (true) { byte[] buf = new byte[chars]; formatUnsignedInt(val, 1, buf, chars); return new String(buf, LATIN1); } else { byte[] buf = new byte[chars * 2]; formatUnsignedIntUTF16(val, 1, buf, chars); return new String(buf, UTF16); }
Yes
wait, u can generate resource pack using plugins?
but changing the files ?
You could make a plugin that generates custom resource packs but the question you need to ask is why. It'd be much easier to create the pack manually and allow for configurations that go in sync with it. It's easier to update a config and a resource pack then it is to recompile a plugin every x days.
I have been thinking of making my own custom world generation but keeping the vanilla stuff
How would it be possible?
I want to modify the shape of the world generation
hey should i use String[] stringList or List<String> stringList
depends on the context
guys why im getting errors using spigot 1.8.8 jar
i can't access to methods
but it works on my other plugins
everything
just nothing works
see
I already tried to restart my editor and apparently it is not that
It needs to be in a method
wdym
for exmple in onEnable
Your IDE is complaining that those are not fields
When starting bukkit runnables (async) does it automaticly only use netty threads? (for example would it be bad if i started lets say 100 async runnables in 1 gt, would that start eating away on threads i dont want the server to use?)
what how
okay it works but
why in my other plugins I can outside?
but it works...
Could you show the code ?
It has a thread pool
those are variables
nice, i assume i can find it in the config somewhere?
no worries
i feel dumb now
What's the difference between plugin.saveConfig() and plugin.saveDefaultConfig()?
Doesn't saveConfig() save it to the file and saveDaultConfig() creates the config if it doesn't exist?
Pretty much
So when I create a plugin for an existing server I should create a custom config file? because saveDefaultConfig() won't overwrite the existing one
Or is the default config file creates specifically for my plugin?
For your plugin
I see , thank you!
does someone know whether this is true?
int.class == Integer.TYPE
just checked, it's true
that's good
do different dimensions run on the same thread?
yes
can you make them not run on the same thread
not without you creating your own fork
If you want them too have fun lol
no my point here is
computers nowadays have a stupid amount of cores
making every world run on a separate thread would significantly cut down lag
Go yell at Microsoft firstly
hello, how can I simulate a nether portal without actually a portal? I mean I want a command which will tp me to a nether location just the same as a portal would teleport me to
take location
I can divide the overworld coordinates by 8
location contains the dimension too
sometimes it won't tp me to a safe location
thats a issue i also had and found no solution for yet
and the way portal works is it always look for safe locations
go into the netherportal nms class and see how it does it 🤷♀️
there's a bunch of random tp plugins that check if the block is safe
you can look at those
wow php is the weirdest language ever
no shit
invalidstatement()
die();
results in an error message "unexpected token: exit"
although I used "die" and not exit
this is so stupid lmao
it gets better
you can do recursion in php
also they leaked the quellcode the other year
php 3.5 i believe
it's just a forgotten comma 😄
figured
I just wanted to share the weird error message
it says "unexpected token: exit" when the unexpected token is actually "die"
lol I was already like "who tf is that" lmao 😄
lmao
people always having a different name in the DM, DISGUSTING, I TELL YA!!!!!111one
its not resolving the jar
i ran buildtools and it has uploaded it to maven local
oh wait shit
with --remapped ?
yeah gradle is a bit weird
I think I should learn how to use properly use gradle, does anyone know a explanation?
yes. install maven
the docs are a bit weird and complicated
I know maven
then use it
but I want to learn both lol
i like the programatical approach of gradle
Gradle is really fast
gradle is what?
the ability to extend it from the build.gradle file
@glossy venture how are you going to run the maven-special-sauce plugin with gradle?
i know special source but i dont know special sauce what
Gradle is really fast
that's just my name for the special source plugin
wc
I've never seen how to run the maven special source plugin from within a gradle file
ah
but you dont need to right
oh wait yes you do
to remap it to the runtime names
fuck
ok hold on
or use paperweight
can you use that with spigot
ight ill look into it
you do da weird syntax thing and pray it works
you'll still be unsuccessfuly 3/4 of the time but
where can i find a good learning resource
apple are you kidding me
there doesnt seem to be documenetation
literally the only thing they added is some face id stuff my phone doesnt even support ands its 5 gigs
lmao
oop wrong channel lmao
about what?
graddle
using paperweight-userdev with spigot mojang remapped
Don't use gradle you fool...
in gradle
They have an example repo
But wasn't the example repo on how to build a paper fork?
Nah
ah
test plugin
Should hopefully suffice
wait are there full member mappings from before mojang mappings
cuz in the actual server jar just some stuff is mapped
now it cant resolve the plugin
you need to declare some repositories in settings.gradle.kts
just reverse the mojmap
A few do yes
not the same classes every version
i learned that when i tried reversing maps for 1.19
But yeah, for eclipse using groovy dsl is more reasonable
You need to pick the right mapping version
both suck 💩
ok i got it
Nooooo
bruuuuuh
Eclipes's groovy dsl integration is relatively good outside of no autocomplete
Ah yeah, so in case you vibe with eclipse groovy dsl is the way
There is no eclipse kotlin dsl to speak of. So it's either groovy, maven or JDT
🥲
Hi, everyone
Do you know why letters are broken in game?

No
&kWhat do you mean
I personally have become antiquated with JDT lately - and man is it cool as long as you offload the actual build logic to another application
Hmm fair
bro its downloading and remapping paper for every module
I haven’t used Eclipse in a great while, but honestly it’s not that bad just that I disliked the user interface
shit
Lol
is the remapper still slow?
yeah kinda
Korean is broken in game
make sure you use UTF-8
do you have utf 8 encoding
javaCompile {
options.encoding = 'utf-8'
}
``` i think its something like that if you are using gradle
Anything else is prone to issues a la "Why is there chinese in the event logs"
Ah ha, I'm using maven
Use Java 18, it has utf-8 by default
sure it's bleeding edge but it shouldn't be all too bad considering it should be released soon iirc
im pretty sure you can do that in maven too
Is there any event for when a fall back server is stopped??
I just know that you can set the file encoding of resource files
is 4 and a half minutes a good time to be at decompile transformed minecraft server jar
its using so much cpu
woah
Forgeflower can be pretty slow, but it's still magnitudes faster than IntelliJ-decompiler (Fernflower)
is forgeflower a fork
Perhaps they are using Quiltflower now, idk
of fernflower
Yeah
nah theyre using forgeflower
Forge's fork of FF
i saw it downloading it
procyon better
doesn't even java 8 have that by default too?
Well Java 18's changelog has something around the lines of "now using UTF8"
add to <properties>:
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Standardize on UTF-8 throughout the standard Java APIs, except for console I/O.
Smh
Thanks very much, it works
anyone remember the utf 8 plugin awareness in plugin.yml? 😄
name: Plugin
...
awareness:
- !@UTF8
I think some of my plugins still have that lol
When was this a thing? Never heard of that.
it still exists
?jd-s
declaration: package: org.bukkit.plugin, interface: PluginAwareness
declaration: package: org.bukkit.plugin, interface: PluginAwareness, enum: Flags
beat me to it
I remember it was not deprecated in 1.8 but it was in 1.13
yeah it was made deprecated in 1.9
never done that even for 1.8 plugins 😄
it wasn't needed for anything and also didn't do anything
not fully correct if i recall, caused chat issues - UTF8 and UTF16 do not play well if the host is UTF8
Is there any event for when a fall back server is stopped??
probably not as how would the proxy know that?
Oh! You're right, my question is wrong...
should be a connection timeout, but that likely not to be an event
I should ask if there is any event to check when a player gets kicked from fall back server
oh sure, ServerKickEvent
Ah! Nice, that is what I was looking for. Thank you 🙂
new plugin idea: using /reload kills the server to make people learn to stop using it
Runtime.getRuntime().halt(-1);
https://bugs.mojang.com/browse/MC-2215?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel&showAll=true one of the bugs that may still exist and is specific to UTF-8
the plugin awareness in plugin.yml did never do anything, the classes javadocs already specify that they are just flags to inform about what the developer of that plugin has done
Gives a set of every PluginAwareness for a plugin. An awareness dictates something that a plugin developer acknowledges when the plugin is compiled
while(true) {
System.out.println("idiot");
}
so whether or not that flag is set will not make any bugs disappear or make utf8 magically work now, nor does the flag missing break anything
true

ideally, don't use nms xd
i want storage on items accessible by the client
whut?
so yeah i would prefer to use nbt
why don't you just use PDC
takes me around 4mins for the entire process to finish, but that's on a pretty strong cpu
it seems more complicated, but i could be wrong
ill try in a sec
pdc is easy
well not really, PDC is pretty simple to use
there's also an nbt api for this
is it more effiecient on storage and memory
it's basically an API for nbt
so internally it also uses NBT
yes
what
how do i use it on item stacks
get the ItemMeta
ah
then getPersistentDataContainer
ah
thx
ok it seems alright only thing i dont like is how it has to compile to nbt afterwards and how you need namespaced keys
i guess ill give it a try
this looks very intimidating
even through i wrote it
but does it have javadoc