#help-development
1 messages Β· Page 566 of 1
ugh
System.currenttimemillis()
Instant cooldown = map.get(key);
Instant now = Instant.now();
if (cooldown != null && now.isBefore(cooldown)) {
return Duration.between(now, cooldown);
} else {
return Duration.ZERO;
}
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
no.
Maybe I am the only idiot, who uses BukkitScheduler π
wait am I the only that just likes to do simple math with currenttimemillis?
That's why I need Loader instances in all my fucking classes...
instead of all these weird api
I am like 2 seconds away from doing basic math
you mean the docs?
it has a dark theme
just gotta donate :P
REEEEEE
thats the best reason to pay for anything
just use darkreader
wait I basically need Current time - Old Time = time left
Duration.between(Instant.now(), this.siegeInfo.getStartTime()).toSeconds()
should do
or is it reversed
i think its like that
dark reader
try it and see if my brain blanked
yeah its like that
imagine paying for themes π
cringe
now when i try to add it to another player it says its still a Collection though
I wish I could I have to code so much more before I can try this π
what themes
I would guess a duration between now and some time in the future would be positive
dark mode
spigot has themes if you donate iirc
ah fun π
final Player player = e.getPlayer();
final PotionEffect killedPlayerPower = player.getActivePotionEffects().stream()
.filter(effect -> effect.getDuration() <= PotionEffect.INFINITE_DURATION)
.findFirst()
.orElse(null);
if(killedPlayerPower == null) {
return;
}
what?
probably sharing the wrong snippets
?paste the full class
oh nvm i fixed it
it was something wrong in the global area
i had this set to collection π
do you ever set that
@echo basalt So all the players vaults their spawn is set to not save in memory, but should I have the world that is being copied saved in memory or should i disable that too?
set the session to expire after like 15 minutes
saved in memory is ideal for uhh
Just less latency
If the template is small enough
Look at the settings I use
I gotta push some stuff to cosmos
I mean like my world is maybe like 60 blocks width wise. build limit is 512 i think, and its just void for the rest.
it just uses your schematic's size
Feel free to pull and build from sources
or I can just make a new release and push it on my repo
No no dont worry about it haha, I'll look into and take some ideas. you just let me know when you get to a stable production plan. Cosmos looks really good and promissing.
hows your number parsing thing going
is it bad to have a lot of yml files? I find myself using a lot of data files for additional config done in game (like via menus and stuff such as player kits and whatnot) I am slowly crawling past 10 of these separate files and I dont know if hey should be combined even if it doesnt make logical sense
they arent all big
Oh. Good job! π
Not really. I mean they are just config files. I'd rather have a bunch of smaller ones, then 1 config file with 400 lines.
only 400
well yeah
I think only like 2 of those actually reach that 500 mark
which i would still consider small
so I guess its normal then
mine never reach 300+
its becoming quite a big plugin I guess so it kinda makes sense
Yeah, its alright to have multiple configs.
im talking about generated config things as well
like I only have a single config.yml that users should touch
generally speaking no. I would even go as far as to suggest that each player should have their own file. Therefore you can have hundreds of files. Having 10 files per player however would sound odd
well its not a per player thing
only really 1 or maybe 2 files manage any player state
you said their kits etc
yes
I mean the kits themself
I am making a minigame
I dont have persistent player information
Oh alright then
like I am making a bingo plugin so I also have a way to create cards, which get saved in a config file
stuff like that
probably want a database at that point
yeah maybe
yeah that's fine to have seperate files for configuration
a database does not sound like a bad idea
but like
my files are already acting like a database, just very decentralized xD
a database for config files? Unless there's a gui that sounds pretty inconvenient
there is
like I said my users dont really edit these configs
they are more just to store information
I only have one actual config.yml file which I use for settings
but maybe using a database can clean up my plugin folder
idk if you have any good resources on setting that kind of thing up
idk if its even something you can do per like plugin
I dont really know how databases work in regards to plugins
whats the skull for
i said like 10 things
If anyone here is experienced with developing plugins, please DM me. I'm looking to commission for a simple job.
you can use MySQL for a database. basically keep things stored locally you dont have a need for it to be accessed in the cloud, if this is just for mini games.
?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/
?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/
@EventHandler
public void sapling(StructureGrowEvent e) {
System.out.println("test0");
if (e.getSpecies() == TreeType.DARK_OAK) {
System.out.println("test1");
e.setCancelled(true);
File schem = new File(plugin.getDataFolder() + "/WorldEdit/schematics/test.schem");
ClipboardFormat format = ClipboardFormats.findByFile(schem);
World world = new BukkitWorld(e.getWorld());
if (format != null) {
try (ClipboardReader reader = format.getReader(new FileInputStream(schem))) {
Clipboard clipboard = reader.read();
try (EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder().world(world).build()) {
int x = e.getLocation().getBlockX();
int y = e.getLocation().getBlockY();
int z = e.getLocation().getBlockZ();
Operation operation = new ClipboardHolder(clipboard)
.createPaste(editSession)
.to(BlockVector3.at(x, y ,z-1))
.ignoreAirBlocks(true)
.build();
Operations.complete(operation);
} catch (WorldEditException exception) {
throw new RuntimeException(exception);
}
}
catch (IOException exception) {
exception.printStackTrace();
}
System.out.println("test2");
}
}
}``` i did schematic spawn when sapling grow but i have a problem if there are blocks around of sapling my schematic pasting
u guys give me idea for prevent this ?
im i need loop blocks around of sapling ?
you mean a database thats actually in the plugin itself?
or what do you mean by locally
like can I set it up so users dont notice the difference?
yes you can put it in the plugin. you'll have a folder in the servers directory to hold all your data. it could be in the plugins data folder or somewhere else.
basiclly you keep all your data stored locally on the machine the server is running on.
locally hosted database.
oh so its just like a blob of all the data basically
yes
no o.o
A database is not a file
I mean a database also stores in files at the end but theres a lot more to it
heehee
but for what he wants to do, he can use a database for all of that, so his plugin data folder isn't cluttered, right?
well frankly I dont care about how its implemented
I just wanted to know what it would roughly look like
Yes he can but the database will not be inside the plugin folder
where will the database be
On any server. Can be the same one or another one
Your plugin just requires the url, user and password to access it
idk man doing IO for every tree
in the main thread
is a bit intensive
so what does the server owner have to do then
because I assume I cant just will a database into existence from my plugin
he requires a set up database and he has to add the credentials and maybe the database schema to your config file
people actually knowing how to setup databases π€
why it doing this
getStringList
You can do that, too xD unless your files are huge a database is overhead anyway
I mean I am not against learning how to set it up, its just that i dont want it to be annoying for users of my plugin
yeah they are small atm
unless there is a smaller scope way of centralizing data other than just using system folders then im good
i have a database class
databases are important, I still recommend learning SQL and basics about databases
well I know databases
just not in the context of minecraft plugins
sorry if I confused you
like implementing it?
well like setting it up
like ideally the server owner will just have to put teh jar file into the pluginsfolder and then the plugin works
can i change this ?
It's still just SQL statements
yeah no database then
yes
depends whether u want sql or mysql
resourcepack
mysql is still sql
hows that a choice
i meant sqlite (jdbc)
i have an entire class just for mysql and sqlite which i use for discord bots and mc plugins
without resourcepack ? bcs we can change chest names
isnt that with resourcepacks too ;-;
xD
if player can change language
and have it keep the name
not work
so change it for all langauges you support
u guys can give me idea ? for custom sapling
i did with schematics
but if there are blocks around
still pasting
What event fires when a dropped item falls into the void? Does it just stop and then eventually despawn from timeout? Or does it get disappeared? Thanks π
am i need loop blocks of around sapling ?
I need help with my plugin
I want to block the Endportal until a specific date / time in the real world and if this date / time is over the players should be able to enter the Endportal
@EventHandler
public void sapling(PlayerDropItemEvent e) {
if (e.getItemDrop().getLocation().getBlockY() <= 0){
//do
}
}```
Theres a PlayerPortalEvent or however its called. You can cancel that
declaration: package: org.bukkit.event.player, class: PlayerPortalEvent
new Date(System.currentTimeMillis());
is there an edge case when my server hangs for 64 ticks?
I allready did that
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) {
if(blockEndPortal)
event.setCancelled(true);
}
}
Is the event firing? Did you try adding a debug message?
Its working, but I have problems with the date and time
use math and do with s.currenttimemillis
oh so what are you stuck with exactly?
thanks good idea
Says I need "at least 20 posts" to post
I would like to set a specific date and time when the portal is accessible
hardcoded? Repeated?
well, #help-development is not the place in any case
I wanna use a config file
# Date and time when the end portal will be accessible
date: "2023-06-15"
time: "22:27:50"
# Block access to the end portal frame
blockEndPortal: true
Do you have that values as LocalTime and LocalDate already? Or you take a LocalDateTime and only need one config entry
We are here to help people with writing code not spoonfeeding them - doesn't matter if you pay or not
runs every Monday at midnightjava LocalDate nextDate = LocalDate.now().with(TemporalAdjusters.next(DayOfWeek.MONDAY)); Long midnight = LocalDateTime.now().until(nextDate.atStartOfDay(), ChronoUnit.MINUTES); ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(()-> { /* Code here */ }, midnight, TimeUnit.DAYS.toMinutes(7), TimeUnit.MINUTES);
I read the date and time from the config and then put it in a date
public class EndHandler implements Listener {
private final Plugin plugin;
private final String date;
private final String time;
private final boolean blockEndPortal;
public EndHandler(Plugin plugin) {
this.plugin = plugin;
this.date = plugin.getConfig().getString("date");
this.time = plugin.getConfig().getString("time");
this.blockEndPortal = plugin.getConfig().getBoolean("blockEndPortal");
try {
Date dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date + " " + time);
} catch (ParseException e) {
e.printStackTrace();
}
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
}, 0, 20);
}
@EventHandler
public void onPlayerTeleport(PlayerTeleportEvent event) {
if (event.getCause().equals(PlayerTeleportEvent.TeleportCause.END_PORTAL)) {
if(blockEndPortal)
event.setCancelled(true);
}
}
}
you cna adjust to run as often as you want
Date has a "before" and "after" method
Create a new Date and compare it with the one from your config
If current date is before the config date, cancel the event
Bukkit.getScheduler().runTaskTimer(plugin, () -> {
if(dateFormat.before(new Date())){
System.out.println("cancel");
}
}, 0, 20);
Like this?
I want to add a count down later
When do you wanna display that countdown?
30minutes before, 15min before, 10min before, 5min before 1min before, 30sec before, 10sec before, 5 4 3 2 1 sec before
Well in that case your scheduler is fine. Now you just have to do some math based on Date.getTime()
and add your thresholds
You could create a list of reminder milliseconds in order and remove them once you reminded. Or you keep them in the list (or might aswell use an array then) and store your last reminder index
Hello do you have a video for learn how to connect a database to my plugin please
thx in advance !
Why is
if(dateFormat.before(new Date())){
System.out.println("cancel");
}
working but
if(dateFormat.equals(new Date())){
System.out.println("cancel");
}
not?
because it would have to be equal by nanosecond precision
which is unlikely if you check every second
How can i avoid checking for nanosecond?
you can use getTime and specify a range
or you do toInstant() and use truncatedTo()
You have to use that on both sides
Can I also do it like this? π
if(currentDate.equals(dateFormat.getYear())){
if(currentDate.equals(dateFormat.getMonth())){
if(currentDate.equals(dateFormat.getDay())){
if(currentDate.equals(dateFormat.getHours())){
if(currentDate.equals(dateFormat.getMinutes())){
if(currentDate.equals(dateFormat.getMinutes())){
}
}
}
}
}
}
hahaha
But why is there no getNanosecond function?
xD
You could use a switch statement
^^^^^^^^^^
if(configDate.toInstant().truncatedTo(ChronoUnit.MINUTES).equals(new Date().toInstant().truncatedTo(ChronoUnit.MINUTE) {
obviously you can cache the toInstant and truncate part of your config date
Hey, I'm trying to make a custom menu GUI and I thought that it would be a good approach te create a new class "menuItem" that inherits from itemstack and has a function "click()" so that way I can add the logic to the item itself. however, when a player clicks on the item the item turns into a craftItemstack so I'm unable to cast it back to a menuItem. Is there a way to change it back to ItemStack or am I just taking a totally wrong approach?
Totally wrong approach lol There is a guide by 7smile one moment let me find it
try taking a look into this, it has the similar click() function you want just done slightly differently
Thank you!
its because you have to register it to the servers command map, not your own
https://www.spigotmc.org/threads/command-registered-with-commandmap-does-not-show-on-help.395791/ read Sandwicha's code
about 4 messages down
YOO THE OLD HOMIE VANISHED
Anyone know if there is a good CooldownManager api or resource I can use to make one for 1.19?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
you dont extend CommandExecutor for this
Extend BukkitCommand
I'm working on a large plugin for my server. Should I switch to Kotlin? It seems better and I want to know before I completely finish the project.
using kotlin is personal preference
Are there any advantages?
i want to yell at you now for all the cursed code we'll see but lets not
theres a few things it has java doesnt
Ok, ty
id say if you know java to a decent extent and can debug stuff without extra help, using kotlin is up to you if you want to use it
if your not gonna use kotlin, adding lombok to your project is always a nice thing to do π
which event is called when the bone meal is used?
dw i dont use kotlin
try telling the android developers that
you are still making you OWN command map
you have to use the internal command map
Ty very much works perfectly
I'm just figuring out how distancing two Locations work
So we have distance and distanceSquared
distance is just root of distanceSquared?
I'm asking because I think I just realized that I will always check if distance is greater than 4
So if I just check if distanceSquared is less than 16 then I'm good?
Return true?
Do you know by any chance how much performance I am saving?
I am of course going to use what I just told you, but I am curious why this is not a big thing that people are gossiping about lol
Wow this is awesome
I am really stupid with math but these type of stuff makes me enjoy it each time more than yesterday
anyone know of a maven plugin to put jar overe ftp into plugins folder with built jar?
is there a way to hide this error?
Failed to save level ./world_vault
java.io.IOException: Permission denied
Nevermind i figured it out.
I would fix that error instead of hide it
Something tells me thereβs a better way to stop world saving than removing file perms
build tools wont run, https://paste.md-5.net/vurafuhare.sql, this is my command java -Xmx2G -jar BuildTools.jar --rev 1.19.3 --remapped, not sure why it isn't working either
that's not why. I have it set so that world cannot be modified incase of anything. its just when the server shutdown it tries to save the world anyways because it tries to save every world. that world is never needed to be saved because nothing can ever write to it.
Canβt you disable saving of a world
auto save yes
i have not found a way to disable a world save on shutdown tho
best way around it is to unload the world and not to save it in the onDisable
Are you not doing that
I am now. I figured it out a few minutes ago π
I'm trying to figure out what triggers this event... Anyone know? I've gotten the "Place_One" and "Place_all" but not some, so I was just curious what triggers it
Have you tried right clicking part of a stack of items in an intentory into your cursor
and visa versa
I haven't tested, but I believe that right clicking a stack would trigger pickup_some, but I can't figure out place_some
In the end it doesn't really matter, it's mostly a curiosity
oh yep that would pick_some but placing it back would just be place one
TBH not sure if you can even move items from the curse into an inventory unless just clicking them into an inventory triggers it?
Well, place_one and place_all are both triggered by left click and right click respectively, while holding a stack of items on the cursor
I'm kind of confused on what to do. So my plugin works fine on my local server for private testing. When i put it up on a hosted server ( server.pro in this case because its free ) the plugin doesn't work. It says java.lang.NoClassDefFoundError: toast/pine/overhaularmory/Materials/InfusedResources Systems needs the resources from the Armory plugin. the class is there in my local server, but why is it not on the server.pro server?
You don't have the plugin on your server
its in there.
NoClassDefFoundError says you don't
Well then im lsot
however
the file is there
?paste teh full stacktrace error
ClassNotFoundException: toast.pine.overhaularmory.Materials.InfusedResources Is your overhaul-system loading too early?
omg im just a dumbass that's why
i forgot. armory uses the vault api.
its missing vault
so the plugin is disabled
Yeah it works now.
does Overhaul-System require OverhaulArmoury?
If so, add a depend to it's plugin.yml
it does
I have.
Why not use the hideEntity api
Is it possible to store consumers into an item's pdc?
Hello I spawned an entity using this:
FallingBlock fallingBlock = (FallingBlock) world.spawnEntity(newLoc, EntityType.FALLING_BLOCK);
I want to set custom nbt to it (assign "myKey" to string "myValue")
How would I do that?
This is what I tried:
FallingBlock fallingBlock = (FallingBlock) world.spawnEntity(newLoc, EntityType.FALLING_BLOCK);
CraftEntity craftEntity = (CraftEntity) fallingBlock;
net.minecraft.server.v1_8_R3.Entity nmsEntity = craftEntity.getHandle();
NBTTagCompound entityData = new NBTTagCompound();
nmsEntity.e(entityData);
entityData.setString("key", "value");
nmsEntity.f(entityData);
you could store a reference not the consumer itself
Persistent data container?
pretty sure that doesn't exist in 1.8.9
and the value will only be used 5s after the entity has been spawned and never after
so nbt seems the best
also made a post and the guy sent me this:
// Get NMS entity
// Create new tag
NBTTagCompound nbt = new NBTTagCompound();
// Add the tag to entity
nmsEntity.e(nbt);
// Set the tag string
nbt.setString("YourNBTKey", "YourNBTValue");
// Load the nbt tag
nmsEntity.f(nbt);
Thanks for skipping the "//Get NMS entity"..
I think spigot should have a built in nbt api tbh but they probably have their reasons
Even with persistent data containers
block-pdc
Blocks donβt store NBT data
But chunks do, and someone has made a library for that
block-pdc would be so good
the library should be implemented into base spigot
before that library we would have to store the list of special blocks in a json file
Meh, just shade it
which is so lame
I have a problem with my PrepareGrindstoneEvent
i want to remove my custom Enchantment i set the name of the enchantment with a lore.
but the problem is that i want to see if one of the two enchantments are applyed or if both are applyed. and want to remove them the problem now is that i have som infos in the lore as attackdamage. and the enchants are applied at the top. Here is my code pls help me...
https://mclo.gs/xzsramb
be able to store data in entities
Thatβs called pdc
now if I want to store data in my entity I need to make a custom entity that extends the original entity
what a hassle
Can you extend item stacks?
Spigot lets you add custom nbt to item stacks
but only for itemstacks
for every other entity you have to create your own
Like as a βItemButtonβ or smth
do not extend Bukkit classes
Sad π
Lol what are you gonna do stop me?
Thats why they are asking howβ¦
Listen, you can try if you want, but it's not going to work the way you expect it to
NBT-API
Bet imma make a plugin only using those things that donβt work the why I excepted thatβs what makes it fun
Is there nms docs?
wut
lol no
^
naw
also before I start doing something unecessary, here's my problem:
I want to make a shockwave effect. I do this by summoning FallingBlock. But fallingblock grief the map. So I use the EntityChangeBlockEvent to manage it.
The EntityChangeBlockEvent is fired twice, once when the falling sand takes the place of the block and another time when it lands on the ground. First, it replaces the block with air and second it replaces the block with its stored value.
On first event:
- set the block it just removed to the block the entity has right now.
On second event: - if it lands on the same block it started, do nothing
- if it lands somewhere else, cancel the event
Can you make private nms docs for a dev team?
am I wrong on this
Entity e;
PersistentDataContainer dataContainer = e.getPersistentDataContainer();
1.8.8
Thatβs the 4th time
I think
I mean you could, but it'd take years to doccument literally everything perfectly
on top of that its constantly changing
so you'd have to go back and change all the documentation
Mojang mappings?
yes
didn't have the 1.8.8 context
just saw 'can't do this'
https://nms.screamingsandals.org/
isn't that exactly that?
legal issues
Ik still tho
no, it doesnt' tell you what the methods do
it just lists them
Mappings != Javadocs
is the uuid of an entity stored in its nbt?
I canβt imagine tryna NMs when Mojang didnβt have mappings
reverse engineering can be fun :D
\s
Who tf could read ovsufated frikin code
me
Where do you even start
I found
UUIDLeast:-5911143662407502793L
UUIDMost:8266609870279821949L
WorldUUIDMost:6452025998917979960
WorldUUIDLeast:-9093406817116217396L
forum posts usually of the people who came before you
and then from there cross referencing multiple versions of jars
Yes
unless it's some unique type
and not something common like int's
then it's easier to find
I did this when working on NPC's
it's a pain
I only assume the obfuscation is there as a legal defence to prove mojang/ms is protecting their ip
Could you just write your own severside code with protocols
Yes
probably
And people have
Damn
but then rip plugin support
gl hf
Send me docs
or just a server software from scratch which would be even more painfulo
π
I'm not making docs of NMS i'm not fucking mental
some NMS methods are whack and don't work properly
either orphaned code, deprecated code, or methods are are intermediate and certain conditions need to be met before they're called
Who
and simply forgotten
it's a big code base idk
Bear in mind that while some methods are left in and uncalled, they may be called on the client
I hate orphans!
to make development easier, since 1.3 minecraft uses an internal server on single player
so you don't have to code sp and mp
Tbh I have no idea what that means
single player uses a localhosted server
On multiple you connect to a server somewhere
just transparent
Ya
In single player the game starts a server internally
Did they not use to
nope
prior to 1.3 they did not do this
single player was single player
no servers
just you and the world
Wait so in theory I can install spigot into a single player world?
Maybe?
Wouldnβt that cause inconsistencies
Yes there used to be a lot of inconsistencies
^
Thatβs why they did the merge
it's easier to code 1 architecture than implement the logic for interactions differently on multiplayer vs singleplayer
multi you have to send packets
single you don't need to
this sucks
make it all multi player and then you have one consistent architecture for both single and multi player
Wait does that also mean single player supports can have multiple playersβ¦
Bruh moment
Yes
Open to lan
if your players are local it's possible
Itβs not single player the
Its a local server only the localhost can join
Wait could someone hack your pc and actually put herobrine in your worldβ¦
I mean ya
so no one from the outside world can join
which computer?
My iToaster pro
You'd have to open some silly program he embedded with malware first
and that malware would have to establish some connection to allow them to tunnel into the network
which would probably set off a lot of major red flags to the os
Bro if I make malware (which I wonβt) but if I do that will be a thing
that's not how this works...
I am one hella dedicated person
even if the hacker somehow managed to join your sp local hosted server
for what?
what would be the benefit
steal your tnt
it's easier to spin up a spigot server and port forward
ah yes, he'll take my tnt back with him
This is why I used to hide my diamonds even on single player
Make Minecraft conspirieses
I've had the issue of people using copenheimer to join my private MC server we had to setup security measures
nice lol
xD
always use whitelist :3
Not nice. They were going to grief us and they started collecting supplies for TNT. We had no backups at the time so it was quite something
aye, internet do be the wild west
Explain o me what a copenheimer is cuz I thought he made the nuke
We made the default gamemode spectator
ahhh
tis a project made by 2b2t players
L
scans the internet for open minecraft servers
No way
lol
Tis why you donβt have your server port forwarded
Actually?!
It was a fabric mod. Not the actual jeb
Yeah, my server gets monthly or so visits from griefers
anyhoo copenheimer will find open minecraft servers
Im confused
usually so people can greif them
What if you donβt port forward how would people know you exist
They don't
?-?;
they dont
if you don't port forward you don't exist
Unless you use a mod that has trackers installed
Fair enough
if you port forward then any one can ping you
port forwarding is like leaving your front door open
What is port backwarding then
that's not a thing
Oh just not porting forward
Iβll make it
Honestly itβd be fun to port forward my dev server
People are free to try and grief it, they canβt possible do more damage then I do to it regularly
Heh
It took them 2 or so years to find our server
Or at least sell the ip
Since they do that
One dev sever I saw literally reset everything when it was restart
then the fifth column roll up on the server
What if we run out of ips
we already did
Weβve been out of IPV4 forever
that's why IPV6 exists
Yeah, the guy has a page that mentions 2b2t. Exm1litary or something was his ign
But people just kinda make it work
You used to be able to just ask and they'd give you one
Now it's automatic. If you want a static IP good luck
$$$
Who runs the ip
because not many of them exist for sale anymore
Management
Like everything related to the internet probably ICANN
you can probably give yourself a new ip by unplugging your router for 5-10 minutes and plugging it back in
How do I work for them
Actually
That sucks
man wants to steal a static ip lol
Oh it's actually IANA
How do I work for them*
if you release the IP on your router before turning it off, you are pretty much guaranteed to get a new IP after 30 mins
^
I've been lucky to have the same IP for 4 or so years
or just vpn
Wait is static IP more dangerous?
lol
no
it's in the name
it doesn't change
it stays the same
Exactly
In the sense that if someone is harrassing you, then yes
It will always been known if leaked
Only so much someone can do to you. Unless you're like me and you host a bunch of services
That costs $$$
Cheaper to host at home
Or you can just CloudFlare
They give you great protection against it. Although the biggest issue I have is Chinese hackers attempting to guess the password to key-only SSH
Why is main benifit of static ip
You don't have to worry about the IP changing which means caching and whatnot becomes easier
For me, it means my DNS records don't need any software to make sure they point to the right IP
What if people just stopped managing the internet
networking is a rabbit hole of rabbit holes my man
How chaotic would it become
Someone else would
someone is getting paid big moonie to keep the thicc cables running
like the transatlantic cable
How thickβ¦.
Where do they get the money?
A few meters usually
doesn't matter if we did, it will be saved in our discord cache
if we had this channel loaded
Just
:p
Cached
Itβs the internet
None of it is my voice anyway
Delete is never delete
I know that
I still ask that you donβt play it
If you do
Oh well
Like that rich kid who assaulted the guy having his Dad spend a fortune to get the video deleted
looks in discord cache
I dare you reupload it
ok lemme find it
cache is an area to store data temporary
so you don't need to keep requesting it from the server
saves on resources
like loading a webpage
I love people
why bother fetching images again?
just save them to a temp file on the users pc
ofc eventually the cache will be invalidated and be re-cached if new data is found
Wait what if I donβt want people to see my cached stuffβ¦
β¦
Nvm
Conveniently same place to clear search history
You can clear your cache but not others
Interesting
I think audio clips work differently
they're only cached if you click on them
images are cached if you just see them
I still have 24kb of your voice tho :p
Using the NBT api, for some reason setting any NBT data causes the player head to lose its skin
NBTItem headNBT = new NBTItem(playerHead);
headNBT.setUUID("HeadDrops_Owner", playerUUID);
if I comment out the second line, and don't set anything, skin stays. if I set it though, then the skin goes back to default alex/steve skin
why are you using nbt to set a skin? old version?
i'm not using nbt to set the skin just to store a UUID for later use
what spigot version?
1.20.1
anyone know why my armorstands are doing this
https://cdn.discordapp.com/attachments/817491459128688661/1119088160752808036/Minecraft_1.19.4_-_Multiplayer_3rd-party_Server_2023-06-15_21-15-24.mp4
Code:
// Create and customize the armor stand for feedback
ArmorStand armorStand = (ArmorStand) block.getLocation().getWorld().spawnEntity(block.getLocation().add(0.5, 1, 0.5), EntityType.ARMOR_STAND);
armorStand.setMarker(true);
armorStand.setVisible(false);
armorStand.setGravity(false);
armorStand.setCustomName(ChatColor.GOLD + "β +" + experience + " Mining XP");
armorStand.setCustomNameVisible(true);
// Remove the armor stand after 1 second
plugin.getServer().getScheduler().runTaskLater(plugin, armorStand::remove, 20);
ill look into it, thanks
np
How can I check how fast a certain tool will mine based off material
craftPlayer.getHandle().b().a(titlePacket);
Is this correct?
Whats the best way to make custom blocks? Textures really doesn't have to change since im not really good at making textures, just want to make a fwe things like upgradable furnaces and what not
set visibile before you spawn the entity
might as well set all teh attributes before spawniing it
if you want textures, use noteblocks.
but if not you want to use a tile that can hold nbt
Oh, didnβt know that actually mattered
on the clientside it's rendering a regular armourstand, and then waiting a tick for it to update that data
if it spawns with the data pre populated it doesnt have to re render
Thanks
Whats the best way to do enchants? Is it still lore + pbt?
Mushroom blocks work too if you dont really want to remove any functionality like noteblocks
alright
how can I check if mob killed by charged creeper?
getKiller is a player iirc
yes.
i think damage event is fine, just check if targets health =< 0 and then do your stuff there
cause you have both target and attacker there
Don't you have to do <= 0?
is it possible in EntityDeathEvent?
doing what exactly ?
If you mean "show for a tick" then just use a Text Display entity (unless you want to support versions > 1.19.4)
other solution would probably be: spawn it somewhere under the world and then teleport it a tick later
or you could try the constructor that takes a supplier (or provider or whatever) and use that to modifiy the armor stand, idk what exactly it changes tho.
Ok just noticed you got an answer already :D
i dont think the player ever actually dies when using a totem
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/EntityResurrectEvent.html
Ah seems they do
you can just check theyre hand/offhand slot when they take damage & health is 0, surprised theres not just an event for this already lmao (or better yet just use this event)
Who used this HolographicDisplaysAPI? I trying to use it for my farm rods but I get errors from the console. I see the text is white and not aqua if that means anything
hello guys i havea question. i want to add custom craft with custom model data but i cant make custom model data the result of a crafting with custom model datas what to do
send errors...
Why can't you, what have you tried
datapack recipes do not support NBT
weird question but are you developing a spigot plugin ?
look
I knew you was going to ask me. Anyway, line 9 is the error. You see the plugin loaded but I don't know. https://paste.md-5.net/wilikuquyo.md
im not that exepirienced but i've made some
How can i get this to work WITHOUT sending a message to the console (convert() is a translateAlternateColorCodes call)
some rigged ahh shiz
so I assume yes, I think you can use the PrepareItemCraftEvent to change the output item nbt
ok ty i will try it
oh you can have nbt output with the bukkit recipes ?
they accept ItemStacks so yah
I recommend you do that then trying to set outputs and stuff. addRecipe is the easiest
seems like you need to depend on the api ?
Whats the best way to handle custom enchants right now?
All of the stuff I see is from like 2010-2014
And I know a lot of stuff has changed with pdc and what not
pdc, events and lore I assume
Unless something changed
Main.java: https://paste.md-5.net/xugoyaraho.java
?main
Still that?
Alright thanks
implementing Enchantment is a good first step
idk why no tutorials ever go over implementing that class when doing custom enchants
makes compat a lot easier for some things
Alright
alr but fr is this just like forbidden or smthn for sending color in console and im forced to send console messages?
thats some cringe if i ever heard it
Custom Enchants? There is but it can be super outdated. Source code in these videos are not NMS so it should work. Just know you have to add a lore to the item
I think you can, but you have to use different colors, not the minecraft Β§
lore is tricky when you add multiple plugins tbf
we had this issue with advanced enchantments a few times when i worked there
ah the backcodes one? like how you use in server.proprties for the motd
nonono
The console does not know how to interpret Β§ as a color, that is a MC thing
Β―_(γ)_/Β―
i know it forsure works when you send it as a message to console but meh
I know I use this if I want colors
https://stackoverflow.com/questions/5762491/how-to-print-color-in-console-using-system-out-println
let the man have his colors
oh yee i remember this with nodejs as well
its my own personal plugin for my server lemme have my moment :((
I mean if you like it it's okay, but it's generally hated in community :3
You can send message to ConsoleSender
These plugins I create are for my server only
Bukkit.getConsoleSender().sendMessage
That will work with colors
yeah i think imma jus have to settle for that sadly
ugh ok, you do you I guess
can I have a link to that api ?
So I extend enchantment, then add lore to the item, then register events to check if it's enchanted and if it is modify everything that needs to be modified?
If you that worried about it, I did not even add the colors to my server shop and it added colors. Its apart of MineCraft. Even you can use colors in world names
What api?
yep
i HIGHLY reccomend you stick to 1.16+ for making it tho though so you save yourself trouble
Going to
What
HolographicDisplaysAPI
...
The one part I'm confused about is the lore, how would I mimic the look of enchantments?
I don't understand what are you trying to say lol
Oh wait does lore contain enchantments?
you would either just add them at the end or at a specific index in the lore (fill the lore with empty lines if index does exist), and clear the vanilla names and you would re-render them on the items lore alongside your own enchantment names
the repo has examples..
do you have
softdepend: [HolographicDisplays]
in your plugin.yml ?
nnoono
enchantments being displayed are an ItemFlag
declaration: package: org.bukkit.inventory, enum: ItemFlag
Oh
apply HIDE_ENCHANT to the ItemStack then you can re-render them in the lore
enchantments never get put in the lore
theyre put into a list in metadeta
Got it
I have seen it but I either route this talk to PMs otherwise the talk must end. Just know the colors is not just the console, its apart of MineCraft. But I wish to not fight about this.
That makes more sense
You said something about this but you did not tell me what file. Will add that now and see
Still don't understand you, we were talking about logs, not other aspects of minecraft lmao. Ofcourse colors exist for other things then logs
Hello everyone
I have a question regarding craftbukkit. I use the follwoing codesnipped, which requires 3 objects from Craftbukkit src files:
ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().c.h.m.pipeline();
if(pipeline.get(player.getName()) == null)
pipeline.addBefore("packet_handler",player.getName(),channelDuplexHandler);
c = PlayerConnection, h = NetworkManager and m = Channel
However in the latest Craftbuikkit version (PlayerConnection.java), the NEtworkManager has been set to private and I can't access it.
Does anyone know a workaround to access the NetworkManager, or knows another way to declare th pipeile to the craftplayer?
TY in advance :)
I assume reflection is the way you'd have to go
I have tried it, with a reflection (from chatgpt π ), it ocmpiled, however, when running the plugin on the server, said Code did not have any impact
try {
// Get the handle (EntityPlayer) from the CraftPlayer
Object entityPlayer = (CraftPlayer) player.getClass().getMethod("getHandle").invoke((CraftPlayer) player);
// Get the PlayerConnection from the EntityPlayer
Object playerConnection = entityPlayer.getClass().getField("playerConnection").get(entityPlayer);
// Get the NetworkManager from the PlayerConnection
Object networkManager = playerConnection.getClass().getField("networkManager").get(playerConnection);
// Use reflection to access the private 'pipeline' field in the NetworkManager class
Field pipelineField = networkManager.getClass().getDeclaredField("pipeline");
pipelineField.setAccessible(true);
// Get the current pipeline instance
ChannelPipeline pipeline = (ChannelPipeline) pipelineField.get(networkManager);
// Add your custom channelDuplexHandler to the pipeline
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
} catch (Exception e) {
e.printStackTrace();
}
is it throwing an exception ?
I am not experienced enough in this matter, to be able to verify if this code does, what I want it to
no
well for starters, you can remove the unneeded reflection to parameters you do have access to
I guess you can add several prints to every object (again don't kill me good devs here)
To see how far the code gets
INFOaperMinecraftFormatting
is the only message, the server responds
oke, I will try that, ty
idk what that means
same, but i assume its unrelated to my issue
How can I get Map<String, Object> from config? (to deserialize Object)
What part are you struggling? Making the map or deserializing objects?
And why using yml files for such a thing
Also why having a super class "Object" and not something less abstracted?
Could they possibly be trying to serialize an itemstack ?
I think that is how the serialized object looks like
so I have Board class, that has Tasks
I wrote method for serializing
but how can I load it?
I wouldn't process like that. It could lead to so much difficulties between the map containing a list of map, yml, etc...
What I would do is serialize and deserialize in json: which seems much more intuitive for your kind of work.
Then you could literally save and read your json from a json file
json is harder to work with(
pillager.setHealth(pillagerHealth1);
pillager.setCustomName(ChatColor.GRAY + "Pillager (Level 1)");
pillager.setCustomNameVisible(true);
upgradeSkeletonEquipment(pillager, Enchantment.ARROW_DAMAGE, (int) pillagerBowDamage1);
EntityEquipment equipment = pillager.getEquipment();
if (equipment != null) {
equipment.setItemInMainHand(new ItemStack(Material.CROSSBOW));
equipment.getItemInMainHand().addUnsafeEnchantment(enchantment, pillagerBowDamage1);
ItemStack bow = new ItemStack(Material.CROSSBOW);
bow.addUnsafeEnchantment(enchantment, pillagerBowDamage1);
equipment.setItemInMainHand(bow);
}
}```
Anyone knows whats wrong? I want a custom value to be added as enchantment level of the pillager's crossbow
why are you setting the item twice ?
Can you not use item meta instead of unsafe method ?
why is the method called "upgradeSkeletonEquipment when you pass Pillager
Why is the ItemStack called bow when the material is Crossbow
Why is there a 1 pillagerBowDamage1 in the argument name
Skeleton,bow are just names, behind real values doesnt really matter
*inhales*
this is painful for anyone to read and possibly confusing
I hope you're the only one who will ever see the code.. oh wait
Anyways since you're on 1.14 at least - use itemmeta
var meta = bow.getItemMeta();
meta.setEnchant(...);
bow.setMeta(meta);
equipment.setItem(bow);```
or something
gson pojo:
wait almost forgot
*exhales*
Anyone know where this is from?
where what is from
This map is given on every death
also looks like #help-server
So i added som debug messages, however it seems, that after the "Enters try and catch", no more messages get sent
player.sendMessage(ChatColor.GOLD + "Enters Try and Catch: ");
Object networkManager = ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager").get(((CraftPlayer) player).getHandle().c);
player.sendMessage(ChatColor.GOLD + "networkManager is: " + networkManager);
// Use reflection to access the private 'pipeline' field in the NetworkManager class
Field pipelineField = networkManager.getClass().getDeclaredField("pipeline");
pipelineField.setAccessible(true);
player.sendMessage(ChatColor.GOLD + "pipelineField is: " + pipelineField);
// Get the current pipeline
ChannelPipeline pipeline = (ChannelPipeline) pipelineField.get(networkManager);
//ChannelPipeline pipeline = ((CraftPlayer) player).getHandle().c.get(networkManager).m.pipeline();
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
Fun fact:
anyways it is weird that nothing else gets sent and no exception is thrown...
ohh thank you!
player.sendMessage(ChatColor.GOLD + "Enters Try and Catch: ");
Object networkManager = ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager").get(((CraftPlayer) player).getHandle().c);
player.sendMessage(ChatColor.GOLD + "networkManager is: " + networkManager);
// Use reflection to access the private 'pipeline' field in the NetworkManager class
Field pipelineField = networkManager.getClass().getDeclaredField("pipeline");
pipelineField.setAccessible(true);
player.sendMessage(ChatColor.GOLD + "pipelineField is: " + pipelineField);
// Get the current pipeline
ChannelPipeline pipeline = (ChannelPipeline) pipelineField.get(networkManager);
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
try to print
((CraftPlayer) player).getHandle().c.getClass().getField("networkManager")
you just "" + field :D
I did it as follows and it did not print anything past "try and Catch"
player.sendMessage(ChatColor.GOLD + "Enters Try and Catch: ");
player.sendMessage(ChatColor.GOLD + ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager").toString());
Object networkManager = ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager").get(((CraftPlayer) player).getHandle().c);
player.sendMessage(ChatColor.GOLD + "networkManager is: " + networkManager);
ye don't use .toString() here, I'm trying to see if it is null
just do sendMessage(ChatColor.GOLD + "" + ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager"));
unless you verify, no
but wait
?screen
?screenshot
?image
ok nvm idk the commands here
?img
Not verified? Upload screenshots here: https://prnt.sc/
ah!
Can't run buildtools, not sure how to fix.
I'll quickly verify :)
ok now look into the console and send a picture from there
Starting with the Enters Try and Catch
it does not print anything to the console yet, should I?
yes but not sure what it wants me to download
beacuse libraries.minecraft.net is a 404
use Bukkit.broadcastMessage then
And then send the logs
who cares, this is debugging, a lawless territory
π€£
does the full link throw 404 as well ?
and giving it the : ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager"))?
just change all player.sendMessage to Bukkit.broadcastMessage
oh I see
I am debugging the spigot server and I get things like net.minecraft.server.level.ChunkProviderServer.d() which intellij can't navigate to, is there a way to get these sources somehow?
yes
then idk really, sry
player.sendMessage(ChatColor.GOLD + "Enters Try and Catch: ");
Bukkit.broadcastMessage(ChatColor.GOLD + "" + ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager"));
Object networkManager = ((CraftPlayer) player).getHandle().c.getClass().getField("networkManager").get(((CraftPlayer) player).getHandle().c);
Bukkit.broadcastMessage(ChatColor.GOLD + "networkManager is: " + networkManager);
// Use reflection to access the private 'pipeline' field in the NetworkManager class
Field pipelineField = networkManager.getClass().getDeclaredField("pipeline");
pipelineField.setAccessible(true);
Bukkit.broadcastMessage(ChatColor.GOLD + "pipelineField is: " + pipelineField);
// Get the current pipeline
ChannelPipeline pipeline = (ChannelPipeline) pipelineField.get(networkManager);
pipeline.addBefore("packet_handler", player.getName(), channelDuplexHandler);
gave the same output, nothing in the console
there can not be "nothing"
k
ItemStack crossbow = new ItemStack(Material.CROSSBOW);
// Apply enchantments based on the pillager's level
switch (level) {
case 1:
crossbow.addEnchantment(Enchantment.ARROW_DAMAGE, 5);
break;
case 2:
crossbow.addEnchantment(Enchantment.ARROW_DAMAGE, pillagerBowDamage2);
break;
case 3:
crossbow.addEnchantment(Enchantment.ARROW_DAMAGE, pillagerBowDamage3);
break;
default:
break;
}
return crossbow;
}
// Adjust skeleton attributes based on the level
switch (level) {
case 1:
// Level 1 attributes
pillager.setMaxHealth(pillagerHealth1);
pillager.setHealth(pillagerHealth1);
pillager.setCustomName(ChatColor.GRAY + "Pillager (Level 1)");
pillager.setCustomNameVisible(true);
// Set level 1 crossbow
ItemStack crossbowLevel1 = createCrossbow(1);
pillager.getEquipment().setItemInMainHand(crossbowLevel1);
break;```
anybody knows why the crossbow is not getting enchated?
As I said before... Have you tried to use the item meta instead ?
Im not sure meta would work in this case
this is the console output π
I made a start.bat file, which runs the purpur jar form the console
purpur
what the fuck is purpur
lol
(windows cmd)
ask the pupur discord
?whereami
?whereami
HAHA
beat you
naah
but its not a purpur issue π
but purpur server
how are you so sure?
Try rerunning in an empty folder
craftbukkit, form buildtools, made NetworkManager private, in the previous versions it was public... this borks my code...
oh wait smart
the console output being fucked is most likely 'cause you're using off-brand spigot :D
I am like 99% sure you're getting an error but not seeing it
use reflection
you can try putting Bukkit.broadcastMessage() in the catch section
that's what they're doing
I don't know these spigot forks, what are the benefits of purpur ?
purpur is pretty popular
not a benefit
the thing is, I am testing a plugin on my own defualt purpur server, cuz the server I play on, is on purpur
but you're writing a spigot plugin ?
shush
well, it uses craftbukkit
Well i tried meta, the weapons glow as if its enchanted but they dont really deal any extra dmg
technically a genious wrote it a few years ago, and I am updateing it and understand it to a certain point... but i am no master in spigot and nms at all
just use a fricking spigot server so you can actually see the errors in the console
then report back :D
oke, will set one up
do entity data get on the entity to see the data of the item
if the item is actually enchanted, then you have a different problem
@chrome beacon fixed ty babe you da greatest
actullay got a drop from one