#help-archived
1 messages ยท Page 82 of 1
execute the command in code
would it work if the border was in a different world though?
should i use the worldborder api?
you should use the API if you don't want to do all the heavy lifting.
cool
Whats a good plugin to stop players from crashing the server
investigate what method they use to crash your server
//give player an iChest
ItemStack infChest = new ItemStack(Material.ENDER_CHEST, amount);
ItemMeta itemMeta = infChest.getItemMeta();
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("iChest.displayname")));
List<String> lore = plugin.getConfig().getStringList("iChest.lore");
for (String line : lore) {
ChatColor.translateAlternateColorCodes('&', line);
}
itemMeta.setLore(lore);
infChest.setItemMeta(itemMeta);
//set nbt tag
NBTItem nbti = new NBTItem(infChest);
nbti.setBoolean("isInfiniteChest", true);
infChest = nbti.getItem();
reciever.getInventory().addItem(infChest);
Any ideas why the &7 colour code didnt work
replace colors propely then?
Or use components...
string consider as if they are finals
all their methods that returns something returns a new string
so you'll have to pass it back somehow
immutable
Final means you can't redefine a reference, immutable means you can't change/mutate an object itself
i just couldn't find my words
Or use components...
Components?
Is it possible to create custom items as you do custom entities?
wdym
Hello, how can i repair crates from ingame command /cc list "broken crates"? Thanks.
Anyone knows how to get the UUID of an offline player in BungeeCord?
I'm making an mmo rpg plugin and I need custom items. They'll be based on vanilla items like custom entities are but have there own stats and abilities that pertain to that item.
how do i remove players from a scoreboard?
what's the legal way to do new Block()?
new Block(legal)
XDDD
we hereby sentence you to bucket kick
shit i knew i couldn't run for all this time
XD
ok
or commit game end
never mind, my entire system just crashed
sounds like a you problem not an eclipse problem ๐ค
bruh eclipse
everything is an eclipse problem
blame all on eclipse
even if you are coding with fucking scratch
it's eclipse's fault
I think like 80% of Mojang's code has been made with Eclipse
i'm moving to fortnite guys
I use Eclipse, nothing wrong with it
NO9
HOW COULD YOU
A VERIFIED MEMBER
USING ECLIPSE?!
we hereby sentence you to under an incoming train lie
well I use Apache NetBeans ๐คทโโ๏ธ
well i occasionally use notepad
i use np++
iM GONNA SWITCH
iM ANGRY
i lost a lot of work because i did such an act of TRYING TO COPY A FILE
Eclipse is a fine IDE
ye
I use it myself
You should use whatever you are comfortable with
it constantly crashes for me ๐
i like eclipse but it crashes constantly
I prefer it 
no you dont
now
go and sit down in a dark room with a cold flannel and an aspiriin
and reevaluate your life problems
i like eclipse because you dont need to open a terminal to build every time unlike.. other ides
m

eclip
how do I search a player's inventory for an item
while checking the amount too
Besides adding a note on a plugins discussion page and clicking the "report" anything else should I do for a plugin my host showed me has a bug in it creating ddsos attacks confirmed.
What does it mean by "This class is not legal for implementation by plugins!" in https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/RecipeChoice.html ?
Is anybody there who knows chunks? I made a queue system but it doesn't like I wanted to do... Queue place 1000 blocks per tick but it is still not great as I expected. I don't know the chunks a lot but I think we can set chunk bytes and send it as a generated chunk to player after placing.
Someone help me portfirward :(
How to I detect if a Block is fully-grown wheat?
rip
Anyone got a clue how to undo this? I'm using Intellij
I'm fed up of hearing that, do you not think i would have googled before i asked ๐คก
no
Hey guys.
Using a server resource pack, some clients work flawlessly and download and apply the resourcepack, but other clients are stuck on "downloading : 100%"
rip
the only correlation I see is that linux-based clients seem to work better.
Any idea why that would happen ?
Also, I can say that the clients getting stuck at "downloading : 100%" are not even trying to download the file.
I just reimported maven projects and its back ๐
server-resource-packs has been emptied, and the client rebooted
nice
so i've imported the inventory.event libraries from bukkit but it says event.getCurrentItem() is invalid
what do I do
Learn how to use the api ?
..
And how to ask for help :p
ok
ItemStack item = event.getCurrentItem();
import org.bukkit.event.inventory.*;
that is the right import, right
games released on steam using eclipse: Equilinox
games released on steam using intellij: none
๐ค
ItemStack item = event.getCurrentItem();import org.bukkit.event.inventory.*;that is the right import, right
@stark salmon
Which event are you in ? ...
Could you ban @ripe token , he randomly dmed me and tried to trade gta 5 for discord server boosts
boots ๐ณ
xD but i said good prize
Gta 5 is currently free on the epic launcher btw
yea but i don't said gta i said good prize
mhm
?
Edit this to change the output of the command!
mhm?
i'm downloading epic right now just for that damn free gta V
fuck my code just died, i used 1 deprecated method and shit hits the fan
The method getItemInMainHand() is undefined for the type Player
what do I do now
player getinventory getiteminmainhand
no problem
ok
Material
thank you
So for my resourcepack stuck at "downloading : 100%" error
turns out
stupid minecraft on windows uses SSLv3
when the server only supports tls 1.1 and 1.2
when you add an attribute to an item it gives you the text of "when in main hand..." and so on does somone know how to change that?
isnt SSLv3 a bit overkill for minecraft
yeah you really don't have a clue what you're talking about. It's fine.
i want developer to help me in my server
This channel is not made for recruiting.
How do I fix that ''waiting for chunk'' issue when generating new chunks with an elytra?
What could cause an entity's DataWatcherObject values to not be properly passed on to the client? For instance, when creating a custom horse entity, the horse will always spawn white, no markings, with no saddle, although all of these values are set prior to the spawning of the entity. The DataWatcherObject is registered in the initDatawatcher() method override.
hello, is there a way to add currnecy to the winner of bedwars ?
im using Screaming Bedwars and EssentialsX and vault
scre aming'
dont know
Obviously use the Vault API ?
@light crescent Idk but perhaps share your current code?
difference between?
Oh you're not a developer
nope
Makes sense then
just need help and im gone
Well does Screaming Bedwars has some sort of command execution on win?
it gives message and updates the leaderboard
what version?
latest
minecraft versions 1.15.2?
yep
Sure Conclure; I'll trim off the excess, non-related parts of the code so whoever reads isn't digging through a bunch of unrelated methods.
good
@west temple talk with the developer. He knows his config better than I do probably
nvm i found Vault Reward variable in the config sry
https://gist.github.com/IronApollo/9fac9f6674c07b875a9763ae7fb3e30e
PetEntity, PetHorse's super, is simply an extension of EntityInsentient that handles all changes every Pet will have to reduce boilerplate.
how do i make a tank
try {
PreparedStatement statement = Permissions.getInstance().mySQL.getConnection().prepareStatement("SELECT * FROM users WHERE UUID=?");
statement.setString(1, uuid.toString());
ResultSet results = statement.executeQuery();
if (results.next()) {
return true;
}
} catch (SQLException e) {
e.printStackTrace();
}
return false;
}```
for some reason this works usually but does not work on my new plugin
if (Methods.playerExists(player.getUniqueId())) {
Methods.createPlayer(player.getUniqueId(), player);
}
}
if (Permissions.getInstance().getConfig().getString("users." + player.getName() + ".rank") == null) {
UserManager.setPlayersRank(player, "default");
Permissions.getInstance().saveConfig();
}```
this is the method where it does not work
I've tried 3 different packets to cancel players from viewing there mining block status
this.protocolManager.addPacketListener(new PacketAdapter(this.plugin, PacketType.Play.Server.BLOCK_BREAK_ANIMATION) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
packet.getBytes().write(0, (byte) 0);
plugin.getServer().broadcastMessage("Block Break Animation (1)");
}
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
packet.getBytes().write(0, (byte) 0);
plugin.getServer().broadcastMessage("Block Break Animation (2)");
}
});
this.protocolManager.addPacketListener(new PacketAdapter(this.plugin, PacketType.Play.Client.BLOCK_DIG) {
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
packet.getPlayerDigTypes().write(0, EnumWrappers.PlayerDigType.ABORT_DESTROY_BLOCK);
this.plugin.getServer().broadcastMessage("Block Dig Listener (1)");
event.setCancelled(true);
}
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packet = event.getPacket();
packet.getPlayerDigTypes().write(0, EnumWrappers.PlayerDigType.ABORT_DESTROY_BLOCK);
this.plugin.getServer().broadcastMessage("Block Dig Listener (2)");
event.setCancelled(true);
}
});
Still doesn't seem to work?
am I writing the packets correctly?
is it possible to stop sounds from being played when a block has been burned
in 1.13.2 they added wool sound effect to block burned event
and its kinda annoying
no idea why they though its a good idea
there should be a packet
pertaining to sounds I believe
so i would use something like protocolLib
there is Player#stopSound
yeah but what good is that
thats just gonna stop the sound at any time
i just want it stopped when a block gets burned
this might be useful
Quick question, what's a VarInt Enum in ProtocolLib?
Most likely just a int
With the ordinal of the enun
PacketWrapper might wrap the enums, not sure
Only 1 way to find out ๐
I don't use protocollib anymore ^^
I guess once you get the hand of packets but I've only just started and gotta familiarize myself.
Also when I listen to packets am I required to sendServerPacket of that listened packet for example
@SneakyThrows
@Override
public void onPacketReceiving(PacketEvent event) {
PacketContainer packet = event.getPacket();
packet.getIntegers().write(0, 0);
protocolManager.sendServerPacket(event.getPlayer(), packet);
plugin.getServer().broadcastMessage("Block Break Animation (1)");
}
to sort of over-write it in a way?
15.05 13:07:42 [Server] INFO com.comphenix.protocol.reflect.FieldAccessException: No field with type int exists in class PacketPlayInBlockDig.
I don't hook into netty
I just hook into the server
In minecracts listener and in the send method
No need to fiddle with netty
Let's me access packets natively and shit
Integers dont seem to work.
My gues is to modify Block Break Animation (the status within that block)
and it constantly set it to 0 / starting value (pre) for each condition necessary.
Just look at the packet class itself
if block is on fire does that become part of its blockdata?
I'm pretty sure fire is a block no?
o
yeah
so i need to check if block face is fire
Fire actually has like a million block states
does anyone know a way I can get a random item from a loot table
populateLoot and then pick an item from the resulting collection
ok
i try to make a collection but i dont know which library it's in
and I cant figure out how to access populateloot, i have the javadoc open and it wont show it's parent
populateloot returns a collection
how do i make a tank
i did LootTable.populateLoot and it says it's not existent
I have LootTable in my imports
if I wanna get END_CITY_TREASURE how would I go about doing that
you can also make your own LootTable too
Collection<ItemStack> col = LootTable.populateLoot(LootTables.END_CITY_TREASURE);
what about this
it says that's not applicable as an argument
oh random
i need to look at the arguments on the javadocs
what is a loot context
public class BreakBlock_FireEvent implements Listener {
@EventHandler
public void blockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
if(player.equals(GameMode.SURVIVAL)) {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "execute at @p run summon minecraft:tnt ~ ~ ~ {Fuse:80}");
}
}
}```
wut do wrong
Tryna fire a command everytime a block gets broken in survival
player.getWorld().spawnEntity
yeah that would be better to use
reason that doesn't work is @p doesn't mean anything from the console
you could replace it with the player name instead
how do I call populateLoot if it's non static
@ Inkzzz i have a simple question regarding resource rules on the spigot website; a second of your time please?
its regarding an already existant resource that may be breaking that rule, if existant
how do i open a report?
click the button that says 'report'
on the resource page
oh my bad
what is a loot context
is there any other way to get this question answered though
i'd like to talk to the author before throwing a report at him
send them a message then
i thought that if i cancel the blockburnevent and set the block to air manually it would not play the sound
i thought wrong
how many years u have?
Why would i tell you that
why not
40 years of experience apparently and doesnt know difference between singletons and constants
omg
does anyone know how to use populateLoot?
I have no idea how to use it from the javadocs
Apparantly you need a lootcontext but a lootcontext doesn't take a lootTable as an input
i have no idea either i dont think anybody knows here
singletons and constants aren't even similar, who can confuse them ๐
just better to watch a video
LootTables.WHATEVER.populateLoot(new Random(), new LootContext.Builder(location).build())
like ever
and no i don't care that i'm constructing a new random every time
can I run that from the console
wat
well I got it working but confused how to make it so the tnt only happens in survival
Doesn't do anything with the if statement
works w/o it
public class BreakBlock_FireEvent implements Listener {
@EventHandler
public void blockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
Location loc = player.getLocation();
if(player.equals(GameMode.SURVIVAL)) {
player.getWorld().spawnEntity(loc, EntityType.PRIMED_TNT);
}
}
}```
and populateLoot is part of LootTable
The hell is that naming syntax
bit new to java and just started spigot today
@languid gyro how the heck is a player going to equal a gamemode
your ide should be highlighting that yellow
oh yeah
if it's not, install intellij
using intellij
player.getGameMode() == GameMode.SURVIVAL
konsolas , any ide would higlight that
well it should be yellow then
thanks
and next time something's yellow, try and find out why the IDE is making it yellow first
98% of the times IntelliJ is correct
player.getGameMode() == GameMode.SURVIVAL), another dude comparing enums with .equals
@languid gyro
why does it matter that much its going to have the same result in that instance
You are genuinely retarded, it doesnt have the same result, in the first place the equality operator is faster, in the second place its safer at compile time, its safer at run time, and it prevents null pointers
there are plenty reason why you have to use == for enum comparing
also, there is no needed for .equals since there is only one instance
but its still gonna have the same result
๐คฆโโ๏ธ
there'll be no difference in speed because there's no way the JVM doesn't inline that
null safety is the only semantic difference, but getGameMode is guaranteed not null anyway
Read my message weirdo, and there is difference in speed
so really it just looks nicer
method is different than an operator
You are genuinely retarded, it doesnt have the same result, in the first place the equality operator is faster, in the second place its safer at compile time, its safer at run time, and it prevents null pointers
@frigid ember
You think using == and .equals will have same result?
i say, no.
@silk bane I mean comparing null with .equals will throw an null pointer
Yeah got it tho
there is so many reasons why not to use .equals on enums
@brisk mango that's correct, but in this situation, https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/HumanEntity.html#getGameMode--
its not the same
it's not null
there is nothing like a certain situation
im not talking only about null
im talking about many other reasons
read my message above
that its faster, safer at runtime/compile time
it's not faster, the only 'safety' is null safety
hey im having trouble with the plugin : mob headsthe heads are not dropping how to fix
i do have permsission and looting 1200 to see the mobhead plugin if its on as i saw its off how to fix
get a grip
wowow hold your horses, how is an method faster than an operator?
are you aware of the jvm?
yeah, aware of that
but are you aware that an operator is always faster than an method?
I'm getting closer to getting the loot table items
the method will almost certainly be inlined by the jvm, and be equal in performance to the operator.
and thats not right.
LootContext lc = new LootContext(null, 0, 0, null, null);
Collection<ItemStack> col = LootTable.populateLoot(new Random(), lc);
(the lootcontext is just placeholders for now)
alright then.
what i'd expect from some random spigot developers
that have 0 java knowledge
and havent taken regular java courses
msws do you know how I can get a random item from a loot table into an item stack
Method is always slower than an operator @torn robin no matter what
im gonna have a STROKE and i dont understand the javadocs
ok Iโm sure thatโs probably true but it also sounds very trivial
then dont say non-senses
cark is there a getItemStacks method or something?
I mean use InventoryClickEvent
Hey, anyone know if there's some lag between the pushes to the maven repo, and the updates tohttps://cdn.getbukkit.org/spigot/spigot-1.15.2.jar ?
I'm getting 'method not found' on my server (itzg docker image, pulls from the cdn on startup) for Pig.setAware(false). It compiles just fine with my local gradle build, which pulls from the maven repo / buildtools.
idk theres populateloot but you need some weird ass variables and inputs that I dont know how to get
and get the current item that returns an ItemStack
what was are you able to get the items in the loottable
hm?
@celest light setAware or setAi?
@torn robin setAware is the method I see in my local environment.
It doesnโt look like you can get a random item from a Loottable
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/loot/LootTable.html
@NotNull Collection<ItemStack> populateLootโ(@NotNull Random random, @NotNull LootContext context)
Are you sure about that
I've got this in my gradle dependencies. compileOnly 'org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT' so I think I've got the latest locally.
Oh no you right temedy, thought that was directly linked to an inventory
zip is aware the same as AI?
idk how to use that tho, you need a lootcontext which is batshit insane
if so Iโd just use that for now
Just create a new one
The java docs probably say how
i did but idfk how to use it if i wanna run it from the console
oh
i didnt see that
new LootContext.Builder().killer() etc
@torn robin ok, I'll switch to setAI. Weird that there's some difference though, suggests some kind of version mismatch.
Is there a reason the maven repos only have snapshots and no releases? I feel weird using a snapshot when I'm not trying to contribute to spigot, just write some mods.
Where exactly do you see setAware? The maven or the docs?
it needs an entity
And I wouldnโt know anything about snapshots
that would make sense cark, where else are you getting the loottable?
Two places. First, IntelliJ includes it in code completion (and it compiles successfully). Second, in the mob javadoc here:
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Mob.html
i want to be able to grab a random item from a chest loot table
are those entities or something?
like end city loot
Yeah that is strange idk zip, someone more knowledgeable would have to look into it
downsides of this? .getAttribute(Attribute.GENERIC_FOLLOW_RANGE).setBaseValue(0);
i want to basically remove a hostile mob ability to attack stuff
new LootContext(location, luck, null, null)
@torn robin thanks for the heads up on the setAI, that's probably what I want anyway.
why and how are you running stuff through console
no problem, they don't do the exact same thing but it's hopefully close
why couldnt you
i mean like im puttting this in a command that i want to run from console
Wdym they dont do the same exact thing
hej, so i made a custom enchant but how would i go about adding it to an enchanting book?
How doesnt running a command from console do the same thing as running a command as a player
well there isnt a location tied to it right?
๐คฆโโ๏ธ
I thought he meant he's running the function itself as a command
Temedy, you dont get stuff like location, some data and world
temedy if the command executes different code depending on the CommandSender?
Seemed not so obvious to you
what are you trying to do again cark?
^
you're trying to get the loottable of what?
LootContext is not a constructable object, Panda
run a command that grabs a few random items from the End City Treasure loot table and put them into my Auction House whenever I run a command
It is a constructable object @subtle blade
@subtle blade LootContext.Builder?
LootContext is
builder requires a location parameter as well
how come i can construct it then?
Well if its not a constructable object, how can I construct it then?
Well you're a fucking wizard
it looks like you can use the Enum LootTables.END_CITY_TREASURE to get the loot tables
ah it does have a private constructor
That is a private constructor
can I make an array of itemStacks from a loot table?
I wrote the loot generation event, I know how the loot API works lol
yes
ok
nice method calls from constructor
does the enum contain the data of the loot table or is it only a "signal" to what type of loot table you want
You would fill a collection with lootTable.populateLoot and then get a random item from that collection
Try LootTables.END_CITY_TREASURE.getLootTable()
Ok
Yes, populateLoot() is what you'd want
Fucking eclipse crashed
Spigot Version Notch vs Wizard
eclipse
aghghg
lol
Intellij idea is better ;o
whats wrong with eclipse lol
everything
yes it is :]]]]]]]]]
intellij > eclipse
eclipse
worst IDE to be ever created
I can't figure out populate loot
lol my gatekeeper detecter is going crazy
what are you trying cark?
well not the worst for basic java is it quite good
it is worst
"basic java"
eclipse is an piece of shit
it does it's job
I dont know what to pass to the LootContext
people use eclipse u know
noob devs use eclipse
arguing about IDEs is stupid
can you try using null?
so it must be worth something
its not stupid
ok
stop gate keeping
it does it's job
@tiny dagger yes
@brisk mango that isn't quite accurate
you have no idea what youre talking about @brisk mango
Eclipse is fine
u can't use null as a location
but then how does populateLoot know which table to use
it's not null
LootContext != LootTable
eclipse is generally known as really bad IDE, people used eclipse before intellij came out, also intellij is very faster and way more stable IDE
you're getting the loot from the loot table and it's asking for the context
wdym i have no idea what im talking about @boreal tiger
ohhhh
probably noobie plugin dev that uses eclipse defends it
Intellij uses more memory. No thank you. I need the spare performance.
makes sense
LOL @marsh nova weirdo
Maybe you have a very powerful laptop. I don't
IntelliJ requires more memory and doesn't have the simple overall project view like Eclipse has.
new LootContext.Builder().killer(player).build()
you could try that if null doesn't work
the gate keeping is real
The gate is busted wide open and temedy is left behind.
whats gate keeping?
and if that doesn't work or if it needs a specific entity then I doubt it would work
The constructor LootContext(Location, float, int, Entity, HumanEntity) is not visible
yeah, because private constructor
ok
the activity of controlling, and usually limiting, general access to something.
new LootContext.Builder().killer(player).build()
basically when someone wants you to use something because they think its better and limits you to that option
aka temedy's messages
You only hem yourself in
you're the only noob here @brisk mango
Ah plugin noobie developer that has no java knowledge is calling me an noob
interesting
temedy, the irony is that of all of us you have demonstrated the least knowledge.
temedy well it's a fact IntelliJ idea has more to give but if you're going to argue please do it factual. It's overall just annoying when someone is arguing with insulting arguments.
why would I do that when its litterly known that its better
I don't find it annoying. I find it amusing.
you can find the reasons urself
"its litterly known that its better"
Doesn't mean everyone can find it?
What a nice, well-reasoned statement.
how would i make a minecart veihcle
- calling other people "noobie developers"
yeah i assume youre one of them @boreal tiger
ooh im a nooooooooooooob
I bet your chatcontrol plugin is good
Hey guys, how do I read this, I don't get how to read the parameters https://wiki.vg/Protocol#Map_Data
PacketPlayOutMap map = new PacketPlayOutMap(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
Yes all of the developers here are noobs except the great temedy who has so much experience and is entirely logical.
@brisk mango be helpful. Tell the "noobs" why IntelliJ is the superior. Don't just say noob. It might not be obvious for them.
All hail temedy the magnificient.
Im not calling them noobs because theyre using eclipse
Hey, can you move the arguments to another channel not named 'help'? They aren't helping.
A248dnes v 4:35
public enum SomeEnum {
VALUE1,
VALUE2,
VALUE3
}
that is not a singleton
there are 3 instances of SomeEnum
I think youre missing some java knowledge here @marsh nova
That's correct
I strongly recommend using PacketWrapper
our lord and saviour temedy has 3 "auto message" plugins and calls other people "noobies"
SomeEnum is not a singleton.
There are 3 instances of that class.
HAHAHHAHA
You couldn't get that right.
actual noob
You didn't know what a singleton was.
Guys this is #help-archived not #insult
Yeah I did
^
you didnt
just wanted to point that out
You thought that #equals produced different true-false results than == for enums.
@brisk mango love your 30000 nested if statements on your plugins
It's not really an instance. an enum contains enum elements or fixed constants
Quite disappointing.
They are technically instances of the enum class.
it doesnt have the same result, in the first place the equality operator is faster, in the second place its safer at compile time, its safer at run time, and it prevents null pointers
@marsh nova
this is an explanation why
Very shit code @boreal tiger
It does have the same result. This has been explained. #equals uses the same code as == in the implementation.
i dont have any plugins
those are very old
That's a big L for temedy the magnificient.
=='s should be used over .equals for enums
exposed
old?
Jan 17th, 2020
boy ur getting called out bad ๐
MSWS, we talked about that a while ago, I said that I preferred ==, but #equals was fine, however temedy insisted that #equals was wrong.
very good indeed. I love his nested if statements
Hey guys, how do I read this, https://wiki.vg/Protocol#Map_Data
equals() isn't inherently wrong, but when it comes to comparing constants, use ==
@torn robin you're completely right, but because of the jvm, the performance difference is negligible
equals() defaults to just ==
@Phaze https://github.com/dmulloy2/PacketWrapper/blob/master/PacketWrapper/src/main/java/com/comphenix/packetwrapper/WrapperPlayServerMap.java
I strongly recommend using PacketWrapper
But how do I read that wiki though
what isn't clear about the wiki?
Its actually not only about performance, but its about that using == on static finals is a common practice @silk bane
Map Data is ID 0x27 (byte value), its state is Play and it's bound to the client
It is common practice to also use enum.equals, but temedy insisted it was incorrect.
Also, 3 constants are not 3 instances @marsh nova
it has many fields each with different uses, the Map ID, Scale, etc.
On the contrary, enum constants are instances of that enum class.
@torn robin how do I know what all this stands for?
Otherwise they wouldn't be type-safe.
PacketPlayOutMap map = new PacketPlayOutMap(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
That's why I recommended using the PacketWrapper
#help-archived = a channel to get told off
it allows you to create a new mappacket with easier argument names
Yes, PacketWrapper is very good for starting with packets
I recommend it
The method names are readable and understandable if you are new to using packets
I'm looking for a way to store some information between commands.
In this case, I've got one command to create a 'target' , and another to spawn a wave of zombies trying to attack that target. Where do I put the 'target' id (or reference) so I can get it in the second command call?
If there's a guide for this kind of thing, a link to that would be great too.
I mean you could create a static variable in the main class?
Oh yeah. Static stuff feels a little ugly but appropriate I guess.
or have the method spawning the zombies with a target player parameter?
ugly?
spawnZombies(Player target) to simply call it?
There's just usually soem gotcha with static stuff. Threading, or ... in htis case, probably wouldn't stick around through a server restart.
If you're going to save a reference on main make a getter and a setter perhaps?
@vernal spruce Sure, that's how I have it but I'm not sure how to get the target on the second command call.
This isn't so much a Java question as a bukkit/spigot question.
the second onCommand invocation won't have any knowledge of the pig created in the first one.
first.. why you need the target on second call?
In minecraft, it looks like:
/createArena
/spawnWave
The arena call creates the target,
*arena command
and the wave command spawns a wave of attackrs.
why uppercase :/
then save it in a static hash map on the main class
dont do that
I'd like for my players to defend the same target against multiple waves, eventually.
encapsulate a hashmap then
(ok, but case isn't what I'm asking about here)
donโt make it static
sounds more like a object focus
im going to re-ask if thats ok, i made a custom enchant and i would like to add it to an enchanted book to add it later to a pickaxe or something, how would i do that/go about doing that?
rather than method/variables
ok, static map is the simplest thing that might work. I'll go with that.
@split oxide by custom you mean it's extending Enchantment right?
@torn robin I'm so confused how to use packet wrapper, how do I send the packet to the player?
WrapperPlayServerMap map = new WrapperPlayServerMap();
map.setId(view.getId());
map.setZ(10);
map.setX(3);
((CraftPlayer) p).getHandle().playerConnection.sendPacket();
this sounds more of a object problem rather than anything else
private Map<K, V> map = new LinkedHashMap<>();
public Map<K, V> getMap() {
return this.map;
}
@frigid ember how are you receiving packets?
@torn robin i made a custom enchant by extending Enchantment, yes
I would personally use protocollib but i'll check without
ok @split oxide , you should look into https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/meta/EnchantmentStorageMeta.html then
@celest light
you might need to manually apply the lore but it should function as expected
Thank you!
๐
msws
@naive goblet Sure, but I might as well just keep it as a typed variable. The map isn't really adding anything:
private static LivingEntity target = null;
are you the guy working in the anticheat plugin?
And I assume it needs to be static? I don't know the lifecycle of the plugin instance.
Why static jeez
it doesn't need to be static nor should it
because static is nice
is it hard to make anticheats? I've never tried
static will be kept it in memory and won't be gc'd for instance.
static is nice
lmao
yes if you use it correctly
When does the plugin instance get destroyed and recreated?
Not like creating a static plugin instance.
static is never nice @pastel condor
@sturdy oar it's hard to make one correctly
use dependency injections always for plugin instances
the one I made doesn't have the best baseline but I've been able to improve it
is NCP a good source to look at?
fierceeo constants, fine but else no we don't need it unless very specific stuff like the static block f.i.
I don't have a DI container in my itzg image, and not inclined to modify it to add one.
Singletons are never better than dependency injections, dependency injection is more testable/reusable, explicit cohesion and defined ordering of how classes are used
idk I just used it for my hash map though @naive goblet
@brisk mango only a Sith deals in absolutes.
yes
Never make collections static
static HashMap<String, Integer> addFriend = new HashMap<String, Integer>();
I'm not building in a DI container for my 40 lines of plugin code. DI is important, as is the rest of SOLID, but there's a time and place.
Wdym by DI container
like
No, that's why people should use it lol
private final Main instance;
public ClassName(Main instance) {
this.instance = instance;
}
how does this take time and place
so much better than using a singleton
nooo I use a static instance ```public class Main extends JavaPlugin {
private static Main instance;
public static Main getInstance() {
return instance;
}```
jesus
Oh I think we went through static collections as well.
Read why not in my message above
There are some times where you might want to use a static collection, particularly if it's also final and immutable.
^
I think he means stuff like strings ๐คท
Yet you claim to be an experienced developer.
@torn robin i dont really know how to add it :]
any code?
How does being not that good at english have to do with java knowledge? are you brain damaged @marsh nova
MSWS what's the issue?
they want to add a custom enchant to a book
Ah NBT ?
shouldnt need to use that
Immutable is frequently used in javadocs. It's common terminology. Any experienced java developer knows what "immutable" means.
Player player = (Player) sender;
ItemStack book = new ItemStack(Material.BOOK);
EnchantmentStorageMeta esm = (EnchantmentStorageMeta)book.getItemMeta();
esm.addStoredEnchant(ench, 1, false);
book.setItemMeta(esm);
player.getInventory().addItem(book);
``` something like this?
idk I mean it that way we can ensure the ebook contains the enchant
EnchantmentStorageMeta should cover it
No, it's called immutable.
Strings are immutable; there's a basic example.
Immutable is a very common term any experienced Java developer would know.
Kotlin is java
Java, I meant in Java
I mean i use terms in my language not in english language @marsh nova
kotlin is fake java
xd
so that every experienced developer should know is not true
I'm sorry if you're not an experienced Java developer temedy.
That's okay
You don't have to worry
temedy that's like saying I don't know what a String is because english isn't my first language
Hey guys, if I'm making per player maps, will my server lag if every player has their own map?
but if i run the command that gives me the book it gives error: class org.bukkit.craftbukkit.v1_15_R1.inventory.CraftMetaItem cannot be cast to class org.bukkit.inventory.meta.EnchantmentStorageMeta
this guy is just actually fucking incredible lmao, youre actually being like a kid that has no fucking idea what is he doing
@frigid ember depends on what is inside
This is so funny.
indeed
Phaze eventually if the Map contains like 100 elements
skyblock uses per player world wich shouldnt matter much
but it should be pretty fine
๐ฟ
calm down temedy
what code do you have @split oxide ?
Player player = (Player) sender;
ItemStack book = new ItemStack(Material.BOOK);
EnchantmentStorageMeta esm = (EnchantmentStorageMeta)book.getItemMeta();
esm.addStoredEnchant(ench, 1, false);
book.setItemMeta(esm);
player.getInventory().addItem(book);
``` something like this?
this
Map is a very good datastructure to control players etc
ok yeah enchanted books got their own meta
is that in 1.8 R3 as well?
no
or 1.8.8
String is a java term not an term in a language @torn robin
no?
1.15
aww rip
is immutable not a java term
Immutable is a java term as well.
mswq it is
In face, immutable is in the String documentation.
Immutable is used all over javadocs.
Immutable objects help in concurrency-oriented programs.
@split oxide you have to use ENCHANTED_BOOK not just BOOK
No, final and immutable are different.
Why does my map sometimes do this?
@EventHandler
public void onMapInitialize(MapInitializeEvent event) {
for (MapRenderer renderer : event.getMap().getRenderers()) {
event.getMap().removeRenderer(renderer);
}
final WorldMap worldMap = (WorldMap) MinecraftServer.getServer().worlds.get(0).worldMaps.get(WorldMap.class,
"map_" + event.getMap().getId());
event.getMap().addRenderer(new CraftMapRenderer((CraftMapView) event.getMap(), worldMap) {
int i = 0;
@Override
public void render(MapView map, MapCanvas canvas, Player player) {
super.render(map, canvas, player);
if (c.get(player) == null || i % 8 == 0 || i == 0) {// reduce lag
for (int i = 0; i < worldMap.colors.length; i++) {
worldMap.colors[i] = 0;
}
c.put(player, player.getLocation());
map.setCenterX(player.getLocation().getBlockX());
map.setCenterZ(player.getLocation().getBlockZ());
mapUpdater.update(map);
}
i++;
}
});
}
Final means the reference can't be re-assigned.
this is how it should look
Immutable means the data stored in the object can't change.
For example, a final HashMap is final but mutable.
A non-final String is immutable but not final.
@torn robin
Constant means the variable stores something that can't be changed and the variable itself can't be re-assigned as well. ;o am I right?
you might have to look into PrepareAnvilEvent https://www.spigotmc.org/threads/custom-enchantments-in-an-anvil.190715/
I think it means the value of the variable is already known at compile time
Yes, that's a better definition.
Hmm yeah and shouldn't be changed as well
i will take a look, thank you
For example, public static final int FIVE = 5;
Math.PI is another example.
Those are constants.
obv
Math.E
Math.L
L from what?
for me :i
xD
yeah there are 'true' final variables, and 'fake' ones,
final long time = 5 + System.getCurrentMillis(); is an example of fake one
while final long TIME = 25L is a true one
Both of them are final, but the latter is a constant.
and that's where kotlin has its own keyword
I think java doesn't because it automatically recognizes it
Java doesn't have that keyword probably just because it's Java
Well I mean yeah probs. Well it might make it more clear faster which ones are constants and which ones aren't
I have one question for you all:
I've been recently trying to implement various databases, I've looked at the most common ones, and I was shocked to find 'Oracle' at the first place in many different places. The weird thing is that I've personally never seen anyone using it.
Is it just not very used in the minecraft environment?
anyone know how to create custom mobs, I have the models already, I just dont know how to kind of put them in game
if you want to make real custom mobs you'll need NMS, it depends on the way you implemented them
have you done them before
Yep, probably my main business
ah perfect, any chance i could add you to a group with someone?
sure
Hey guys, can someone help me, my maps are lagging out my server alot!
is there a timings API for spigot? i.e. can i measure things that my plugin does and have it show up on the timings report?
1
I don't think static maps lag out servers?
oh, yeah
Anyone know how I can place a custom banner object? I want to use a custom design and place it using the api, but as far as I can tell I can only set the design on an ItemStack and have a player place it.
Idk if BannerMeta is a thing
It is, but I have to set it on an ItemStack
And I need to be able to place it using a location
Does anyone know what file contains data about villagers?
@crimson cairn Maybe not lag out but it exist other reasons why it shouldnโt be used. Especially in generics.
@storm vessel why do you need it?
Thanks
One of my devs fucked with the world files and now villagers are gone
I have backups from a few days ago but I don't want to roll everything back, just the villagers
Hmm should maybe be in the regions but I am extremely unsure
Yeah
also resets the chunks in that region file as well
but hey, if it works for you, then I guess no need to worry XD
I mean that dev seemed to be experienced ๐ค
Anyone knows the amount of armor stands in a chunk to make the performance bamboozle?
guys how to get the UUID of a mob
i downloaded the plugin ultimate mob head fork but when i get chicken head i get steve head named chicken head
Entity#getUniqueId
how to get the uuid of a chicken to put it
Entity#getUniqueId
@naive goblet what that
send ur current code
b0b18a7e-49af-452e-afae-56554ac259d1
when i kill a chicken i dont get the chicken head
i get steve head named chicken head
its the only head with a problem
is the version you use,supported on the plugins page?
If I get banned, but I have put a plugin on spigot, where will go that plugin?
will it remain but not editable?
don't get banned
I asked for delete my acc, but no one has anymore replied me
so i try to get banned, so you delete my acc..
your name sounds like it's a reason alone to get banned imo ๐
(I read the thing of ban for multiple accounts after I created my second)
so I need to delete it
Some staff that helps??
how did you ask for it to be deleted?
just report your second account
@tiny dagger I sent an email and I wrote it here
heeeeeeeeelpppppppppp meeeeeeeeeee plzzzzzzzzz
I would like to post my plugin
Just do it?
those can take up to 1 month lol
but idk if(if they ban me for multiple accounts) the plugin will remain but I won't be able to modify it
oh yeah floats..
can someone help me? I installed spigot and it has somehow reset my world files for the nether
i just tried installing from my backup but it isnt doing anything
okay region file is what keeps your chunk data