#help-development
1 messages · Page 1771 of 1
don't get swayed by maow, he's a part of the system, rise up and store the unstorable
:|
lma
I'm not a part of your system, I made my entire plugin serializable and I store a snapshot of the state on a 1 minute timer "just in case"
ok but legit someone should do that that's fucking hilarious
I don't store player instances, I store the entire server list alongside the reference to which element in the array the player I want is at
I don't use for loops, I use while (true) and breaks everywhere because I am a wildcard which can not be contained nor quantified by for loops
I use Java's highly advanced printer API to automate the process of writing the players.
javax.print ftw
every time a server checks in to see if they are running the latest version of my plugin they actually upload their own version to my spigot profile and then run a checksum between the file they just uploaded and the file that preceded it because I give power to the people
anyway buy my book on java programming, it's lit
will do
send me the link
I want more of these epic based programming conventions
Does spigot or bukkit have an easy way of deleting a chunk? So its completely removed from the disk and would regenerate
can spiders wear player heads?
No
provide support for customers only?
like anti-pirating
no way really
sure you can obfuscate your plugin but that wouldnt help against experinced people
man I didn't even know EnumMaps were a thing
lol, you have a unnecessary import if you declare it as List and initialize as ArrayList and since the classes don't differ very much, it basically doesnt even matter
your say has no difference and no impact
you know how sometimes you say stupid shit and come back years later to think about it and only realize how dumb the shit you were saying was with the benefit of hindsight?
what if you need a list on a method?
as a paremter
you cant just require the arraylist implementation
you make no sense, why are you even pinging me
If you have a List as parameter, you can easily pass an ArrayList as argument because ArrayList implements List
thats not what i said
imagine being a toxic discord helper
I guess never mind what I said before, maybe you won't come to realize jack shit
You have no clue about anything so just shut up
mhm
Nobody needs your dumb comments
"unnecessary imports" actually don't matter @old cloud
Imports are compile-time only and serve as shorthands for fully-qualified names.
It adds a line to your .java file
So?
Oh no! A line!
means bigger file
The .class file is the only one that actually matters size-wise.
you've gotta be trolling
🤡
You guys dont get it. I just said that it basically doesnt matter and wanted to end this discussion but you are acting like kids
we're acting like kids?
not on your pc
you ping me about something i said an hour ago
because I was afk
which is right, and any project will show you that
it isnt right if it doesnt matter
Listen if a single additional line in your file actually makes a difference to your hard drive's remaining space, then you should get a bigger hard drive.
🤦🏿♂️
it matters. You are requiring an exact implementation even if its absolutely unecessary. Soo, the class becomes less re-usable
true
Yes, this.
correct
Ah now I get what youve meant with parameter
yeah
is there any way through ChatColor that I can make chat message bold and a color? Hypixel somehow does it
you should probably use translateAlternateColorCodes
&color&l
&l = bold
alright, so then instead of ChatColor use color codes, thanks
no you still have to use ChatColor
How can I copy and paste a chest and keep the contents inside it?
or using Adventure
(you could also use Bungee's text API but idk what kinda support that has)
Can someone help me with this?
I meant something like ChatColor.BOLD
well yes but to use color codes you should use ChatColor
interesting move, calling people here children for giving you actual advice, not saying sorry when you realize they had a point all along and then asking for support 🤡
unless your keyboard has a section sign key :p
Does anyone have an API for the heads of active players on the server (HTML)?
How can I to copy contents of one chest to another chest?
If I know something, I can give adivce. That has nothing to do with not knowing something else
Or are you perfect?
I'm perfect enough to not be an asshole to people in a support room moments before asking for support
And I called you children because you acted like children
you were
unless it's choco, choco is fair game
.
No, you acted like an asshole
did I?
at least imo
yeah alluding that your very strong stance on something that you don't know much about might be misguided is a classic 🥒 move
you are perfect uwu
yeah I know
is anyone able to help me?
I need to know how to copy contents of a chest/sign over to another one
CraftHead or smth?
I know a lot about java. And what I said was not wrong.
maybe not wrong, but absolutely pointless
Not in the context I was thinking
I see you have a reading comprehension issue here, do you see in the message you replied to where I said misguided
I have this code which copies an area but it doesn't seem to copy chest data:
World world = Bukkit.getWorld("mcc");
Location loc = new Location(world, 0, 0, 0);
for (int x = -339; x <= -96; x++) {
for (int z = -49; z <= 193; z++) {
for (int y = 0; y <= 77; y++) {
loc.setX(x);
loc.setY(y);
loc.setZ(z);
Block block = loc.getBlock();
BlockData data = block.getBlockData();
loc.setZ(z + 252);
loc.getBlock().setType(block.getType());
loc.getBlock().setBlockData(data);
}
}
}
System.out.println("COMPLETED");
does anyone know why?
Yes, because I'm not a native english speaker so I might have some issues in understanding some things.
english is my third language but you don't see me using that as an excuse when I fuck up do you do
This is because it doesn't copy the NBT data of the chest
how can I copy the nbt data?
I don't know, all I know is that BlockData does only contain basic information about the block
Yes
get the block state, clone it and set on New block?
I'm pretty sure they want to serialize it
Block block = event.getBlock();
if (block instanceof Material.SAND) {
}```
so this doesnt seem to work on blocks
but it works on entities
what would the block equivalent be
to check if a block is sand, that is
block.getType()
no, as he said before he just wants to copy chest contents to another chest
Ahh
Thank you spinanddrain
Oh ok
Do you know how to do it?
yeah chest & sign
Ok, I don't know you
I don't expect you to know me but I do expect you to fundamentally not be a dick to the people you're asking support from
especially as they provide you with said support
Let’s chill guys
Yes I agree. But I weren't a dick to anyone. Now lets just end this argument because its brings us to nowhere.
Only to you because you were a dick to me out of nothing. So I'm sorry for my part.
the end
thanks
I'd respond but I've been told if I actually stop when conclure tells me to stop on the 100th time I do so I get conclure's gamer bathwater and I'm not missing out on that
lol
with VehicleCreateEvent is there any way I can know how the vehicle was created?
because I'm looking to prevent non-op people to place minecarts, boats and others in a certain situation
is there some sort of player event you could use to detect them making a vehicle
making a vehicle?
I hate the way durability loss is handled by the spigot api so I am making a utility class to bypass it, I think I'll call the class Durability and I'll call the method oof
how do i actually find the spigot file i need to import into my java package?
the API will tell you but realistically you should be using an IDE that will automatically suggest an import as you type a class
whats the method for grabbing a material version of an item from it's string name
sorry i meant how do i actually import the API into my project lel
i am watching a tutorial because am noob and he just told me to go to jenkins and get buildtools but idk if i have to run buildtools to get the API jar or if im missing something
go read the spigot wiki, it has all the info you need to get your plugin setup for all the major java IDEs
and stop watching yt videos, yt videos suck when it comes to guiding people through code
use written documentation and code snippets
programming tutorials on youtube be like https://youtu.be/m_Dp4nMr_AY
public class Items {
public static final Item a;
public static final Item b;
public static final Item c;
// and so on``` also would anyone know where the documentation is to decipher this
what do you mean
what did you decompile
what the hell is an Item
well obviously it's a public static final field in an Items object @opal juniper
hope that helped
that doesn't sound right to me but whatever I never bothered with nms code, which is documented here https://wiki.vg/Protocol
I'm surprised no one commented about the absolutely insane yt video I posted
3hrs of bullshit o-o
people pop in an out of here just for others to answer their questions
what?
oh my god this dude is still posting guides, daily
I am shocked, he has made nearly 300 identical videos, all entirely nonsensical scams
from the nexus i have no idea which jar to download and if i use buildtools idek where i will find the API jar ;-;
you know the name of the file and I am sure your OS has a search functionality
How does one read bytecode?
Bytecode instructions
got a bit to go I see
how do I check if an entity is damageable in the EntityDamageByEntityEvent
I know I could just cast it to Damageable but I want to make sure it's actually damageable prior to casting
instanceof Damageable
are you sure about that
Did you import the right damagable
Because spigot has two, thanks Obama
lol
Imagine Memorizing the whole Spigot API
How do i make an enchantment book, and would my idea be useable? My idea is making an enchanted book i can use in a crafting table with a custom recipe to make a completely new item?
with the enchantment book
Does jline compile for you guys?
Which economy plugins are popular that have apis? I want to incorporate some into my project but am not sure which ones to support
just use vault rsps
Can you explain that more?
Any way to use recipe choice with shapeless crafting recipes?
Make a recipe choice and set it to recipechoice.exactchoice
RecipeChoice item = new RecipeChoice.ExactChoice(itemstackOfItem);
recipe.addIngredient(item);
I got that now! Thanks!
hello. i need help to create a level system
it will be configurable
example: yaml levels: 1-10: 1000 #from levels 1 to 10, each level up will increase the next required xp to 1000 11-20: 2000 #from the levels between 11 and 20 each level up will increase the next required xp to 2000
How can i clone a chunk from one world to another, ping me if you can help 🙂
does anyone know how much of a delay there is between sending a receiving messages between bungee and spigot?
there is no set delay
it depends on alot of factors
@EventHandler
public void bowShoot(EntityShootBowEvent event) {
if (event.getEntity().getType() == EntityType.PLAYER) {
DropItem dropItem = new DropItem();
Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.get(), () -> {
if (!event.getProjectile().isOnGround()) {
} else // Cancel here
}, 0L, 2L);
}
}``` how can i cancel a repeated task?
cancel
Bukkit.getScheduler.cancelTask(task variable);
^
where do i put the task variable
inside the runnable
It's returned from calling the scheduler
@EventHandler
public void bowShoot(EntityShootBowEvent event) {
if (event.getEntity().getType() == EntityType.PLAYER) {
DropItem dropItem = new DropItem();
BukkitTask task = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.get(), () -> {
if (!event.getProjectile().isOnGround()) {
} else Bukkit.getScheduler.cancelTask(task);
}, 0L, 2L);
}
}```
this doesnt work
You can just use task.cancel I believe
I am having some issues with sending messages between bungee and spigot, it says that it sends, and says that it receives it, along with the data it receives, just when I try and use it it fails
yeah but it grays out all my code saying its redundant
instead of BukkitTask do int
same thing
Variable 'task' initializer 'Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.get(), () -> { if (!event.getPr...' is redundant
Wtf are you doing
projectile particles
I mean code wise
@EventHandler
public void bowShoot(EntityShootBowEvent event) {
if (event.getEntity().getType() == EntityType.PLAYER) {
DropItem dropItem = new DropItem();
int task = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.get(), () -> {
if (!event.getProjectile().isOnGround()) {
dropItem.item(event.getProjectile().getLocation(), new ItemStack(Material.RED_WOOL, 1));
} else task.cancel();
}, 0L, 2L);
}
}```
....
.
That's not what he meant
If you're going to do it that way you ant call task.cancel
int taskone = 0;
int finalTaskone = taskone;
taskone = Bukkit.getScheduler().scheduleSyncRepeatingTask(ParkourSystem.getInstance(), () -> {
if (sw.elapsed(TimeUnit.SECONDS) < 5) {
p.sendTitle(ChatColor.LIGHT_PURPLE + "NEW HIGHSCORE", "");
}
else {
Bukkit.getScheduler().cancelTask(finalTaskone);
}
},0, 45);```
that is how I do it
How would i make my weapon show only one enchant but have a lot
like i want it to show a custom enchant
and also have it have a lot of other enchants
AttributeModifier i think?
i forgot what its called
but one of them is called HIDE_ENCHANTS, but it hides all the normal enchants
Probably an item flag
You cant really chose what ones to hide though. Just use lore to replicate it
Yeah just use the hide enchants then add your own lore or whatever since you want it to be a custom enchant anyway
why is spigot ignoring player.teleport(location)
it's not teleporting the player at all
oh wait
was it thread safe
You shouldnt be teleporting async
It should be giving you an error
hey everyone- let's imagine I want to create a new fake player
specifically an entity that behaves just like a player, an NPC of sorts
where would I start in that respect?
I would use the citizens API
nah, citizens sucks
use NMS EntityPlayer
with nms player u can do many more things
can anyone list out why I should use any of these?
I would use Citizens too
better to use a standard abstraction than make things yourself
citizens register entity server side so if you want to make like monster out of it, not suggest
yep
it better than messing with NMS
since my player model is a mob so citizens make everything broken apart
okay
can i ask you this:
is it legal for me to modify the spigot core for my server (1.8.8 R3)?
probably? I don't give legal advice here
Hi, I have a simple problem that I can't fix, I'm trying to setup a scoreboard for a player when he joins the server but it's not working.
Code:
@EventHandler
public void onJoin(PlayerJoinEvent event) {
Player player = (Player) event.getPlayer();
new BukkitRunnable(){
@Override
public void run() {
scoreboardhub(player);
}
}.runTaskLater(plugin, 2);
}```
Plz i need help
its a normal scoreboard
cant help you with out the code...
like an actual function of it
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getNewScoreboard();
Objective o = board.registerNewObjective("hubsc", "scoreboard");
Team rank = board.registerNewTeam("rank");
rank.addEntry(ChatColor.RED + "" + ChatColor.RED);
rank.setPrefix(ChatColor.translateAlternateColorCodes('&', prefix));
o.setDisplayName(ChatColor.translateAlternateColorCodes('&', "&bClouds&3MC"));
o.setDisplaySlot(DisplaySlot.SIDEBAR);
o.getScore("").setScore(8);
o.getScore(ChatColor.translateAlternateColorCodes('&', "&7• &bName")).setScore(7);
o.getScore(ChatColor.translateAlternateColorCodes('&', "&7» &3" + player.getName())).setScore(6);
o.getScore(" ").setScore(5);
o.getScore(ChatColor.translateAlternateColorCodes('&', "&7• &bRank")).setScore(3);
o.getScore(ChatColor.RED + "" + ChatColor.RED).setScore(2);
o.getScore(" ").setScore(1);
o.getScore(ChatColor.translateAlternateColorCodes('&', "&bTEST.mysrv.us")).setScore(0);
player.setScoreboard(board);
}```
i don't think so, 1 sec
have you registered the listener
this is the most common situation
yes i did
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_275]
[04:41:18 WARN]: [Lobby] Task #19 for Lobby v1.0.0 generated an exception
java.lang.NullPointerException
at org.bukkit.ChatColor.translateAlternateColorCodes(ChatColor.java:324) ~[server.jar:git-Spigot-db6de12-18fbb24]
at me.LBP.Lobby$1.run(Lobby.java:51) ~[?:?]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftTask.run(CraftTask.java:71) ~[server.jar:git-Spigot-db6de12-18fbb24]
at org.bukkit.craftbukkit.v1_8_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [server.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.B(MinecraftServer.java:723) [server.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.DedicatedServer.B(DedicatedServer.java:374) [server.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.A(MinecraftServer.java:654) [server.jar:git-Spigot-db6de12-18fbb24]
at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:557) [server.jar:git-Spigot-db6de12-18fbb24]```
Imma guess 'prefix' is null
no no 1 sec
well what is line 51?
LuckPerms API = LuckPermsProvider.get();
User user = API.getPlayerAdapter(Player.class).getUser(player);
String prefix = user.getCachedData().getMetaData().getPrefix();```
insert a null check
o.getScore(ChatColor.translateAlternateColorCodes('&', "&7» &3" + player.getNam``` l-51
I already did, its not null
Id be surprised if that is line 51
i get owner prefix
hmm
in my main file?
or join listener?
no, Lobby
p.getScoreboard().getTeam("rank").setPrefix(ChatColor.translateAlternateColorCodes('&', prefix));```
the lobby.java line 51
@Override
public void run() {
for (Player p : Bukkit.getServer().getWorld("hub").getPlayers()) {
User user = API.getPlayerAdapter(Player.class).getUser(p);
String prefix = user.getCachedData().getMetaData().getPrefix();
p.getScoreboard().getTeam("rank").setPrefix(ChatColor.translateAlternateColorCodes('&', prefix));
}
} //
}.runTaskTimer(this, 0, 100);
}```
i thought join.class
check if the team "team" already exist or not
its not "team"
its "rank"..
1 sec
ye
where did you declare your "String prefix"
String prefix = user.getCachedData().getMetaData().getPrefix();
getPrefix is returning null
ye
both in Lobby.class + Join.class
idk how to use luckperms API, so its either an issue with that or you didnt define a prefix in your luckperms config
^^
yes
ye
add a null check or define a prefix
Ah, it works, it was bc i didn't have a prefix
okie!!!
@sullen marlin @weak mauve tsymm ❤️
np
hello, I'm making custom spawn eggs and when the user places the egg I want to pass some data to it.
Is there way to associate the spawn egg to the mob spawned from CreatureSpawnEvent ?
Cancel the interact event if it's a custom egg and spawn the mob manually on the code.
Can someone explain me how I can charge a CrossbowMeta to an ItemStack?
addChargedProjectile
Hello i want to work with a api to handle data have everyone makes experience with apis in a plug-in ?
Uh like creating an api for other plugins?
I think the 50% of the people in this server has done an api
This percentage does not include me though
Ok here a example :
i Type /Info into the chat
And my plug-in want to get data form my api
So I make a fetch requests in Java on my api and that returns me hello world
So can my plug-in return this data into the chat or whatever
I want to know is this method good to use
That does not mean those 50% inherently did it correctly or in a solid way.
This api of yours? Is it a web api? Or what api type are we talking about?
Yes my own api at the web
Might wanna take a look at HttpUrlConnection if that fits you
Yes thanks
so than I wanna know how can I allow a player permissions
i want to know this for my own group system
Or a link to the documentation record for permissions
You could use something like Vault API assuming you wanna support generic permission plugins.
Or if you create your own permission system, just search "permission" in the javadocs
?jd
(First one)
Thanks
That’s what I searched
I know that thank you, but I can't do something like .setCrossbowMeta()
So I'm trying to create a plugin for one of my client, and the plugin will throws an error ClassNotFoundException like this https://mclo.gs/zt598Uv, but I have no problem with the plugin when I tested it myself. And here's my pom.xml https://paste.md-5.net/onubijocaf.xml
I already make sure that we both using the same jar.
1.7 isn't supported
You can use setItemMeta with the CrossbowMeta
I don't think it's spigot version problem
I mean I don't think the version caused it.
uhm CrossbowMeta extends ItemMeta
Check out polymorphism
That jar you’re running isn’t even a spigot jar. Its mcpc or something
Yes
well i got it from there on the spigot section
And did your client
on maven, do i need to specify the scope if i shaded the libs in?
No
im just confused on why it throws CNFE but the class is exist when i tried to decompile it with jd-gui
idk why i read that as "cenfee"
and the remapper is from the spigot software?
do you relocate your depenencies
Spigot never had a remapper
That's how I know whatever jar you're running is not spigot
that's not from my log, i don't have that errors while testing on my localhost
might need to ask the tester first
i have returned, if anyone recalls, and if you don't recall, ive got a silly project running where i make a computer in minecraft using a plugin to interpret bits placed in the world. every block is a bit. wool is a 1, glass is a 0, the machine operates in 32 bit, the CPU currently works fine, 1 line is 1 game tick, so im editing 32 blocks per tick
,now,
i'm making a GPU, why? because i want to make a computer that resembles a real computer, im looking to find a balance between art and function, if i throw art out the window, i'd obviously not do this, there's plenty of optimizations i could do, but for art it would be cool for the GPU to have all its bits visualized as the cpu ram, anyhow, the GPU is going to draw 128x128 blocks, with 4 bits of color depth.
The GPU is per frame (worst case) changing 128x128x4 blocks to represent every pixel. This absolutely lags out the server and client.
I could reduce it to 128x128 blocks and say "every block represents 4 bits" but i feel like this is a bit of a cheat.
Im looking for a way to reduce the lag, as much as possible, without comprimising the number of blocks used by the GPU.
If i can't find anything, i'll give into reducing, as i want a playable game while this runs... but i wont back down easily 😉
all suggestions are super welcome! My goal is 30+ fps screen realtime computer
1281284*30=2 million
thats alotta blocks
almost forgot, a GPU has a front and back buffer + a few registers for pointers.. so i actually need 128x128x4 x2
and correct me if im wrong but you can't update blocks more than 20 times a second
and yes 20times/sec if you use the standard TPS, but packets can be sent whenever
ah i see, then yes
Consider using a map instead
seems a bnit excessive
You can maybe get close to 30fps on that
i thought about maps, but i don't think i can update those 30/sec ?
There is 0 chance of you getting more than like 1 fps with blocks
You can update them a hell of a lot faster than blocks
how do you see the map working? custom maps for the screen? what about the ram bits? maps too?
yes just a renderer for the maps
didn't you say bits are physical blocks?
just the display can be a map
You can do your program in blocks
and then the ram in maps on the ground?
That just requires reading once into memory
Either way you're writing a plugin so everything is actually going to be in java memory
You'll just be reading or writing it to the world every now and again
my goal was for every bit of information to be in the world
thats the entire "so many blocks" thing
well you could still have a display like that buy 128x128x4 is far too much
i can agree its a ton lol
You simply can't update the world fast enough
Look at sethblings Atari emulator, it's like one frame every 4 hours
And you want 30fps
ive seen it, i never said id reach it
what about hex?
Be realistic
I realise he used command blocks, but your goal is still half a million times faster than his was
there are a few methods where you can place a few million blocks fast but not <1s fast
if i just make my goal 1 frame per minute thats nothing to say woaw to (even though it is) it doesn't speak to people tho
not to mention client rendering
im thinking maps right now... maps need data to render the.. well.. map
But it's realistic
i think a map would do far more justice than a laggy block screen
nono im thinking, maps need data to display their pixels right?
the pixels can be 1's and 0's
then, the itemframe rendering the map can just be updated
maps are 128x128 pixels
you can use a MapRenderer
you don't need a physical llocation if thats what you mean
yes, keep the bits internal in java, but display them in the world
id love for them to be "read" from the world tho, as in, find the itemframe, read the map... so it still touches the world, and doesn't just display to the world
still feel like the map thing is a bit of a cheat... but you're right the blocks are too much...
its your best compromise
Hundreds at best
not sure honestly, i've seen methods which allow 15m in a second or so
not sub millis time however
No way those methods can update client side in that time
alr
But yeah theres also client side rendering
What is the point of 30fps anyway
If your point is a physical demonstration, why go so fast you can't see
oh we haven't gotten to the point of 30fps yet yes
Yeah what minecraft demo would benefit with 30fps
Yes but why even have that as a goal
I think even 5 is good enough
The point of doing it in the world is so that people can see what's happening, right?
Assuming it’s just a generic graphics processor
the point isn't showing the 1 bit change, the point is seeing all the bits change while running some program on that pc at 30fps
So go at a speed where they can actually see what's happening
But all the bits changing at that speed is just a mess
It's like looking at an oscilloscope with the divisions wrong and just seeing static
the idea is to find structure in chaos by doing this.. thats the artistic part
the entire reason why im doing it is to find structure in chaos, some bits wont change, some will constantly
what user input does what, what changes when i hit this button, what when i hit this one instead?
regardless, the 30fps dream is eventually to port something over to the pc and run it live
don't forget reading from the world can become taxing
so you need to do that efficiently
or pre bake it or something
compiling it in some way would be more efficient yes..
will the player be able to see memory changes in real time?
that was the idea yes
the idea was to have your screen in front, and if you look below you see the memory bits twitching and flickering away as you play your emulated game
right
thats the eventual goal
memory will be in hex i assume?
right now its binary
but considering its 128x128x4x2 for jsut back and front buffer
ill have to move to hex
to cut out the x4
still leaving a huge number...
so im even considering going over hex to just ram in more bits into 1 block
well yeah naturally hex would be more compact
the map idea sounds good, im just not too big of a fan as it takes away the read/write from the world... while my entire goal was to feel "inside" the computer, and see it all happen
i mean everything can be in the world except the screen
its not like they are gonna be interacting with the screen aside from looking
(keyboard is gnn be in the world so seeing your screen and going for that Z button will be hard lol)
effect speed maybe (dont know yet, play with friends? lol?)
im trying to find some blocks that can bump up 1 location to 8 bit
so a byte per block
playing with friends would take A LOT of work
gotta make an OS, transport protocol etc
256 bits into 1 block... any idea how?
well 1 hex digit = 8bits
everyone uses 1 button of the keyboard i ment
ah right
yes, 1 block being 1 hex still leaves 128x128x2, too much
im looking for 1 byte per block now
since blocks/tick is the limiting factor
i have to downscale
the programming could be done in binary/hex
the ram needs to condense
we wont be "reading" the ram as humans
its just visuals
the program will tho..
yeah
idk you can make your program auto assign blocks
do the players need to know which block attributes to which of the 256 bits
the 'get block by id' is deprecated tho (fuck)
in the ram? no.
purely visual.
the flickering will be the visual queue of "you changed this"
not the "how much is this"
yeah
it would be nice to have 256 block colorpallet that just rainbows or something
theres a formula that gives you the amount of bits for each base number system
i forget what it is
so you have an idea how high or low the value is
but that'll give you your answer
idm what base it is, im looking for 256 blocks rn ^^'
the base bit is just some math i can do in the plugin (not afraid of that stuff)
its the interaction minecraft/plugin that scares me, idk what functions are taxing etc
thats mostly my questions here 🙂
yeah
yeah but i think making one block = 256 bits would limit the reads to the world and thus speed it up dramatically
yes
not sure what your cpu's clockrate would be aswell
would dramatically effect your performance
currently im doing 1 line of code per tick, wich is on avg 2 reads 1 write per line
ex: ADD X Y would do read X read Y write result into X
gonna need far more than that
oh yes, but thats no issue, ive ran the CPU at 1000 lines/tick, worked fine except the world lagging a bit behind with block updates
internally the blocks were set, and executed correctly (so >1 change of block state per tick is fine)
the world lagged slightly, wich is due to the 32x3x1000 blocks updated in 1 tick
96K
but no errors...
thing is that it all calculates fine, its just the world updates, so its gnn be a hunt for 256 blocks
256 blocks that gradient from one color to the next...
how bad is the lighting updates in 1.17.1?
yes
If you use Paper with the Starlight engine it's quite fast
changing a block only updates the lighting if it goes transparent to solid or back?
or on every block change?
🤷♂️
alright, thanks for the input tho, starlight is a mod, so ill consider it (trying to keep clients vanilla)
thanks! ill check it out : )

xD
the top of the L and bottom of N is cut off for me
shutup
Anyway how can I properly use something along the lines of java Class b = ItemSword.class; ItemStack test= new ItemStack(Material.IRON_SWORD); if(test instanceof b){ System.out.println("test is in fact an ItemSword"); }
Ofcouse I can't do it like that since you can't compare 2 objects like that
Class::isInstance exists
which is basically instanceof
however
since test is of the type ItemStack, ItemSword.class.isInstance(test) would always be false since test instanceof ItemSword is always false
Yeah that's what I was going to ask
Basically I have these classes that implement a Kit class, I want a way to check if the main weapon of a kit is for example a sword, axe, bow etc
ah
Ofcourse those weapons are variable like Iron swords, diamond ones etc, so simply comparing the itemstack itself isn't a great option either
Maybe have an nbt tag where its value would be the name of the kit (on the itemstack)
then just get and compare
The itemstacks itself are fetched from the kit's config files respectively though, though I could just apply the meta once fetched.
I'll try that
yuh
Isn't checking the meta like that very resourceheavy though
This'll be checked every interaction
Then again I'd still run into the problem lol
assuming its not for a single backend server with like 500 concurrent players
Because what if for example my knight kit has a bow aswell, i'd still have to somehow find the main weapon
yuh
anyways, if you run into optimization problems, then try resorting to nms
though I'd advice trying out just the api unless you encounter problems
Might just create an enum for each kit saying it's a SwordKit or something of the sort, might be more efficient that way.
yeah i'll do that
public Knight(Player player) {
this.player = player;
initialize(this.getClass().getName().toLowerCase()); // loadout from file
setKitType(KitType.SWORD);
}``` something like that
I'm not expecting any numbers like that, but might as well write the code properly instead of having to change it later 😉
👍
Do someone know how to get a Player from a IUser (from EssentialsX) in a non deprecated way?
IUser#getBase() is deprecated
Wait what how do I even compare an itemstack against an ItemSword
you need to determine yourself what you want to compare
but ideally
interface ItemType
compare(o);
class ItemSword implements ItemType
ItemStack -> get some "key to value" id -> the value becomes an id to determine what type of ItemType should be used for comparison, with for instance a Map<Id,ItemType>
or smtng
is there any way to obtain entity tracking distance cleanly? I mean i could get spigot.yml yamlConfiguration and get the key through there, but that's messy a bit, what im asking if API has some kind of method to obtain it in one liner
afaik nope
ask in the MOSS discord, where the essx devs reside
if there's a way to obtain UUID, you can just use the UUID with getPlayer() method
How can i sell premium plugin on SpigotMC?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Is there a way to get default item attack damage value?
attributes
I only found a method to get attribute modifiers, not the base value
getAtributeModifiers().get(Attribute.GENERIC_ATTACK_DAMAGE) I think.
May need to look into NMS then
Nah, very little project to use nms in it lmao
If I am not wrong, you can cast the ItemMeta to an org.bukkit.attribute.Attributable and work with this. Or you can simply pack these values into an enum as they are always the same for each weapon
Yall all threads so far about it either say what I posted above or work with nms
nms cool
Ive already googled it before writing here, so I know
always use nms they say
Just was wondering maybe there is some not stupid way of doing that
just dont code mods. mcp your way to victory
we are talking about spigot not forge/mcp.
I guess this will just cause classcastexception? Because I don't think that item meta is attributable 🤔 But ill try
i know :c
In a recent project i used sth like this. I can look for it if you want
Already tried
hmm ok
Welp, I guess then the only way for me will be doing that fucking map of materials and damage
Gigasad
Have fun
Thank you. Can I set an ItemMeta AND a CrossbowMeta for the same ItemStack?
CrossbowMeta is item meta
sure thing u can
^
Hello i'm looking for communicate externaly with my plugin. I have a website and need to send json data to my minecraft server, and the server must send back json response. What should be the best to do ?
I think rest api should be good, need your help for where i need to look
To build the rest api or just what to use to talk with the rest api?
i dont know if building a rest api is good for my needs or if i should use something else
i know how to comunicate with
I mean, you’re bound to use a web api if it’s communication between the website and your plugin I guess
yes right
Though have you looked at graphql?
no i'll take a look. ty
@kind patrol
public PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.a reason, float value) {
this.r = reason;
this.s = value;
}
use these constructor arguments
to construct one
modern minecraft server versions include a way to contruct packets without reflections
try this:
PacketPlayOutGameStateChange packet = new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.e, 1.0F);
then send it by getting NMS player's connection object
PlayerConnection connection = ((CraftPlayer) player).getHandle().b;
connection.sendPacket(packet);
(this is 1.17.1 obfuscation)
(use specialsource)
im confused about plugin.yml and Bukkit.getPluginManager()
do you only have to register stuff in one of them?
or both?
or plugin.yml only?
if i'm doing Bukkit.getPluginManager().setExecutor, do I need to also add the command in plugin.yml?
if i'm registering a permission in Bukkit.getPluginManager().addPermission, do I also need to add the permission in plugin.yml?
For permissions, they can be absent from plugin.yml if you check permissions in the command executor.
For commands, if you don't register the command in plugin.yml then Plugin#getCommand(String name) will return null.
ok, that clears it up a lot
so permissions dont have to be registered? just check it during CommandExecutor right?
Yeah if you use Player.hasPermission() it will check if the player has the permission node, they don't have to be registered in plugin.yml.
They just need to be assigned to players using the Permissions plugin
If a plugin adds permissions they shoudl be registered in your plugin.yml
if they are not a perm plugin will not know about them unless you specifically add them
is it bad to have most of my variables inside my main class
with getter and setter methods
Probably yeah
I need them to be global tho so I can use them in different classes and when I put them in different classes I have a bunch of issues
A class should only change for one major reason - single responsibility principle. Whether that concerns you or not is up you to decide.
Organizing your code files is one of the important things
No no no global will make your code fragile
You’ll get in a state where you change one feature, another irrelevant feature breaks.
it’s so hard to explain but it doesn’t work when I put them in different classes and then try and access them
Also your main class is considered your highest ordered class, and has the purpose of setting up all the other classes up with their intended dependencies. Making it a data/context object (like storing a lot of state in it) may violate your class hierarchy, as you will have to make a lot of other classes depend on your main class.
Well, why not go ahead and demonstrate an example, and we shall take a look at it
Ok here goes my best example:
Main class:
boolean isRunning = false
Command Class to start running:
plugin.setIsRunning(true)
plugin being an instance of my main class
Completely different class
//random event
if(plugin.isRunning()) {
//do something
}
sorry for the bad format i’m on my phone lol
anyways that’s the main idea of it, if I put the “isRunning” boolean in the command class then if I try and get it from the event class, it is always false even if I set it to true
Maybe I’m doing some basic java thing completely wrong
You definitely have some misunderstanding if you think you're setting it to true and it returns false
That code above would work
but if I set it to true in the Command class then my events class always returns false
🤨
I must be messing up some basic java concept right?
if I were to have the isRunning boolean in the command class and set it to true in the command class then it would always be false in the event class
it makes no sense to me
I’m not on my pc rn so I can’t but the setter would be public void setIsRunning(boolean isRunning) { this.isRunning = isRunning; }
show code where it is set to true when ur at ur pc
I won’t be home for like 8 hours but when i’m home fs i will cause this is bothering me and making my main class really flooded
In your event were you creating a new instance of the Command?
Because that would be why it was returning false.
can I somehow change an annotation by overriding? I have these 2 interfaces
public interface DefenseEnchant extends Enchantment {
void onDamage(@Nullable LivingEntity attacker, @NotNull LivingEntity defender, int level, double damage);
}
public interface DefenseFromEntityEnchant extends DefenseEnchant {
@Override
void onDamage(@NotNull LivingEntity attacker, @NotNull LivingEntity victim, int level, double damage);
}
and i want the overriding method to have a @NotNull annotation since in DefenseFromEntityEnchant, the attacker can't be null
I was told the event in this class: https://github.com/PrayRNGesus/MineAlerts/blob/master/src/me/pray/minealerts/ToggleOres.java would cause a memory leak if like 10 people spammed one of the alerts, why would this happen?
no not really
And you shouldnt override nullability
Just leave it nullable
i mean it felt wrong but if that's what people do
ima just slap an assertion
ez
reqnonnull
if the plugin is not running, disable it
I mean this mostly depends on the semantics of said annotations.
there are different implementations of nullability across the JVM
I am sending a message to my bungeecord plugin on the proxy, and it only responds the second time the message is sent
Show code
Guys How can I run a scheduler only 1 time I mean the scheduler will run if there isnt another one
new BukkitRunnable() {
@Override
public void run() {
board.clear();
board.setAll(ChatColor.DARK_AQUA + "" + ChatColor.BOLD + " Remiel", " ",
ChatColor.GOLD + "Akçe ⛁" + ChatColor.WHITE + money_formatted, "", ChatColor.GRAY + player.getName(),
ChatColor.DARK_GRAY + formatter.format(date), ChatColor.AQUA + "mc.moonnw.xyz"
);
}
}.runTaskLater(f, 80L);```
I want to check if runnable is running and if is not I will create a new runnable
how can I do that?
Why can't you just create a new instance at the start?
I have to load a lot of chunks, how can I spread the work over few ticks?
Logger logger = PerPlayerBorder.plugin.getLogger();
World world = Bukkit.getWorlds().get(0);
int x = 0;
int z = 0;
while (true) {
x = x + 16;
if (z > 5000) {
break;
}
if (x >= 5000) {
x = 0;
z = z + 16;
continue;
}
Chunk c = world.getChunkAt(x, z);
Block block = c.getBlock(0, 1, 0);
if (block.getBiome() == Biome.FOREST) {
//saves the coordinates in a file
}
}
}
wdym?
I have this problem with "BlockFertilizeEvent" event. As you can see normal spruce tree's are not growing over the border but the azalea trees are still growing over the border.
What event do I need for the azalea trees growing?
Might be a spigot bug
How can i make a subcommand like gamemode and than you can select an other command. And i do not want to make this with args
What
Args are your sub commands
You don't have a choice
You can't really do this async, generally I loop on the main and add chunk snapshots to be processed on another thread
I mean like that it is colored red when you do not enter the right thing
tab completion
^
Thats with args
Yeah...?
what do you want us to do?
Forward you to a command framework?
That's literally how it's done
I mean its blue when you enter args. Not like the sub command creative from the gamemode commnd.
That's because you didn't handle it correctly
Just google it, you're being quite vague
How should i handle it than?
¯_(ツ)_/¯
Are you just trying to make your sub commands blue instead of red?
I tryed a bunch of tutorials and always got the same result
returning null makes it red
returning an empty list, or a list containing what the player typed makes it blue
what do you mean with "loop on the main"?
There's a main thread where the entire server runs on
Kinda what you're doing
So what should i return than?
It should return a list with all your valid sub commands
But when i hit tab its blue instead of gray
I have no clue what is causing this, it seems like the message is being sent just bungee cord is ignoring it
What
You need a separate bungee side to your plugin
Did you register your channel on the messenger?
I did both, the message gets received by bungee the second time sent
It works on a weird way where you can't call the code directly, and must implement messaging to yourself
When i hit tab by the gamemode command it the creative is gray
thats the issue
Bungee messages aren't received if there's no players online
What version are you using
This is why I usually don't like this hassle and decide to just redis
1.17
this is being sent on player join
Send ss
so there is a player online
good evening I have a problem since this morning
https://cdn.discordapp.com/attachments/876208368778362940/909895796747563109/unknown.png
Run buildtools
java -jar BuildTools.jar --rev 1.17.1
And add mavenLocal() to your repositories
I made it with maven
What do you mean
send gradle dependency
you can clearly see it on the right
dependencies {
implementation 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
}```
do compileOnly
not implementation
I have already reload gradle
compileOnly is not deprecated ?
also make sure you have this repo: maven { name = 'spigotmc-repo' url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
plugins {
id 'java-library'
}
group 'Agent'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
}
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/public"
}
}
dependencies {
implementation 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
}
processResources {
def props = [version: version]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}
Yeah, run BuildTools and add mavenLocal
I am trying to code a lifesteal plugin. principle is to add one heart to a players max health if he kills someone and to remove one heart of a player that gets killed. my code is on github ||https://github.com/HealingArcYT/Lifesteal|| and it does only work kinda
ah yes !! well seen
I never bother to use the public repos
yeah, you want to move to a thread?
Also wouldn't that require he use those random numbers at the end
ugh I hate this
No, those are just versioning ids
🤷♂️
don't you have one already
not for this
what should i use instead?
yea, but doesnt make it work though
Makes it easier to see what's going on
You're listening to PlayerDeathEvent instead of EntityDamageByEntityEvent
ok, would that make it easier then?
Something like this can work? I never worked with threads before
loadChunk t1 = new loadChunk();
t1.start();
Logger logger = PerPlayerBorder.plugin.getLogger();
World world = Bukkit.getWorlds().get(0);
int x = 0;
int z = 0;
while (true) {
x = x + 16;
if (z > 5000) {
break;
}
if (x >= 5000) {
x = 0;
z = z + 16;
continue;
}
ChunkSnapshot chunkSnapshot = t1.get(x, z, world);
if (chunkSnapshot.getBiome(x, 30, z) == Biome.FOREST) {
//save
}
}
}
}
class loadChunk extends Thread {
public ChunkSnapshot get(int x, int z, World world) {
return world.getEmptyChunkSnapshot(x, z, true, false);
}
}
no
does that make a difference? because it just somehow works for reducing the amount of hearts but not making more hearts (at least not all the time
I'll give you a little complex method I made recently
See if you can figure what it does
player.setHealth(hearts * 2);
is it normal that is tagged as C++?
not really
btw ChunkPosition is a custom class I made
what the script supposed to do ?
I use bitshifts because I'm stupid and can't bother making code readable
¯_(ツ)_/¯
4 means /16
<< 4 means *16
| is like an add
& is like a %
See if you can guess
instead of what i have or in addition to that?
instead
it gets every block in a chunk ?
Not quite but close
There a BLOCK_RANGE double
It gets every block in that radius, starting on an origin
it gets all block in a range?
yeah
Async, does some material checks and adds the block location to a list
Each chunk on its own thread
but doesnt that act like health boost where you cant regen the extra hearts once lost or doesnt it even not allow anything higher than the max or doesnt it even also set the current health to that? bc it should remain the health, but the max health should change
Let's say you have 9 hearts and you call player.setHealth(20) (10 hearts)
you now have 10 hearts
let's say you have 10 hearts and you call player.setHealth(22) (11 hearts)
you now have an exception and 10 hearts
yea, thats NOT what should happen
set the GENERIC_MAX_HEALTH attribute to whtever then
when you have max health of 20 (10 hearts) you get max health of 22 (11 hearts) once you killed someone
thats what i was doing
on top of setHealth
and there should not be a healing once you kill someone
so max health 20, health 4 before, after kill max health 22 current health 4, for example
is bytecode the only way to read through a jar file
no thats a line segment with direction
decompile it?
That defeats the purpose on what im doing
What are you doing
Not quite, but almost there
We can assume a line that starts in 0,0,0 and ends at your position, that's a line segment with direction
Is this triggered by END_GATEWAYs?
I can't quite tell
Not sure if it's just nether portals or something else.
should be
thats the convenient way to represent a vector in programming
Yes
But if you read the code / internals, it's just 3 doubles (x, y, z)
In that case, you can also say a location is a segmented line with direction
Thats different concepts, and if they look similar that doesnt means they are same
Can you google a second definition of vector for me
Making an application that can read through jars for specific things
Well, yes, bytecode is the way to go
nvm
well what are you trying to do exactly
what things
argument prints
wdym print?
System.out.println
Don't I still need to use bytecode?
Not really
not if thats all youre doing
isn't System.out a public output stream?
Though why are you trying to do that
You can do System.setOut to intercept calls to println
Assignment and I have to use bytecode
pog
what is the best way to check if event.getClickedBlock() is a sign?
the only ugly way I found is this:
String blockName = event.getClickedBlock().getType() + "".toLowerCase();
if (blockName.endsWith("sign")) {
}
i know haha
for coding a 1.16 plugin should I do it in jre 15 or jre 8
Is it public or private
currently it will be just for one server but I might make it public in the future
Probably 8 then
okay thanks
Whats an event i can use like EntityDamagebyEntityEvent for death?
I mean, you can use that event
Or you can use the EntityDeathEvent and event.getEntity().getLastDamageCause()
ty theres .getKiller too!
Only if the killer is a player, yes
how can i grab a random wool color
Version?
<1.13: generate a random number from 0-15 for the data
1.13 I would use a static list of the wool types and then just grab a random index
did wool color used to be an nbt thing
cuz now its just independent material ids
Yeah it used to be metadata
i am having problems with reloading my config.yml, it wont reload with reloadConfig() can someone help?
If it's not reloading then you probably did something wrong
ok my Command Class: ```private Plugin plugin = CombatLoggZ.getPlugin(CombatLoggZ.class);
String noPerms = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("NoPermissionsMessage"));
String reloadMessage = ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("ReloadMessage"));
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
if(p.hasPermission("combatloggz.reload")){
p.sendMessage(reloadMessage);
plugin.reloadConfig();
}else {
p.sendMessage(noPerms);
}
return true;
}```