#help-development
1 messages · Page 1089 of 1
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
He did put his code above, but yeah some more could help idk how you have this implemented entirely
for(int i = 1; i <= amount; i++) {
Bukkit.getScheduler().runTaskLater(Main.getInstance(), () -> {
if(!player.isOnline()) {
break;
}
if(player.getLocation().distance(LabManager.getLabLocation()) > 6) {
player.sendMessage("You moved too far away");
break;
}
ItemStack ingredient = findIngredient(player, Material.KELP);
if(ingredient == null) {
break;
}
ingredient.setAmount(ingredient.getAmount() - 1);
addItemAndDropExcess(player, ItemManager.getKelpProduct());
player.sendMessage("Processed 1 Kelp (" + i + "/" + amount + ")");
}, 200L * i);
}
player.sendMessage("Done Processing");
m.setIsProcessing(false);
ok thats bad
hi guys
the problem is that those breaks dont work
how to use entityCreature in nms 1_12_R2?
break will not stop a task
I know
in nms 1_16_R3 we can change the entitytype by super(EntityTypes.<VANILATYPE>, world)
I just put my old code in the task so thats what I have now, dont know what to change it to
this.cancel()
ah
and return
also multiple tasks fired inside a for loop is very bad for performance
okay
do one task to handle them all
but I would need to use sleep
no
because the player is processing a stack of items and each item takes 10 seconds
and they are processed one at a time
you run a repeating task with a 10 second delay
each pass you process one item
just a variable outside the run() method to keep track of how many passes
You could do the recursion method like I said, then you can break it within the runTaskLater
ok
could you give me a simple example of how that would work?
so keep that runTaskLater in it's own method, then you would do something along the lines of
processMethod(amountLeft) {
runTaskLater() {
if(!isProcessing || amountLeft == 0) {
return;
}
///...process stuff
processMethod(amountLeft-1);
}
}```
okay sweet that makes sense
Something along the lines of that, you'll likely need to tweak it for your use case but it's roughly what I was getting at
You're welcome!
o/ everyone
O
hey quick question whats the best way to have a plugin that creates a "world" custom for each player is it just to create a new one each time or maby create a insland every 100k blocks?
Spot the zeroOOOOOOOOO0OOOOO0OO0OOOOO
XD
For a plugin im working on I need to give players the sight of the mobs but the only way I know how to do it is by first creating the entity, sending the camera packet and respawning the player. I wanted to know if there was any way to do this without respawning the player as it creates a deathmessage and a noticable effect where the players inventory is cleared and repopulated.
if (!playerModel.isTrippingOnStarbrew()) {
LivingEntity scope = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), this.plugin.getPlayerManager().getRandomEntity());
scope.setAI(false);
scope.setInvisible(true);
PacketContainer setCamera = new PacketContainer(PacketType.Play.Server.CAMERA);
setCamera.getIntegers().write(0, scope.getEntityId());
try {
this.plugin.getProtocolManager().sendServerPacket(player, setCamera);
} catch (Exception e) {
e.printStackTrace();
}
Location loc = player.getLocation().clone();
player.setHealth(0.0);
scope.remove();
player.spigot().respawn();
player.teleport(loc);
}
Is there a way to do it without respawning the player or similar?
World loading will lag out your server. Creating a big world and then giving each player a custom worlborder is probably more efficient.
There are other world formats which could be used instead.
Hey guys!
I need a little help. I'm new to the custom events and everybody is telling me it's really easy. And still... I'm struggling a lot...
So, first let me explain my use case. I want to create a plugin which listens to all bukkit events like block break, block place, ... and call more specific events. For example when you break coal ore you should trigger a custom event called CoalBreakEvent. On top of that logic I will add serveral extra checks like for example: "is the block placed by a player?". I want to use those events across 4 different plugins of mine. Right now they all have the same logic copy pasted, and when I find a bug I have to change it in 4 places. that's the main reason why I want to move it to a seperate plugin. On top of that I assume it will be better performance wise to only listen once to each general event and do my calculations one time.
Now... I started a proof of concept where I created 2 new plugins. One plugin (let's call it ProviderPlugin) contains a custom event which is triggered when I break an iron ore:
public class BlockBreakEventListener implements Listener {
@EventHandler
public void onBlockBreak(BlockBreakEvent e) {
System.out.println("Block break event triggered");
if (e.getBlock().getType() == Material.IRON_ORE) {
System.out.println("Iron ore broken");
Bukkit.getPluginManager().callEvent(new IronOreMinedEvent(e.getPlayer(), e.getBlock()));
}
}
}
When I uploaded this to my server it prints out both messages.
Then I created a second plugin (let's call it ConsumerPlugin). This plugin imports the jar of the ProviderPlugin so I can use the custom event. I created a listener for that event like this:
public class IronOreMinedEventListener implements Listener {
@EventHandler
public void onEvent(IronOreMinedEvent e) {
System.out.println("event received!");
}
}
But this event is not triggered when I mine an iron ore. (FYI: the listener is registered in my main class)
I already checked the loading order and can confirm the ProviderPlugin is loaded before the ConsumerPlugin (since ProviderPlugin is a softdepend of the ConsumerPlugin).
I managed to make it work by also registering the BlockBreakEventListener of the ProviderPlugin inside the ConsumerPlugin. But this is not actually what I would like since then I still have to call the general listener multiple times (and therefore run the logic multiple times) which wouldn't improve my performance at all. Not improving performance sounds like a bummer to me.
Anyone who sees my error? Or is what I want to achieve not possible at all?
Thanks in advance!
Did you forget to register the IronOreMinedEventListener
I did in my TestPlugin: https://paste.md-5.net/jiganocofe.java
Any errors? Also how are you depending on the base plugin
I'm using Intellij, I added a new folder at the same level as my /src called /libs. Inside there I added the jar of my BasePlugin. By right clicking on that folder I added it as a library via "Add as library"
So you're not using a build tool like maven or gradle
and you said it works if you register the listener in base plugin from test plugin?
If so make sure you're not running an old jar of base plugin and ensure that it's actually registering
For my proof of concept I didnt just to get something real quick. In the end it's extracting the same jar to my artifact this way. I will try to clean all versions and retry in a few minutes.
Yes it does. But then it's triggering the logs twice since I'm listening twice
I don't really see anything wrong with what you've provided 🤷♂️
use slime worlds to create small per player worlds
But you know it should work this way right?
What r some good command libraries (using annotations)
Command API is too huge (almost 1 meg shaded)
And I don't like acf
Then Cloud is probably the last remaining option
make your own
it's pretty easy
no time
and you can customize to your likings
i already started working on one but yh lack of time
If you want inspiration, I also made for myself, a while back
Hypixel skyblock remake. Contribute to Sweattypalms/skyblock-remake development by creating an account on GitHub.
Looks like command api is on central
ah it depends on NBT API
but that can be provided as a dependency plugin instead of shaded
bumb
it's also on central
✅ Threw out old jar, rebuilt and added new jar to both my TestPlugin and server.
✅ Verified by adding extra event handler in the same listener (which is printing its messages)
🙄 just decompile your own code smh
Is there an easy way to do this without having to push my jar somewhere like on github packages? I always feel like it's way too much effort to get them on there for proof of concepts.
you can still import raw files with maven / gradle
Sometimes one needs a little compileOnly(fileTree(dir: 'libs', includes: ["*.jar"])) or whatever
mvn install:install-file
And if you have to manually include a jar in your project, then there is a good chance that its not worth it.
Most proper libraries are accessible via some repo.
Yeah for sure, I'm just trying to reproduce my problem in the most minimal scenario so I strip out all other possible errors.
It's nothing permanent 🙂 Just wanting to make it work so I know it's possible
bro really used colons
Well actually I know it's possible since I use apis with custom events. I just cannot recreate it 😦
that's not how named params work
I use gradle groovy
what a fucking nerd
can I just set a block in a world even when the chunk is not loaded?
yes, load it first
how can I even get the chunk from x,z cords
divide by 16
wouldnt that work
only if x and z are chunk coords
ok
public static void createNewIsland(Player player) {
World world = Bukkit.getWorld(Objects.requireNonNull(instance.getConfig().getString("worldName")));
if(world == null) {
player.sendMessage(instance.getPrefix() + "§cEs gab einen Fehler bitte melde das an das Team.");
instance.getLogger().log(Level.SEVERE, "OneBlock Welt nicht gefunden!");
return;
}
Block block = world.getBlockAt(instance.nextX, 100, instance.getNextZ());
block.setType(Material.COBBLESTONE, true);
world.getChunkAt(instance.getNextX() / 16, instance.getNextZ() / 16).load();
Island island = new Island(player.getUniqueId(), block.getLocation().add(0, 2, 0));
instance.playerIslands.put(player, island);
}
``` so like that?
no, you need to load it before you get any block
yes. Check if its loaded before you load, just in case
no point in loading if it is already loaded
is it possible to write unmodifiable text in a sign?
I'm using https://github.com/Rapha149/SignGUI
You could probably add pdc to the sign then check for some sort of manipulation event, if it’s your sign, cancel the event
add pdc?
wdym?
it's not an actual sign
it's just some packet stuff
Is it your api?
as in the client window?
if so no I don't think so
I added those projects to a github repo (https://github.com/m4ndsr/POC-CustomEvents) and added a maven dependency. Is there anyone who can guide me on how I will be able to listen to the IronOreBrokenEvent from the ProviderPlugin inside my ConsumerPlugin?
Right now the output is the following:
[17:52:42 INFO]: [ProviderPlugin] [STDOUT] Block break event triggered
[17:52:42 INFO]: [ProviderPlugin] [STDOUT] Iron ore broken
[17:52:42 INFO]: [ConsumerPlugin] [STDOUT] listener is registered
-> So the event should be called and the listener is registered for sure.
consumer plugin should have providerplugin as provided dependency
otherwise it will be shaded and cause issues
If so, it didn't resolve the issue sadly
yeah like that
also I just tested your plugin
it works fine
I am making a replay system. I made an architectruy:
/record player
first we should get the envrionnement (all blocks in a 25 bloc radius) and all entities. Then we wait our player packets and load it as a list and all packets which concerns what surrounds the player. to replay it we just reproducte "inverted" packets.my system is good?
Ah crap, then I'm doing something wrong during my build because it's not for me 😦
Oh my bad, didn't change the output directory when I added that scope 🤦
Thanks a lot!
I downloaded supervote plugin and superbvote, when i start the server it says org.bukkit.plugin.UnknownDependencyException: Votifier, i downloaded 3 notifier plugins but still dont work. solution?
I used both..
alr
If I kill a player with the in ventory open, is inventorycloseevent called after playerdeathevent and before playerrespawnevent? even in playerdeathevent having spigot.respawn?
Same time cant happen. Everying in minecraft is called sequentially. I would assume the InventoryCloseEvent is called before the PlayerDeathEvent.
Ah
🤡
if this happens is a problem .-.
How so?
I know but I just thought it was funny
in fact there won't be a problem, it will just be executed "for nothing"
yes
any ideas?
because the close is called to save the items in the backpack and after the playerdeathevent occurs I will clean the backpack, understand
You remember that gongas kid?
Remind me of context
That 1.8 pandaspigot kid
Oh yeah kek
That's him
It’s all coming together
how can I use block pdc to store a searilized string
block pdc?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
but Im to stupid to understand the text ngl
weirdo
How would I go about adding a second line on a nametag, do I just have to use an invisible entity with a name?
@peak depot
private final JavaPlugin plugin;
private final NamespacedKey key = new NamespacedKey(plugin, "some_key");
@EventHandler
public void onPlace(BlockPlaceEvent event) {
Block block = event.getBlock();
String serializedString = "...";
PersistentDataContainer data = new CustomBlockData(block, plugin);
data.set(key, PersistentDataType.STRING, serializedString);
}
Yes
Or use a text display which can have multiple lines
Is there an api to do it easily, also can you elaborate on text display, never heard of that before
Display entities are entities useful for map or data pack creators to display various things. There are Block Displays, Item Displays and Text Displays, which are used to display blocks, items and texts respectively. They can be created only with the /summon or /execute summon command.
oh wow since when was this a thing
1.19.4
hehe
go back to shitty internet
whaaaa
kek
not fair
:(
Hello everyone,
I’m looking for a Minecraft plugin that would allow me to do the following: I’d like to be able to add a texture to the plugin's (or server’s) files, then select a glass pane or a fence, and apply that texture with a command like /settextureglasspane {filename}.
I’m open to using a resource pack as long as the process isn’t too complicated, considering that I also use ItemAdder. If anyone knows of a plugin that can do this or could help me create one, I would be very grateful!
Thanks in advance for your help!
not rly possible
maybe you can update resource pack on runtime and send packet to update the resourcepack
Someone i know got it, but he don't want to give me it
don't
why not
takes ages
What
Loading the pack takse ~5s
On average
You'd need to hardcode the models
Bad player experience
It’s possible if we tell you, that’s crazy!
I've already seen this on other servers so don't talk if you don't know, thank you very much
:))
If you've ever played MC on low end PCs it can take 20 seconds
I do kinda know what I'm talking about lol
Just tryna help you buddy
Rad getting trashed on
They know you're a stinky kotlin dev rad :p
You should be the one getting trashed on since you don't know how to code in console
smh
shut
lmao
Pack reload is not a problem
It kinda is tho
You make me laugh rad
Terrible experience for users
At worst, just how to add glass pane without removing vanilla?
bro stop the dev and go to macdo to be a cuisto of nuggets
Just make custom models
Hey hey buddy I'm just telling you that it sucks for users
Its vanilla bro
No need to be rude as fuck
I'm gonna have a stroke
and I'm bringing you with me rad
let's go everyone to macdo 🤓
Its vanilla , without mods
shut up go sleep
Well that's what ItemsAdder does
It creates custom models in the resource pack
Clearly a skill issue
We have itemsadder but the glass pane does not work
Well it doesn't do that for you kek
Kiss my ass <33
can someone help me out?
https://paste.md-5.net/etuqamejam.cs
this method rotates the head but does not translate the body
sure buddy
Hello no sorry
Thx baby
rad can give u next month when he worked at macdo 🤡
@young knoll hey dude do you fw this guy
ty for ur time
i love you rad
On the other hand, don't break your balls and send me a plugin to add 15 glass pane to minecraft
I have a letterkenny sticker just for this case hold on
true
Shut up 🤓
Nobody if you're being rude like that

For a plugin im working on I need to give players the sight of the mobs but the only way I know how to do it is by first creating the entity, sending the camera packet and respawning the player. I wanted to know if there was any way to do this without respawning the player as it creates a deathmessage and a noticable effect where the players inventory is cleared and repopulated.
if (!playerModel.isTrippingOnStarbrew()) {
LivingEntity scope = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), this.plugin.getPlayerManager().getRandomEntity());
scope.setAI(false);
scope.setInvisible(true);
PacketContainer setCamera = new PacketContainer(PacketType.Play.Server.CAMERA);
setCamera.getIntegers().write(0, scope.getEntityId());
try {
this.plugin.getProtocolManager().sendServerPacket(player, setCamera);
} catch (Exception e) {
e.printStackTrace();
}
Location loc = player.getLocation().clone();
player.setHealth(0.0);
scope.remove();
player.spigot().respawn();
player.teleport(loc);
}
Is there a way to do it without respawning the player or similar?
mhm mhm
@blazing ocean do you like?
BROO
What the fuck
@blazing ocean I LOVE YOU BRO I LOVE YOU HARD FUCK ME
right what the fuck
Its multiverse
It's from the show letterkenny lmao
I thought he already did
can someone help me dawg
I'm laughing out loud
kat vc?
I guess but just for a bit
Also, when using entities or text displays, if a player is on 200ms ping or something then the second name will be delayed right
very good, thank you sir
but I dont think it matters in the case you are describing
https://paste.md-5.net/etuqamejam.cs
this method does not translate the body
if the player is lagging their position wont be up to date so the old position is still used
resulting in like the same thing
but its just more efficient to use the passenger system
its fine
does anyone know how to translate the body?
public void saveIslands() {
for (Island island : islands) {
UpdateValue values = new UpdateValue("UUID", island.getOwner().toString());
values.add("location", Serializer.locationToString(island.getSpawn()));
values.add("oneblock", Serializer.locationToString(island.getOneblock()));
instance.mySQL.rowUpdate("oneblocks", values, "UUID = '" + island.getOwner() + "'");
getLogger().log(Level.INFO, "Saved " + islands.size() + " Islands");
}
getConfig().set("nextX", nextX);
getConfig().set("nextZ", nextZ);
getConfig().set("worldName", worldName);
saveDefaultConfig();
}
``` why isnt the saveDefaultConfig saving the values for nextX, nextZ and worldName
because it's saving the default config from the jar
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
there's a saveConfig() method iirc
^^
this.getConfig.saveConfig();
yeah thanks
the clientboundmoveentitypacket does it have a range where it will not move the body?
@ivory sleet do u have any idea?
yea I mean there is certain logic for when we expect to send a rot packet, pos packet or rot+pos one
idr exactly tho
Anyone know how to parse the <bounty> placeholder using minimessage, my code:
ColorManager.mm(plugin.config.getString("bounty-name-tag") ?: "<gold><bold><bounty>g Bounty")
@JvmStatic
fun mm(string: String): Component {
val component: Component = miniMessage.deserialize(string)
return component
}
iirc yea
Placeholder.component("bounty",blah)
u pass that to the deserialize() method
there's also some other static factory methods on Placeholder which may suit ur needs even more
textDisplay.text(ColorManager.mm(plugin.config.getString("bounty-name-tag") ?: "<gold><bold><bounty>g Bounty"), Placeholder.parsed("bounty", player.name))
Surely this should work then
But I get this error
None of the following functions can be called with the arguments supplied.
text() defined in org.bukkit.entity.TextDisplay
text(Component?) defined in org.bukkit.entity.TextDisplay
ehm well
i think u pay wna add paper api on ur classpath as thats what it looks like u wna use
yeah i am using paper api
also ye
u should pass the placeholder thingy to the deserialize() method, not the text() one
oh right
Yes there is a range, maybe around 8 blocks I’m not sure, if you want to use it higher than that, teleport is the way.
Ok
What are you confused about?
does minimessage.deserialize not return a component
it does
^
i think?
I thought it did too
thats what TExtDisplay has
yet this wont work
textDisplay.text(ColorManager.mm().deserialize(plugin.config.getString("bounty-nametag") ?: "<gold><bold><bounty>g Bounty"), Placeholder.parsed("bounty", bounty.toString()))
should work fine
public class ColorUtil {
private static final LegacyComponentSerializer LEGACY_SERIALIZER = LegacyComponentSerializer
.builder()
.character('§')
.hexCharacter('#')
.hexColors()
.useUnusualXRepeatedCharacterHexFormat()
.build();
private static final MiniMessage MINI_MESSAGE = MiniMessage.miniMessage();
public static String convertLegacyColorCodes(String text) {
return ChatColor.translateAlternateColorCodes('&', LEGACY_SERIALIZER.serialize(MINI_MESSAGE.deserialize(text)));
}
}
...
public void displayTitle(Player player, Title title) {
World world = player.getWorld();
Location location = player.getEyeLocation();
String titleContents = ColorUtil.convertLegacyColorCodes(title.getTagContents());
TextDisplay textDisplay = world.spawn(location.clone(), TextDisplay.class);
Vector3f offset = new Vector3f(0, 0.15f, 0);
AxisAngle4f rotation = new AxisAngle4f();
Vector3f scale = new Vector3f(0.75f, 0.75f, 0.75f);
Transformation transformation = new Transformation(offset, rotation, scale, rotation);
textDisplay.setText(titleContents);
textDisplay.setBillboard(Display.Billboard.CENTER);
textDisplay.setBackgroundColor(Color.fromARGB(0x80333333));
textDisplay.setCustomNameVisible(false);
textDisplay.setPersistent(false);
textDisplay.setSeeThrough(false);
textDisplay.setShadowed(false);
textDisplay.setInvulnerable(true);
textDisplay.setTransformation(transformation);
this.activeTextDisplays.put(player.getUniqueId(), textDisplay);
player.sendMessage(ChatColor.GREEN + "You have just equipped the " + ColorUtil.convertLegacyColorCodes(title.getDisplayName()) + ChatColor.GREEN + " title!");
player.addPassenger(textDisplay);
}```
This is what I do and it works fine
assuming u're not like... relocating and shading adventure
oh i think i know the problem
the thing i passed into deserialize can be null i guess
so it says text(Component?) isnt found
myea
but i thought adding this ?: "<gold><bold><bounty>g Bounty" would make it not nullable
I mean not sure how @Nullable is tolerated
but u can always just make it non nullable
then it should def work, right?
Or at least return you a (somewhat) descriptive error kek
void
text(@Nullable Component text)
Sets the displayed text.
javadoc says its nullable
im so confused
I mean yea then it should work, secured
why does it say this then
None of the following functions can be called with the arguments supplied.
text() defined in org.bukkit.entity.TextDisplay
text(Component?) defined in org.bukkit.entity.TextDisplay
Because Spigot doesn't support them natively
im using paper
whatever mm.deserialize returns
That's supposed to return Component
yeah
val textDisplay: TextDisplay = player.world.spawnEntity(location, EntityType.TEXT_DISPLAY) as TextDisplay
textDisplay.text(ColorManager.mm().deserialize(plugin.config.getString("bounty-nametag") ?: "<gold><bold><bounty>g Bounty"), Placeholder.parsed("bounty", bounty.toString()))
Oh god I need to reformat that for myself to be able to read it
Why whats wrong with it
deprecated on paper
ah
fluent accessors and mutators
I mean that does look about right
nah surely the IDE is being dumb right
Possibility sure
:,)
oops kek
This is why you format shit properly
uh i dont think i did
lil karma :,)
but yea nice its solved now :P
this exact code is working rn
after invalidating caches and restarting
wait no its not nvm just took a while to load
Closing bracked is on the next line?
im still confused do i just add another )
cuz that doesnt work
maybe minimessage isnt support on kotlin or smth
idfk
No wait
This parenthesis is misplaced
You're just passing in the component and placeholder to text()
totally right
thanks man
textDisplay.text(ColorManager.mm().deserialize(
plugin.config.getString("bounty-nametag") ?: "<gold><bold><bounty>g Bounty",
Placeholder.parsed("bounty", bounty.toString()))
)
fixed it appreciate it rad
thought i was going insane
w rad
fax w rad
Rad with the eagle eyes man
that error should have definetly been more descriptive
Well that's why we implement our own errors eh?
well yeah you actually gotta do it kek
maybe one day
I mean I thought itd say sth like there's no such method signature text(Component?, Placeholder)
No, IJ is a dumbass
Real
cuz IJ normally makes the sun shineeee :)
We should all embrace the kotlin
lmao
Why not just complain about everything there is to complain about?
alright enough self promotion now
Surly this is helpful
yea true
I'm kotlin? W
i started kotlin today and im LOVING it
data classes are my favourite part so far
real life stacktraces every time something happens thats complainable
ew rad has a new lover
:D
Dude imagine kek
large red text just appears above someone's head when they don't understand a concept
lol
Hello everyone,
I’m looking for a Minecraft plugin that would allow me to do the following: I’d like to be able to add a texture to the plugin's (or server’s) files, then select a glass pane or a fence, and apply that texture with a command like /settextureglasspane {filename}.
I’m open to using a resource pack as long as the process isn’t too complicated, considering that I also use ItemAdder. If anyone knows of a plugin that can do this or could help me create one, I would be very grateful!
Thanks in advance for your help!
Brother you've been told that it's not possible without a resourcepack reload several times now
u say it was possible whit itemadder
i was trying to build craftbukkit, and i got an error because I didn't have bukkit installed (it couldn't find it on the remote)
so I built and installed bukkit to my repo
I see it's in there
Told you several times already too
but maven is still saying it can't find it in my craftbukkit project
Learn to read lol
re tell me im idiot
Brother 💀
reposting over and over and over and over doesnt help
BRO
@ivory sleet
can you please shut the fuck up
mr lube my savior
what a desperate lad
hey there I'd like to make a plugin that when you run /setglasspane <texture> it grabs a texture from
lmao
not the textures!
Why should it not be possible, just reserve a block state for each of those textures
A block state of what
They want to dynamically set it to a specific texture specified
Yeah, just set the block when that command is run
Set it to what
Basically anything you want, could be a plain block, could be a noteblock state
How does the server know what blockstate it is based off a new texture that you give it
Like that texture isn't in the pack yet
How tf does that work
Of course you'll need to add it to the pack and have a configuration for it
Noteblocks aren’t transparent
Well that was the entire point...
He said he was already using ItemsAdder?
Well yea
But the point was to do it dynamically at runtime
Which would require a pack reload
No idea why you would need to do that, at least that‘s not what I‘m reading from his messages, maybe there was some other stuff before that idk
hey guys I have a custom event which i call using this
Bukkit.getServer().pluginManager.callEvent(BountyChangeEvent(player, oldBounty, newBounty))
but my Listener never picks up the call
is this not the way to call events?
yea
sorry its in kotlin
forgot to mention
well im just wondering PluginManager#callEvent is correct because it doesnt seem to work
did u define the handlerlist and everything?
idk really
class BountyChangeEvent(
val player: Player,
val oldBounty: Int,
val newBounty: Int
) : Event() {
private val handlers: HandlerList = HandlerList()
override fun getHandlers(): HandlerList {
return handlers
}
companion object {
@JvmStatic
fun getHandlerList(): HandlerList {
return HandlerList()
}
}
}
this is the class
handlers need to be singletoned
so make it a field in ur companion object
w @JvmStatic as well
okay ill do that and test
its very useful
yeah the event works now thx
:P
How would I create private/"user specific" variables? I'm trying to do a toggle private messages command but I still haven't figured out how to create a "private" variable so could anyone help me with that?
usually u define some class that holds the variables, and then u create an object per player of that class
or if there's a readable guide somewhere or something a link to that would be appreciated
why doesnt my textdisplay turn around to where the player is looking, do i need to use a billboard, if so which one?
center
I mean the closest hints I can give you is like, understanding classes and objects, understanding instances and new-keyword and understanding HashMaps Ig
alright thanks appreciate it
@foggy cave
oke thanks
quick question, it had 2 lines the first said Text Display and the second was my custom text
whys that
oh ok
textDisplay.setCustomNameVisible(false);
this line to be specific
yea thx
is it possible to write unmodifiable text in a sign?
I'm using https://github.com/Rapha149/SignGUI
singleton or static which to choose hmm
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
i mean usually singleton implies static as well
at least the canonical singleton pattern
that's a weird question
I mean
singletons utilize the static keyword
di is easy and usually better than a singleton in most cases
if you mean whether to static abuse or to use a singleton
Depends on the use case I suppose
then use a singleton, or dependency inject
singletons can be abused as well but mye
wdym?
unless u're heavily deviating the singleton pattern, u prob wna ensure the global access through static
https://imgur.com/a/YaLPSHp
does anyone know why i cant see my own nametag?
conclube can you give an example of singleton abuse?
well I mean, u can abuse singletons as much as u can abuse static itself
Kotlin objects ❤️
the client doesnt show you your own nametag iirc
how do I know if I'm doing it?
Conflicts with location of original nametag, and text display
factual
Make a translation that puts it just below or above the name tag
oh, it works on my other instance where its lunar client but on vanilla it doesnt show
eh I mean if ur code becomes messy to unit test, or just if ur singletons get in the way
Oh that's normal
real
this is what it looks like on other client
wouldnt using singletons make it messy to unit test in the first place?
yes
If you have an alt, log in with both and see if they overlap
this is the vanilla client looking at the lunar client one
nametags are just fully hidden on the vanilla one
anyway sure, minecraft has a singleton for sneaky throwing
I'm pretty sure vanilla, you cannot see your own nametag
^
arguably abusing the pattern, I mean sneaky throwing is as simple as a static method
mfw MinecraftClient.getInstance()
But do this, how I fixed that sorta issue
yeah but it cant see the other ones nametag
that one is more reasoned for
Yeah ig
Do this
Just do a translation
oh is it overlapping ?
Lemme check mine rq
i mean u can also write terrible singletons in kotlin
prob
not like the language matters much
If you do the exact translation I do, it shows up just below the players name
why doesnt it overlap here
Yes
Probably some lunar fuckery
yeah prob
where do i spawn the nametag btw, i just do it 2 blocks higher than the players feet
i mean its pretty much the same as abusing anything, ofc its highly subjective to style and paradigm
If you follow my example, that puts the display just below the players name tag and does not cause those overlapping things
ok thanks im not gonna test tday its getting late but ive noted it down for tmr
appreciate it
Sure!
is this abuse
if (defaultConfig.contains(path)) {
config.set(path, defaultConfig.get(path));
saveConfig();
plugin.getLogger().info("Config section reset to default: " + path);
} else {
plugin.getLogger().warning("Path does not exist: " + path);
}
}```
```ConfigHandler.getInstance().resetToDefault("database.name");```
I'd say yes
Little cool thing I do is actually make the display smaller so I have more room to adjust it
but up to u
i will search out my errors and become better thank you
lol okay good luck
Chad behavior right there kek

we can discuss whether usage of singletons to that extent is abusing :>
Better abusing something in a single class than having a massive code base, people arent crying over Until classes having too many static methods are they? It makes everyone life easier
True util is only static
Exactly
at that point ur code probably contains a lot of throw away objects, which is just useless
idec about static abuse when writing kotlin, ngl
I use objects SO fucking much
But I just cannot care
tbh following the pattern set by those before us is the only way to do it
junk in the ecosystem is bad right
Hard no
constants, static factory methods, nested classes, singletons, conservative helper methods
😄
You can do it with object?
not sure if thats true
It's def not lol
i mean it may not be false, but neither is it true
How do we figure if something is better? We try new things and sometimes those new things suck sure, but there are the cases when you figure something out and it's actually just better
The only thing you need to follow is common sense, throw all elements that do X in one location and dont make 10 nested ifs and use guards when possible
😄
i feel like static abuse in kotlin is mainly if u use too much companion objects, but like, u tend to abuse other things in kotlin instead like extension functions
Pfhhh they are not abuse
A single file manager class can save you a lot of time, same as sql class
I have so many top-level functions too
yea, what defines whether something belongs to the solution set, or is just another subset of the problemset?
Not sure how the compiler handles those
Oh yeah that is possible, i try not to use those
Fair enough, guess it depends more on the use case for sure
I love doing this shit
Is launch for couroutine the same as run async?
Idk I still think the best way to learn is just to try things out, whether it be through following a guide or just blindly playing around
Forgot coroutines a bit
Well it just launches a job
I really don't know a shit ton about coroutines but there's also GlobalScope.async
No idea what's the diff ngl
definitively, just following theory won't help that much, at the end of the day even principles like single responsibility principle requires a lot of hands-on experience to pull it off correctly
Yeah for sure
I wanted to dev all stuff with kotlin at the start as it was easier, but some plugins dependencies straight up break when i load kotlin up
Wdym
I certainly still have trouble with SRP kek
🤷 Without a stacktrace it's hard to tell ya
Well when it happens will give a log pastebin or smth
For a plugin im working on I need to give players the sight of the mobs but the only way I know how to do it is by first creating the entity, sending the camera packet and respawning the player. I wanted to know if there was any way to do this without respawning the player as it creates a deathmessage and a noticable effect where the players inventory is cleared and repopulated.
if (!playerModel.isTrippingOnStarbrew()) {
LivingEntity scope = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), this.plugin.getPlayerManager().getRandomEntity());
scope.setAI(false);
scope.setInvisible(true);
PacketContainer setCamera = new PacketContainer(PacketType.Play.Server.CAMERA);
setCamera.getIntegers().write(0, scope.getEntityId());
try {
this.plugin.getProtocolManager().sendServerPacket(player, setCamera);
} catch (Exception e) {
e.printStackTrace();
}
Location loc = player.getLocation().clone();
player.setHealth(0.0);
scope.remove();
player.spigot().respawn();
player.teleport(loc);
}
Is there a way to do it without respawning the player or similar?
yea, like all these paradigms, theories, principles, rules, conventions, its all abstract. And when someone tries to make it absolute, it ends up sucking ass. Just look at clean code "a function must only do a single thing", like noway I'd be making every function 4 lines.
One thing i love about kotlin is guards for null checks, literslly just
variable ?: return
yes
Well that's why I love this quote from my java bible: "No method or function should be considered "good" until rewritten at least 3 times"
lol
When using triple backticks if you put "java" in the first row of triple backticks it hightlightes the corresponding language syntax
Not reading it like that lmfao
I've just been cluttering the brawls API with this shit
thought I did sorry
its refreshing getting a developers
take
wha
They did
It does have it?
It's a really fair quote though, made me understand that optimization is always possible
lol wym?
If your on discord mobile it doesn't support syntax highlights for whatever reason
Maybe phone
your head is on straight, it seems like you are the computer
Mobile doesn't have that for some reason
oh I wish I could compute like a computer
or the computer is apart of you.
would be quite the blessing
man I love ?: run { /* ... */; return }
you dream of code
They can push 900 gui changes in a month but cant get their app to work normally lol
Is List<String> togglePM = new ArrayList<String>(); considered as a hashmap?
I feel like this will be the fall of humanity, begin the age of ai already
instead of yapping about how discord mobile is shit can u help me 🙏🏻
https://www.youtube.com/@dreamsofcode mentioned!?!?!
No
yea, I mean its also hard since like, what we deem good changes over time, thus our change in interest in optimizing, whether thats readability, maintainability, memory footprint or somethign else
I actually did last night kek
Whatever it is, it's always possible to make it better for sure
no
HashMap is considered a hash map
Man I love this guy
HashMap<T, K> map = new HashMap<>()
yup
<T, K> 
my bad chat
no no no
thanks
all good
V, K is for poor people
V,K 💀
I just heard the kid yell "WHAT THE SIGMA"
@cedar saffron 🗣️ 🔥 💯
Wasnt default generics called V K
K, V
K,V
Anyone know a way to do this without respawning or is it not possible 😭
Same fucking thing 😭
those things are annoying when they do that
NO 😭
i have learned to move past that
CRAZY
Well Key Value makes sense
He's still taking all my fucking bandwidth on fortnite and screaming what the sigma at the same time
thong mentioned 🗣️ 🔥 ‼️
your grandma hasn't tho
men should wear thongs, it changes you
🔥
I am using a 5-6 years old phone sometimes it lags so much but i keep writing and the whole sentence appears in the textbox lmfao
Use aliucord
same 😂 specifically when i play gta and i check on discord tho
Like "yeah u can freeze i am going to keep doing my own thing"
https://github.com/Aliucord/Aliucord it's the old mobile app
Oh so it is a discord bug?
can u rephrase ur issue?
i was abit confused how u explain it
Mobile applications mostly suck when it was originally written for the computers
Yes sir
tbh i got it working fine apart from battery usage, and freeze spikes
Idk I don't really use mobile apps that much anyway
So when your in spectator and you view a creeper/spider/endermen you get a special shader effect. I want to apply such effect for survival players but the code provided is the only way I can think of doing it yet you have to respawn the player for it to take effect so I was asking if you knew a way to do it without having to respawn the player
My favourite database data structure
Packets maybe?
If you look at the code sample I do use the camera set packet but for it to take effect as far as I know you have to respawn the player
Pretty sure that's entirely client sided
If there's a different way you can do it please lmk
It's not
Since the server can't tell the client to use a shader
It can kinda
With the setcamera packet on a creeper you can force the player to apply the creeper shader
Well yea but you need a creeper for that
True, /spectate exists
So you spawn a fake creeper then remove it after the interaction
That keeps the shader applied
Until you send another camera set packet to remove it
But to apply the shader properly to my knowledge you have to respawn the player
And that causes a visual issue on the inventory where it removes all your items and gives them back
yeah I mean there is no supported mechanism to do that, that's why you have to hack around it and kinda just deal with whatever side effects it produces
that's why I was asking to see if there was another way of doing it I wasn't aware of
what theme is that
I'm using decayce my beloved
imagine default dark theme background smh
And they don't let you change the background?
It's a fucking terminal
And?
I'm using st so I would have to write some C code that does that shit
Cosmetics are everything!
I could just do opacity tho
That's ez asf
My st build has that anyway
Or just picom
I used wallpaper engine to find myself a background for intelliJ
wallpaper engine 💀
I can make my wallpaper a gif or mp4 and it has the same effect
cool
Is that like multi track drifting
add that steam is required to launch on startup as well. how much it affects you could really depend on pc tho
That doesn't mean wallpaper engine will startup, and it doesn't I actually forgot I even had it to be fair
https://gyazo.com/a184b50f906db68a81c61475f50dc98c
It's like watching youtube on lower quality kek
https://imgur.com/X7u81YV What's wrong with this code? the issue is that when I try to toggle my messages, I can only toggle it once (disable them) and then it won't enable it anymore as seen in this image: https://imgur.com/EvWntpU
because you are only checking if the key is present. You never actually check the boolean value.
I cant even decipher if this is a minecraft related question...
Rightt what a dumb mistake
would if (!tpm.containsKey(p.getPlayer()) == true) be a valid way to check if it's true
if(!tpm.getOrDefault(p.getPlayer(), false)) {
} else {
}
But there are surely more elegant ways
Nope, sry, i have literally no idea what you said there.
?img
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
You are adding a metric ton of cursors to your map for no reason. Dont do that.
And you are also tampering with the renderers in the render method. Thats absolutely horrible.
it's finee atleast it works
thanks
also while making a reply command (replying to a player who has sent you a message via /msg), should I store the last messaged player in a hashmap aswell
probably
with config.save(), empty values do not persist?
empty?
i'm trying out some async shenanigans. a thread automatically closes when the function is finished right? I just have to create the object and start it? (1.19.4)
guys can someone help please, in mc 1.16.5 i can create customentity by using entitycreature by using EntityTypes.<>their type but when i back in 1.12.2 i can't use EntityTypes to display them is there anyway to do it?
Yep
someone helpppp plss
ty
So, I'm implementing proper data handling since I'm using an SQL database and want to minimize file accesses.
I had the idea to synchronously write to my ServerData singleton and async write to the DB so the main thread doesn't have to do the file access.
?paste
hi?
This is my approach, is there a more optimal way? (this is simple access, there are more complicated ones too)
relax, someone's gonna help eventually. come back in like 30 minutes or something. spamming won't help.
and i can't help with this problem, sorry.
would a schedular make more sense than just immediatlely starting a thread every time? i feel like starting a new thread and destroying it every time is kinda resource heavy?
Thread Pools are your best friend
There are different types of thread pools BTW
And thread pool exhaustion can be a real issue
Which I've seen happen in large scale networks
Especially with things like CompletableFutures with no executor set
One of the thread pools that avoids this issue is called a "Cached thread pool", which has a bunch of threads and creates a new one if the pool is exhausted
Anyone know where I can find a good guide to NMS? Multi version support for a plugin?
Downside being that if you have a spike you end up with a huge pool that might never get up to capacity
What you want is a multi-module project
Yeah
I wrote an NMS guide but it's fairly meh because it's a huge topic that can't really be abstracted into simple terms
?nms, look for the multi-module post
?nms
?nms
Aight ty
Hi there! Today I’m going to explain how to setup a multi-module project using maven to support different NMS versions. Important notes about this tutorial: Every step will have detailled screenshots using IntelliJ. I explicitly chose not to include everything as copy/pastable source code, but normal screenshots (you can click on them to show th...
I wouldn't use reflections to init it nowadays because paper stopped relocating CraftBukkit
(what I usually do instead is have a minecraft version range for each module instead)
spigot still does
well congratulations your plugin only supports like 30% of all servers
Its a Spigot plugin 😉
Forks fault if it breaks compat
big problem if everyone uses the fork
Good job not everyone does
Sometimes because you need things that don't exist in regular spigot
Like if you're running swm
Then its not a Spigot plugin anymore
However nms is not API so not supported by Spigot anyway.
guy how to add model for entitycreature to 1.12.2?
No modern server is using pure Spigot, it's slow
Mine does 🙂
Then you're just missing out on performance for no reason
I don't need this "improved performance". I prefer stability.
I like things to behave how I expect on my server, not things like TNT duping through portals.
You know those are vanilla dupes, which can easily be disabled by a config option on Paper?
They don't exist in Spigot
With Spigot I don;t have to change any settings. It works how I expect.
Because they have been patched, but some people want to play the game as it is, including dupes
I'd argue Spigot is closer to vanilla than paper
You've just proven the opposite
I'd have to take your statement that TNT duping is vanilla for that to be correct
TNT, carpet, those are vanilla dupes and used in many farms
I've never seen a TNT portal dupe in vanilla
Because the easiest way doesn't require a portal
I didn;t say easiest. I said TNT portal duping
Although after a little searching you may be correct. the portal dupe does seems to exist in vanilla
I'll still prefer Spigot over Paper 😉
It's all just a thing of preferance
There are performance benefits (in some areas) using Paper, btu there are also downsides.
what downsides?
different behavior
well thats to be expected and is configurable
Expected is a term I'd not use
they are choices made in the fork.
When Paper hard forks I'd have to reconsider which to use.
While its a fork I'll not pick a fork which changes behavior
guy how to add model for entitycreature to 1.12.2?
And adventure
I've no interest in Adventure
eh, I really need my fonts
its a nice have
md5 components is all I need
everything?
Text displays, names, item names, messages, just everything that uses components in mc
ah
I've had no need for components in displays
the only one place wher component support would be handy would be in titles
me when fonts
fonts would be nice, but not essential
I'm literally using custom fonts like everywhere
wasting all my time 😔 ✊
how different is paper from spigot development?
Paper deprecated everything related to legacy chat and replaced it with adventure, and they have some other useful APIs and events
They have their own brigadier API which is pretty cool
Brigadier is the system used by Minecraft
Armorstands and RP
Idk what exactly you're asking
Don't ping random ppl
public static World loadWorld(String worldName)
{
File pluginFolder = Main.main.getDataFolder();
File worldFolder = new File(pluginFolder, "EFTM_Worlds/" + worldName);
if (worldFolder.exists() && worldFolder.isDirectory())
{
WorldCreator worldCreator = new WorldCreator(worldFolder.getAbsolutePath());
worldCreator.createWorld();
World world = Bukkit.getWorld(worldName);
if (world == null)
{
Main.main.getLogger().severe("Failed to load world: " + worldName);
}
return world;
}
else
{
Main.main.getLogger().severe("World folder not found: " + worldFolder.getAbsolutePath());
}
return null;
}
hi, im using this method to load worls by thier name inside plugins/MyPlugin/MyPlugin_Worlds/name_of_world , anywys this is for a minigame, how would i make a virtual copy of the world to be loaded so changes dont actually get saved for the next game.
Do you mean like custom models for certain entities?
Set the save chunks option in the WorldCreator to false
i cant find the option, could u please tell me how to do so
Does someone know in what version are EntityEffect and player#attack methods added to spigot api?
My bad, its an option in World. But its known to cause issues. Maybe doing a temporary copy is more viable.
Loading worlds will always cause lags btw.
how would I create a copy of the world, and is the last thing you said a general statement or is it something with my way?
You can just copy a Folder as always. And yes, loading worlds in spigot will always cause lags as its doing IO on the main thread.
There are a few things to can do to mitigate it a little bit (like setting keep spawn loaded in the WorldCreator to false) but you need to
be creative to find a workaround.
ohh alr
thnx
i saw on a forum tho a method .copy
inside the world creator
but the link mentioned was a page not found
Wait you can disable chunk saving?
What issues does it cause
Currently just saving my worlds to the OS temp dir 🙃
while that works, eww
Yea exactly
And you can't directly override the save methods in your ServerLevel
Because that's how the fabric people do it
it would be nice to be able to do a no save world
Yea and I'm making a public lib so can't just modify the server
I'm having some struggles running build tools, not sure quite what I've done wrong - I am using the new exe with the gui, build 1.21 works fine but older versions all fail
https://pastebin.com/7p2Cy1ZP
I have a question out of place, but I'll ask those who know. Is it possible to write a JAVA program to switch java version?
Hmm dont think
I know there are some programs that are double programmed
Basically a launcher + actual program
I mean its hard to just switch version
esp in the jvm
Like the current version has a certain garbage collector and supports certain things and presumably contains certain bugs yk
Its not like u can just jump up or down version like that
if it's written in 8 java?
doesnt matter
new version should support old version
this is def an x/y thing
support does not mean changing version midst runtime in the jvm lol



