#help-development
1 messages · Page 440 of 1
i check it out
That’s
Not what that does
Player player is pattern matching with instanceOf
That won’t give you a variable of type player
🤨
Well yeah that works
But do you have a variable of type player
Sender doesn’t have the same methods as player
Hi, does anyone know why this doesn't remove the item from the player's inventory?
It drops the item, but it's still in the inventory.
public static void dropItem(Player player) {
player.dropItem(false);
}
What do you mean?
See the link I attached, it drops the item but it stays in the inventory
ok why do you need to make a variable for player
As far as i can see its only a ghost item bc when you click at it in the inv it disapears
I've fixed the issue by adding player.getInventory().setItemInMainHand(null);
why is your method in UpperCamelCase
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
Yeah I know I wanted to get rid of it :P But I fixed it so it's all good
If you were talking to me, I needed to target a specific player and I just pass the reference around
Can someone help me with this?
I do this
sender instanceof Player player to not do Player player = (Player) sender
shaded it?
class
a
which class
that is a line from OrmLite wait
public QueryBuilder<T, ID> orderByRaw(String rawSql) {
this.addOrderBy(new OrderBy(rawSql, (ArgumentHolder[])null));
return this;
}
i diddnt wrote that either thats a libary to handle sqlite databases
name: MCMania
version: '${project.version}'
main: de.mcmania.mcmania4.MCMania
api-version: 1.19
authors: [ LinusHuck, Rin ]
depend: [ RegionManager ]
commands:
player:
description: Manages player
usage: /player <name> <info | permission | reset> <more arguments>
uhc:
description: Manages UHC
usage: /uhc addCurrentLocation
itemfinder:
description: Manages ItemFinder
usage: /itemfinder addCurrentLocation
manager:
description: Manages the plugin
usage: /manager
vote:
description: Manages votes
usage: /vote
settings:
description: Manages the settings
usage: /settings
points:
description: Manages the points
usage: /points
Have you shaded the library
?
Btw somethimes the shutdown workd somethimes not
it says that it could find the ColumnNameOrRawSql.class
it gets incuded by maven
which code
<dependency>
<groupId>com.j256.ormlite</groupId>
<artifactId>ormlite-jdbc</artifactId>
<version>6.1</version>
</dependency>
Main class is not relevant here, either you didn't shade class or that library inject class during runtime, that can be problem with spigot classloader
so how do i fix this
Idk, make sure you are shading class that is missing first
And that you are using right jar
If class is there, library is probably injecting during runtime what can be problem
Again, idk how that library works internally
But I would guess you just didn't shade it
what do you mean with shading?
I did this and it doesn't work
public class playerMessage implements Listener {
@EventHandler
public void playerAutoCorrect(AsyncPlayerChatEvent e) {
String message = e.getMessage();
if (message == "wlc") {
e.setMessage("Welcome");
} else if (message == "by") {
e.setMessage("Goodbye");
} else if (message == "wsp") {
e.setMessage("What's up");
}
}
}
did you register the event?
Yes, like this
public void onEnable() {
getServer().getPluginManager().registerEvents(new playerMessage(), this);
}
use .equals
You can’t compare strings with ==
you cant compare with ==
?conventions
https://paste.md-5.net/asodihonov.java
anyone know how i can register this command in plugin.yml?
spawn:
description: Teleportuje cie na spawn
I mean how to add a args in this
idk how to name it
ok i will test
Thanks for this, too
yea its works
but how i can create a tab auto complete
so when the user type /spawn and press space /spawn the arguments will show on
help and reload
implement tabexecutor
instead of this?
yes
if (args.length == 1) return new ArrayList("help", "reload");
bro uses the C# theme wtf
its red
idk how to write it correctly
Arrays.asList(...)
why is the event not cancelling?
https://paste.md-5.net/aguyonisuh.java
you made a constructor in your plugin class
?paste
I'm trying to use the WorldBorder object to display a virtual border to a player. I'm creating and displaying it like this, but I don't see the border. What am I missing?
https://paste.md-5.net/qaziduyedu
Hey, I have this method for updating inventory titles, it works fine with regular color codes but when I have HEX Colors, it doesn't work (in 1.18 hex works, in 1.19 it doesn't)
https://paste.md-5.net/qineboyina.js
if in Bukkit.create Inventory(holder, size, title) title be null then it cause error or ignore it and set name as default inventory
It isn't null
^ Last message in chat is the same variable as newTitle in https://paste.md-5.net/qineboyina.js
Bukki.createInventory(holder, size, null) cause error or ignore it?
What do you mean?
nvm
What's the method I have to use to create a task in 1.19?
Few years ago, I was using Bukkit.getScheduler().runTaskTimer(plugin, runnable, long, long) but this function is now deprecated. What's the solution now?
BukkitRunnable
What I have to do with this class? May I create a class that extend BukkitRunnable ?
BukkitRunnable runnable = new BukkitRunnable() {
@Override
public void run() {
currentTime = System.currentTimeMillis();
updateScoreboard();
}
};
task = runnable.runTaskTimer(ManHuntPlugin.getInstance(), 0L, 20L);
like this ?
Yeh
Ok ok thanks
Indeed, that's simpler. Thanks !
Is there a way to cast Chest, Barrel, and Shulker with the same class?
from: java Chest chest = (Chest) chestBlock.getState(); Barrel barrel = (Barrel) barrelBlock.getState(); ShulkerBox shulker = (ShulkerBox) shulkerBlock.getState(); to: ```java
ChestShop chest = (ChestShop) chestBlock.getState();
ChestShop barrel = (ChestShop) barrelBlock.getState();
ChestShop shulker = (ChestShop) shulkerBlock.getState();
how can i do this?
Is it possible to change the name of a inventory after it was created?
like on hypixel the bazzar catogory changing title
only with packets
ok
By using the Container type instead?
Container chest = (Container) chestBlock.getState();
Container barrel = (Container) barrelBlock.getState();
Container shulker = (Container) shulkerBlock.getState();```
There is no ChestShop type. It doesn't exist in Bukkit
maybe he's creating his own class?
That's not how Bukkit block states work lol
I am making a mining server with a mining plugin and when you break a block, you get blocks if its the right block and the event is not canceled.. I use worldguard to make sure the map that I dont want you to break is not getting broken, so in my block break even I use if (event.isCancelled()) {return;} even if this is there, if someone breaks a part of the map I dont want them to, worldguard stops them but they still get the blocks and the part of the code after the event.iscancelled if statement still runs, ive tried making the block break event priority lowest but that didnt work. Anyone know how I can fix this problem? (Ive also already tried delaying the stuff from the if statement to the end where all the block giving happens but that for some reason makes it where you never get any blocks if you mine)
I was guessing he wanted a generic class to handle all those types
or wanted to save, or something
Rather than checking isCancelled just add ignoreCancelled = true to your @EventHandler
Ignores cancelled events
Also, lowest = called first, highest* = called last
WorldGuard should be listening on low priority, though I'm unsure if that's the case. If not, then you can listen on high
Is there an easy way for an RNG based system to detect cave systems in a region?
E.g: If you wanna make ap lugin that will add X thing into the cave on a trigger (like a command)
Cave air?
I don’t remember if it even uses cave air anymore
True, but not in every cave
oh..
I was doing it wrong then
I tried this and it didnt work..
ima try with highest prio and ignore cancelled
So I'm kicking a player right when they join, and this error is being thrown. It doesnt cause an issues other than flood the console. Any way to fix this?
Two options. (a) Prevent the login from the login event, or (b) delay your kick by one tick
Thanks <3
thanks, it worked
How can i hide a player nametag but only client side?
This is what the problem is:
// Create the packet
// packetPlayOutOpenWindow is a MethodHandle
Object packet = (useContainers()) ?
packetPlayOutOpenWindow.invoke(windowId, object, title) :
packetPlayOutOpenWindow.invoke(windowId, object, title, size);```
`title` works actually fine with normal bukkit color codes, but it won't show the HEX Colors while they are in the `title`, they get translated automatically to normal Bukkit Color codes. How can I fix that? *I use this method to update the inventory title*
didn't know bukkit invs supported hex/components
Timo — Today at 2:41 AM
Is it possible to show HEX colors in Inventory titles?
Coll1234567 — Today at 2:41 AM
Sure
OmegaWeaponDev — Today at 2:42 AM
Yeah it is, I've done it multiple times.
Ideas?
How do i only get the blocks between, not the road on the side, of the plots (List<Blocks>)?
Hello man ah do you mind if i ask you to teach me java please 😭😭
free java lessons
wdym
I did not understand either
When mannwhenn
rn
Help, I am creating a type of infection which makes him tired and weak, but there is a problem which is that I do not know how to verify if the player already has the vaccine so that it does not give him the effects
I thought of doing the verification with scoreboards but I've never used it before. Does anyone have an idea how to do it?
How do i send a packet to spawn a entity in NMS?
PersistenDataContainer
hola tetuis
si justo la acaba de poner
?pdc
igualmente gracias
Why is PlayerPickupItemEvent deprecated?
because its now EntityPickupItemEvent iirc
How can i spawn a client side ArmorStand using NMS?
thanks
are you on 1.19.4?
if you need it for text, use the new TextDisplay stuff
if not then idk
how to fix this error https://paste.md-5.net/naviledoju.css
whats plugin already initialized means
its means i have to initialize my instance ?
Listen for PlayerinteractEvent
It could be done with BlockEntityTag but i'm looking if there is any way to do it faster
Did you initialize your plugin twice? Two JavaPlugins perhaps?
no my plugins are
placeholderapi, vault, myplugin
Two classes extending JavaPlugin within your plugin I meant
you don;t extend yoru main
How i can set the lore of item?
itemMeta.setLore("kliknij na mnie");
I using this and the red line appears
Its a List
Just use Arrays.asList(new String[]{„first line“})
I would try to cache the list if possible
@mint nova
How to do that?
lore.add("line1");
lore.add("line2");```
Oo
itemMeta.setLore(lore); then
You have to insert something in <>
import List
Try to Give the datatype to it
yeah you just gotta import the List class
giving the datatype is irrelevant
if you have 2 eyes you can figure out that add is in red, and not underlined
But only the <> seems to be marked
Oo now its working
that's because you never used an IDE in your life
otherwise you'd know that the <> type can't be resolved because List is not there to help it out
if anything turns bright red, something fucked up
in this case the word List was bright red, so it probably couldnt find wtf a 'List' is
meaning you were missing the import for it
Pff that’s so subjective, every IDE has its own way of handling linting
I'm not here to argue
hmm yes, I prefer my ide to have no linting
always find the first red, after that the IDE is guessing so you can ignore until you fix the first
and pray whenever I compile
😂
crazy to think that 3 years ago I didn't know what a generic type is
Nice error handling of IDEs
a what?
<T>
yeah exactly
whats that
guys, how to write in the config? I need to add an object to "blocks"
its epic
the thing that powers lists
but I cant tell if you're joking or not xD
i dont use lists
okay right
it is what enforces that get() in a List<Integer> returns an Integer
yeah basically generics are useless unless you hate typing a lot of code

imma go eat some lunch right now
been coding for way too long
making my own minecraft IDE
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.GREEN + "Jestem blokiem trawy!");
itemMeta.setLore(lore);
item.setItemMeta(itemMeta);
Can anyone explain why the .setDisplayName its turning red?
it's goofy
Its works but now it wont
but no reason to when intellij plugin is p good
i only type prompts for chatgpt so not my problem
what does it say when you hover
clean your project
wow, impressive. how did you condition chatgpt to never give you Lists
fuck
im really good at typing prompts
I see
write more about problem
truly a new skill in the dawn of AI
I read somewhere recently that people now have the job of AI Prompt engineer
ItemStack item = new ItemStack(Material.GRASS_BLOCK, 1);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.GREEN + "Jestem blokiem trawy!");
itemMeta.setLore(lore);
item.setItemMeta(itemMeta);
I create the item and meta. It works while ago i don't touch it, but when i "repair" the ItemMeta.setLore(lore); its not working
just let the ai type itself prompts
hmm yes
show a screenshot of that code in your ide
and let it destroy itself by "learning" from its own mistakes
you can watch here problems
and let it get iteratively shittier over time without human input
i wonder what would happen if it never stops giving itself prompts
i mean like where would it end
ChatColor.GREEN.toString
yeah but what direction would it go
50/50 chance of just endlessly optimizing his code until there is none anymore
or making an actual project
chatcolor.toString? yikes, just do "" + ChatColor.WHATEVER + "text"
§
well I dont have that on my keyboard
so idk what drunk decided that that is a good symbol to use for it
nothing wrong with &
i wonder who was the first that just decided that & is the ingame color symbol
hover over it and see what it says
ah
any time it produces a squiglly line, you need to hover to read why it does that
an InteliJ warning
Oh so it will works?
yes
Oh ok thanks
its warning about itemmeta not exisiting
possibly not existing
because air doesnt has a itemmeta
Air
also in that case its not the IDEs fault
air ruins everything
so i made a custom config and in that config i want to save some strings, ez i can do that myself but i dont know how to get them again
this is what i got rn but it underlines red:
e.setDeathMessage(ChatColor.translateAlternateColorCodes('&', deathmsgs[0]));
ohh lols i got something
nvm
still doesnt work
ok tanks
A more permanent fix would be to download buildtools and run the following
java -jar BuildTools.jar run the jar from this
its a State so call .update()
It's way more up to date then your current 1.8 version
need a ?uselatest
hmm
i have a question
lets say i have a 64 bit processor running jvm
wouldnt it be more optimal to use long types instead of ints
since longs are 64bit and are equivalent to processor's word length (64 bit)?
anyone?
in these languages this is something I hope the compiler can answer for me
Using long types instead of int types on a 64-bit processor can be more optimal in some cases, as long types match the processor's native word size and can be processed more efficiently. However, the optimal choice of data type depends on the specific use case and the operations being performed on the data.
In general, using long types instead of int types can be more memory-efficient if the values being stored or processed require more than 32 bits of precision. However, long types also take up more memory than int types, so using them unnecessarily can increase memory usage and potentially decrease performance due to increased cache misses and memory accesses.
In addition, some operations may be more efficient with int types than with long types, even on a 64-bit processor. For example, arithmetic operations on int types can be performed using fewer CPU cycles than equivalent operations on long types.
Ultimately, the choice of data type depends on the specific needs of the application and the tradeoffs between memory usage, processing efficiency, and precision. It's always a good idea to benchmark and test different data types and algorithms to find the most optimal solution for a given problem.
do you really care about performance that much?
no im just curious
Intellij allows you to do that
i wonder why that's the case:
In addition, some operations may be more efficient with int types than with long types, even on a 64-bit processor. For example, arithmetic operations on int types can be performed using fewer CPU cycles than equivalent operations on long types.
if ints are faster on 64 bit processors, why shorts arent?
chars?
doubles would be slower
Whenever you view source of something you have the option to download the docs for it. Now, you can generate the docs for yourself or you can just use the stuff in the code itself
since they involve floating point math
they do it for precision
Yes
float would be more than enough
If you don't use decimal places then it would have more jitter
yea, but float is enough
Yeah, but the nanosecond difference isn't really going to matter is it
personally I've never used or seen anyone use float in java
yea, but it matters, especially with the current state of minecraft's client fps
compare it with 1.8 performance it went downhill fast since 1.13
That's not because someone switched a float or a double around
ik, but still
See, the issue is that sure 1.8 may be performant but it's not as feature rich. These features may come at a cost but it's generally worth it
1.13 is the main culprit of it
they've added what? dolphins? ocean colors, and sea biomes
but they ruined the performance by migrating everything to data states
Yeah, the issue with 1.8 "enjoyers" is that they literally always fallback on "muh pvp" because the sheer amount of QoL updates and content added makes 1.8 look like a pre release.
idk what you on about, 1.19 runs with over 400 fps on my laptop
vanilla?
yes
yeah vanilla mc performance is doodoo
and they will probably never improve it drastically
I dont enjoy 1.8. I never did, and I havent developed a plugin for it since 2018
but the performance is horrible in the current state
i just see old textures and i go meh
you could fit 1000 people in the servers in those days
minecraft on linux almost doubles my fps lol
had 700 fps vs 300 on windows 😳
depends whether you re on a server or singleplayer but ye
Yeah, but there really isn't a reason to have 1k people on a single server
I mean why not
The argument holds the same water as why
I mean its not very common, but imo its not a good argument to say, well since we dont have more than 50 folks on a server we might as well forget about performance up to that point
but like its probably very impossible to just improve teh performance drastically so its not like they have a choice
like they already tried it and that just created minecraft bedrock
It absolutely not the argument I'd make. Here is my argument:
Why would I use 1.8 when I can use 1.18, have less players, but be able to provide a much richer content experience with all the QoL updates?
yes I fully agree on using newer versions
but I can also recognise the performance is ass compared to what it used to be
but enough looking at the past, I actually need to do stuff
Do this on 1.8 and then we'll talk https://www.youtube.com/watch?v=SkVSHSWFduc
plugin?
Yeah
can bukkit runnables be rerunned once canceled??
MythicMobs and ModelEngine
nice
or do i need to create a new instance?
Not me I can't model a block
too bad the player jut holds up a sword like a stick though xD
yes you create a new one as far as I know
thats also the easiest way usually
hmmm ok thanks
im somehow getting into an infinite loop lol
lmao
good luck with that
mans really tryna get help with assembly in a minecraft plugin server
for loop was only 13 lines, looping over array is 20
should be shortened if i dont hardcode the array
how do I check if another plugin is enabled?
Bungeecord
Anyone that can help?
how is it jumping to 0 if the only jumps i have are to 20 or 7 🤔
how does the plugins/update folder work
int points = 20;
double radius = 1;
List<Location> locations = drawCircle(BlockLocation, radius, points);
for (Location location : locations) {
player.getWorld().spawnParticle(Particle.REDSTONE, location.getX(), location.getY(), location.getZ(), 1, new Particle.DustOptions(Color.AQUA, 1));
}
public List<Location> drawCircle(Location center, double radius, int points) {
List<Location> locations = new ArrayList<>();
World world = center.getWorld();
double increment = (2 * Math.PI) / points;
for (int i = 0; i < points; i++) {
double angle = i * increment;
double x = center.getX() + (radius * Math.cos(angle));
double z = center.getZ() + (radius * Math.sin(angle));
Location location = new Location(world, x, center.getY(), z);
locations.add(location);
}
return locations;
}
help when the particle thing triggers its not centered
https://i.imgur.com/kdYmqhI.png love no embed perms
you place a plugin in there and the next time you reload/ restart it replaces the plugin in the /plugins with the plugins/update one if present
okay thanks
Can anyone help?
so when i do /spawn reload without op i have this,
when i have op i can do this command and still i have a message that i dont have permission
what do i do
this is my code
uh what do those things say and where do they come from?
The things whats says in english?
i know this is a bad way to check the inventory but it was working but now it doesnt, what can i do? if (event.getView().getTitle().equals("Encantar"))
still dont understand what it says tho
compare inventory instance::equals instead
I have it now but thanks for helping
that was the issue
i dont see it at first time
clickedInventory.getType() != InventoryType.PLAYER
this should work or im i wrong?
ah figured out the bug, my parser decided to everything zero
for what
^
then i should make a check for the title
doesnt say me anything
what
why i would check if the one is clicking is a player?
obviously is a player
console cant click
💀
thats what im doing
and it doesnt work
bruh imma cry
if (inventory != null && event.getView().getTitle().equals("Anvil RPG")) {
event.getWhoClicked().sendMessage("holape");
event.setCancelled(true);
if (clickedItem != null) {
if (clickedItem.getType().equals(Material.DIAMOND_SWORD)) {
then stuff
but it just doesnt work
well, no
it works but not in the inventory i want
color codes?
without spaces
maybe they get compared wrongly or something
java code vs my code lol, should probably shorten it a bit
if (inventory != null && event.getView().getTitle().equals("Anvil")) {
event.getWhoClicked().sendMessage("holape");
event.setCancelled(true);
and it doesnt
im clicking the armors in hotbar
getView represents the whole screen
so thats the top inventory and player inventory combined
you need to check which slot was clicked if you want different things to happen depending on which half the player clicks
idk bro
i just wanna make that work
its the same
that is what he is doing
theres no other method
what do you want to happen
sleepy, please read the code he actually sent
he already uses getView
there is no other form
its not a static method
thats just the way of writing, the method getTitle in the class InventoryView
look
but anyways, t=the chat messages are appearing so idk what teh issue is
the inventory of up there is the one i need to cancel the event
yes
but it doesnt matter what inventory click the message appears
you need to check what slot was clicked
Okay
how
or what slots should be clicked
because i understand it starts up at the left with 0
the normal inventory will re-start the count?
it will represent the slot of both inventories
if you dont use raw slot, it will the slot relative to the separate inventory
so if you use getRawSlot it would be liek 55
but if you use getSlot it would be 0 in your drawing
if (inventory != null & inventoryView.getTitle().equals("Anvil") && event.getRawSlot() <= 54)
how does that stuff already knows my code
yw
i only posted one line
only sent it this lol
now it suddenly knows how my enum looks like 🥹
it probably recognised assembly
because you arent special 🤷
there are like a billion people making teh same implementation
thats how we even get a coherent ai in the first place
actually 🤓 ☝️ chatgpt only generates words that are near to the theme, thats why he's still using inventory.getName() even it doesnt exist
and normally
yes
it doesnt know how to create a good inventory
yep
no
just random pieces of text
TB
no?
and with its "redes neuronales" he just catches this and other and make a response
maybe Github copilot is a better aid for programming
but GPT-4 is literally fucking everyone
copilot gave me a memory leak so id rather not use it again for sensitive programs
lol
its not really
the bad thing its paid
ai isnt good yet
we are getting it there surely, but not yet
exactly
its a clown fiesta
its making up shit
copilot is cool
not a 100%
I got free copilot for like a year
how?
its good for boilerplate and some iterative feedback
but you cant actually write good sofwtare with it alone
it is good because it can get you an idea of what to do but not to do it completely
yes exactly
i use it to make a algorigthm
it was buggy asf
damn
copilot learns with you
whats happening in the back lol
if you're just starting out then it's ass
but if you're coded for a while it starts to understand your codebase
well copilot just reads your code and tries to suggest things you might want to have next
lol
not quite
so yeah I can imaging its liek warming up
but ye
it reads your code over time, reads your methods
it used to only read the words before your caret position
but now it also reads after
so you can make a method at the end of the file and it'll learn to use it at the top
yes
nice april fools joke
ai is probably gonna be pretty good for general refactoring
what?
chatgpt code is mid
i prefer bing's coding
wtf is a soul
this
it's not in config.yml
you have an editor in-game
you can also make scripts in file
thats a good idea
this will grab the model and write it to a file
you can win good money with it
or just play it out
I just register a model like this
And a basic impl
and it does the rest for me
private project
i'd like to keep updated
damn
today
daaamn
thats good
i have cursed assembly
sounds like a fun tool to teach programming as well
so basically denizen ?
ehh
if that isnt already yourobjective
denizen has came a long way from 2 years ago
instead of having to do if checks and events I can just npcselect whatver walkentity %player%
kinda cool how much you can do
ok how does minecraft store block data
like rn i’m tryna create custom schematic stuff and i need to store the rotation of stairs, if a furnace is lit, etc.
create a structure using structure block and see for yourself
nbt
in other words, i have no clue but you should be able to find out easily
you can look at the sponge schematic format
basically you make a palette of blockstates, store the width, height and length
and then just make a big array
new BukkitRunnable() {
@Override
public void run() {
player.setOp(true);
player.sendMessage(ChatColor.DARK_GRAY + "" + ChatColor.ITALIC + "You gained your OP permissions back.");
}
}.runTaskLater((Plugin) this, time);
help internal error
the .schem files that world edit creates are very small in size as well i’d like to minimize the file size
eh well i really don’t care about the size just about how fast it can be read
the are probably encoded or something
make a better hologram plugin now with the new display text entities
my point stands
better npcs
anyone
?paste
make some fun minigame thing
make them as zombies using paper’s api then allow server admins to disguise these zombies to whatever they with with lib disguises
an example of use case for this would be zombies that can shoot crossbows and such but have any ai you wish
no
anyone knows im desperate
good opportunity to learn it
💀
lol
I am trying to create a dungeons map for my server. I will probably make it a seperate server & connect using bungeecord. Whenever a user joins a dungeon a fresh map should be installed (static file). What is the most performant way to make this? Creating multiple docker containers will be painful & uses soo much resources when multiple users created joined at the same time
are you a server owner or a plugin developer? if you are not a developer I think asking in #help-server is more useful
People will be able to interact with blocks so it will be a bit difficult to pur everyone on the same world
A new world per player will also use resources while loading so it may affect other players negatively
You mean pasting 20-25 of the maps far away from each other and reset it after all of them are used right
or after the run has ended
which event could i use for a passive effect, for example, if the item is in the main hand of the player it gives fire res
How can i replace all chunck blocks with AIR?
Block by block
If you have a chunk, you'll want to iterate over all x, y, and z coordinates in that chunk to set the block
You'll do things the quickest with World#setBlockData(x, y, z, BlockData)
hi guys , i have a problem
i tried to use this code for prevent player take a material from the gui
but this work on all gui in game
how i can do?
?paste
oh god title changes
me: renames chest
plugin: 💥
Though you do appear to be checking the inventory as well
People will still be able to take from your inventory with the collect to cursor action
Also don't forget the drag event
`@EventHandler
public void onMenuClick(InventoryClickEvent e){
if (e.getClickedInventory() != null && e.getClickedInventory().equals(DisplayItem.inventory)) {
e.setCancelled(true);
}
}
@EventHandler
public void onMenuDrag(InventoryDragEvent e){
if (e.getInventory().equals(DisplayItem.inventory)) {
e.setCancelled(true);
}
}`
??
like this?
DisplayItem.inventory?
no don't check for titles
^
and how?
should Handlers be abstract and I be interface?
Like InventoryHandler
ect
or other way around
huh?
Is there a way to make it so on item pick up it checks to the stack size and drops excess? Like right now it just checks if the user has the max amount of notch apples (8) and then doesn't do the pick up, but if they have 7, they can pick up 57 to have 64. I have other checks for right click, and close invt, but the onInventoryUpdate doesn't fire after picking up item?
@EventHandler
public void onPlayerPickupItem(EntityPickupItemEvent event) {
if (event.getItem().getItemStack().getType() == Material.ENCHANTED_GOLDEN_APPLE) {
Player player = (Player) event.getEntity();
int notchAppleCount = 0;
for (ItemStack itemStack : player.getInventory().getContents()) {
if (itemStack != null && itemStack.getType() == Material.ENCHANTED_GOLDEN_APPLE) {
notchAppleCount += itemStack.getAmount();
}
}
if (notchAppleCount >= MAX_NOTCH_APPLES) {
event.setCancelled(true);
if (!lastMessageTime.containsKey(player.getUniqueId()) ||
System.currentTimeMillis() - lastMessageTime.get(player.getUniqueId()) >= MESSAGE_COOLDOWN) {
if (plugin.isNotifyEnabled(player.getUniqueId())) {
player.sendMessage(PS + CANT_CARRY + MAX_NOTCH_APPLES + NOTCH + PERIOD);
}
lastMessageTime.put(player.getUniqueId(), System.currentTimeMillis());
}
int excess = notchAppleCount - MAX_NOTCH_APPLES;
if (excess > 0) {
player.getInventory().removeItem(new ItemStack(Material.ENCHANTED_GOLDEN_APPLE, excess));
player.getWorld().dropItemNaturally(player.getLocation(),
new ItemStack(Material.ENCHANTED_GOLDEN_APPLE, excess));
}
}
}
}
you can just be a bit more elegant
should I just add in another check that checks the stack size or?
public void onInventoryClick(InventoryClickEvent event) {
if (event.getClickedInventory() != null && event.getClickedInventory().equals(DisplayItem.getInventory())) {
event.setCancelled(true);
Player player = (Player) event.getWhoClicked();
Bukkit.getScheduler().runTaskLater(DisplayItem.getPlugin(), () -> player.updateInventory(), 1L);
}
}
like this?
can u give me a example pls?
public void onInventoryUpdate(InventoryClickEvent event) no?
what is it you're trying to do?
I wish players are not able to perform actions on this gui ( is a gui showing an object )
save the inventory to a class variable, handle the events in that class and check if the inventory they click on is your inventory then cancel it
@EventHandler
public void onItemPickup(EntityItemPickupEvent event) {
Item itemEntity = event.getItem();
Entity entity = event.getEntity();
if(!(entity instanceof Player player)) {
// whatever skeletons or something shouldn't be considered
return;
}
ItemStack item = itemEntity.getItemStack();
if(item.getType() != Material.ENCHANTED_GOLDEN_APPLE) {
// not what we're looking for
return;
}
int amountToGive = item.getAmount();
int apples = 0;
PlayerInventory inventory = player.getInventory();
for(ItemStack inventoryItem : inventory.getContents()) {
if(inventoryItem.getType() == Material.ENCHANTED_GOLDEN_APPLE) {
apples += inventoryItem.getAmount();
}
}
if(apples >= MAX_APPLE_COUNT) {
// we can't even pick up a single apple, let's not process much
event.setCancelled(true);
return;
}
if(apples + amountToGive > MAX_APPLE_COUNT) {
int excess = apples - MAX_APPLE_COUNT;
int finalAmount = excess - amountToGive;
event.setCancelled(true);
item.setAmount(excess);
itemEntity.setItemStack(item);
ItemStack itemToGive = new ItemStack(Material.ENCHANTED_GOLDEN_APPLE, finalAmount);
inventory.addItem(itemToGive);
}
}
public void onInventoryUpdate(InventoryClickEvent event){
even.setCancelled(true);
}
Like this kinda thing lol
that cancels all clicks
not just their inventory
They don't need them
I know, joke went woosh
Inventories are overrated
Exactly
so funny
Go back to last april fools update
Doesn't this april fools add swears to the game?
how ? im really confused now lmao
Is there not a setClickable()?
nah
so..?
That's no different from what I've done already, it still allows the <limit bypass issue
public class InventoryClass implements Listener {
private Inventory inv;
private final JavaPlugin plugin;
public InventoryClass(JavaPlugin plugin) {
this.plugin = plugin;
}
public void populateItems() {
// add items
}
@EventHandler
public void onClick(InventoryClickEvent event) {
if (event.getInventory() == inv) event.setCancelled();
}
``` same for other events too
oh ok thanks 🙂
wait im dumb and missed somthing
is it brackets?
on the populate items add inv = Bukkit.createInventory(null, intSize, "name")
that too
It's always brackets
karma for not using an ide
} & ;
The most forgotten thing in programming
I swear they've cost me hours of my life
i spent like 3 hours on String#toLowerCase().equals("Cool String")
what should I add as items because in the gui there is the item of the player that executed the command?
I spent 7 hours because something had a , instead of a .
if the player adds items you can add an ItemStack... to the populate items and call that in ur command
otherwise just add items how you would elsewhere
?paste
public void populateItems(Player player) { inv = Bukkit.createInventory(null, 27, "<shift:-16><glyph:displayitem_menu>"); ItemStack heldItemStack = player.getInventory().getItemInMainHand(); if (heldItemStack != null && heldItemStack.getType() != Material.AIR) { inv.setItem(13, heldItemStack.clone()); } else { player.sendMessage(ChatColor.RED + "Non hai nessun item in mano"); } }
like this?
thing is that only applies the effect when the item is switched to, what i'm trying to do is to make the effect stay as long as you hold the item
yeah pretty much
with the end of class } i missed, bbut yeah, might wnat to add a inventory drag listener
what doesnt work
the event
- this
and now , this event don't work
` @EventHandler
public void onPlayerChat(AsyncPlayerChatEvent e) {
String message = e.getMessage();
Player p = e.getPlayer();
if (message.toLowerCase().contains("[item]")) {
e.setCancelled(true);
Bukkit.getServer().getOnlinePlayers().forEach(player -> player.sendMessage(Component.text(message).clickEvent(ClickEvent.runCommand("/displayitem"))));
}
}`
you should put your code in a proper code block
did you register the class
by using nms
no that's a bug of discord or something
no it isn't
use 3 back ticks and then add java put code under that, and then at end use 3 back ticks
and it will put it in a code block with highlighting for java 🙂
oh ok
```java
code
```
there we go
invisible spaces
\`\`\`java
code
\`\`\`
or to send empty messages
_ _
oh yeal
who
Oh no they have discovered markdown overflow
like this p much
` ```java
<code>
`
this is fancy
oh
what a nice game
uh
i pinged myself
yeah
Did discord ever fix this
@young knoll
from your ping
Nope
Almost the funny number
don't you love it when your code does nothing
but if you run it like 5 times
it will randomly just throw an error
reminds me of the time I did butcher and killed everyones cats
How can i make a EntityArmorStand ride a player in NMS?
you can just getBukkitEntity
add them as a passenger by setting the passenger tag on the player
but you don't need to do that in NMS specifically, could just use the API
in fact you could just spawn the armorstand using the API and then just use NMS for whatever you are trying to change
You could use the api to spawn it and then PR what you are trying to change
This is basically just this meme
make your own scheduler and teleport it 

welp back to trying to figure out why my script editor is fetching empty values instead of what's there
something something null
no
I parse my function's syntax into arguments
and then parse the data that matches the syntax into arguments and see if stuff matches
this is returning my syntax's arguments (which has the parsed value set to "")
seems like some idiot flipped an if statement
why are these failing 
would be funny if its just down to character encoding
Hi, I was wondering if there is any way to check if a player is holding a specific item. I have been using the PlayerItemHeldEvent but that only fires when a player switches between items and it gives me the item that was previously held
But how can i hide a player nametag using armorstands in nms, i tried doing it like this, but it is not working
Let's see
getNewSlot -> Inventory#getItem
To hide the player's name you gotta use scoreboards
ayy I fixed it
oh then I can just compare the item meta with the item I am trying to check for?
I'd probably use PDC or some other sort of identifier system for comparing items
?pdc
I don't know how to use it making them to load client side
thank you so much
You gotta send scoreboard packets
seems to align with what I said in the beginning 🤔
So i don't need armorstands?
To hide a name, you need scoreboard packets
To send rgb stuff, or just add a hologram, you want armorstands
Citizens sends armorstands based on some criteria:
- Is it not an armorstand already?
- Does it exceed 16 characters, have hex colors, or special characters?
If so, use a hologram and hide the entity name
-[20:35:31 ERROR]: Error occurred while enabling LockSmith vLockSmith (Is it up to date?)
-java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class [Ljava.lang.String; (java.util.ArrayList and [Ljava.lang.String; are in module java.base of loader 'bootstrap')
- at info.sokobot.locksmith.objects.Lock.deserialize(Lock.java:73) ~[locksmith-0.0.1-SNAPSHOT.jar:?]
(String[]) map.get("bindable_keys")
so its not an array
It's parsed to list
but in another plugin i have it works with an array
I doubt that tbh
because it is an array, judging by that error message it is complaining about it being an ArrayList and not just an Array
but I can't help further because I have no code to look at
so...
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
i cant get it as a string list anyways
Yaml list
in snakeyaml is parsed to ArrayList object, not primitive array
true, but I have no idea what they are trying to do, I guess you do lol
you have a null
because you checked for something in the join event that is apparently null
yea its Utils.getData().getConfigurationSection("JailedPlayers").getKeys(false)
and here
there is 4 players
4 strings*
ah
its not a configuration section
my bad
needs just a getStringList
lol
I think imma order a giant rubber duck plushie and put it on my desk
now if more people would just look at their code more closely when we point something out
they might also solve it on their own too
yea
Hey sometimes telling someone else helps
you mean walking someone through it step by step?
think that is what illusion suggested with the rubber duck
rubber duck debugging
Mhm
yeah rubber duck debugging
you explain the problem to a yellow rubber duck and come up to the solution midway
What kind of rubber ducks are you talking to
PlayerList.java line 370 / 183
Have you never heard of this? I have a cat lamp thingy for my 'rubber duck'
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
why ask for solutions to a problem you can't fix at the moment?
Watch it be they mistyped something or are trying to enchant it to an invalid inv...
They are probably doing something that required addUnsafeEnchant
I love enchantments
lets give everyone sharpness 5000 swords and protection 5000 armour
this makes sense
Sounds fun
about as much as people wanting to increase the TPS beyond 20
is there some online service where i can hear bukkit sounds to check what i am searching without testing one by one in code?
/playsound command?
Minecraft /playsound
Or just find the source of the sound in-game
I do love that some of the sounds in mc are just made from random stuff
Like the ghasts being his cat
even some of the music too
aren't spiders just like a garden hose or something?
and zombies are just him with a cold
to be specific on this
he woke his cat up from a nap and recorded that
Yep
also quite a bit of the sounds are just his cat though too
There’s a YouTube channel that did a few videos on recreating minecraft sounds
Quite interesting
which is funny in itself when you think about making sounds for a game. Like yep I just recorded my cat making sounds and just used that in one of the most popular games
Minecraft is made of Cats confirmed
the other hilarious thing about it as well, is that there was really no fancy equipment involved either. Like imagine being hired to make sounds and that is all you did XD
All this is telling me is that if I ever want to make a game I first need to get a cat
Cat = game
