#development
1 messages Β· Page 133 of 1

Just so you know, deprecated does not mean "it will be removed eventually" (unless documented as such), it means "you shouldn't be using this, consider using this other, better alternative instead"
is this the correct import for nms? compileOnly 'org.spigotmc:spigot:1.12.2-R0.1-SNAPSHOT'
looks about right
did you run buildtools for 1.12.2?
is that required?
Yes
for internals yes
not sure
well I am
You have to run BuildTools for the version of NMS you're trying to access.
So you'll need to run it for ver 1.12.2.
gonna lookup the exact command for a sec
java -jar buildtoolsjarfile.jar --rev 1.12.2
oh ty
Replace the jar name with whatever it's called in your folder.
I typically restart my IDE, but that's personal preference.
I restarted my ide but it gives an error at net.minecraft (the imports)
refresh gradle dependencies
Also do you have mavenLocal() in your repos for the build file?
this fixed it, tysm!
π
I'm attempting to get the pitch of an location towards the player
float pitch = nextDistance.toVector().subtract(p.getLocation().toVector()).toLocation(p.getWorld()).getPitch();
But it always returns 0.0... Is there another way to calc the pitch needed?
Well thatβs not a way to calculate the pitch
I figured it out.
Vector lineToPlayer = nextDistance.toVector().subtract(p.getEyeLocation().toVector());
Location lineTowardsPlayer = nextDistance.clone().setDirection(lineToPlayer);
float pitch = lineTowardsPlayer.getPitch();
yo, I made a plugin in 1.16.5, we change the server version to 1.12.2, if I just change the spigot.jar it will work ? I don't use anything specific to spigot 1.16.5
Theoretically yes.
How do transform a head ID (like this eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTk4ZGY0MmY0NzdmMjEzZmY1ZTlkN2ZhNWE0Y2M0YTY5ZjIwZDljZWYyYjkwYzRhZTRmMjliZDE3Mjg3YjUifX19) into an item stack? I want to be able to get a head from a site like this: https://minecraft-heads.com/custom-heads/decoration/51584-easter-basket and take the ID, enter it as a string and get the item stack.
I've seen multiple plugins use https://github.com/CryptoMorin/XSeries/blob/master/src/main/java/com/cryptomorin/xseries/SkullUtils.java
Im trying to convert an object to json, but im getting this error for some reason https://paste.helpch.at/efuzugulub.sql anyone know why?
MalformedJsonException
malformed JSON at line 1 column 1 path $
what are you doing exactly? might as well show some code
So, im converting a Object to json to store in Redis and mongo. This is where im saving it rn, i plan to mve it later.
Gson gson = new Gson();
String json = gson.toJson(game).trim();;
Pipeline pipeline = Main.jedis.pipelined();
pipeline.set(game.getId(), json);
pipeline.sync();
collection.insertOne(Document.parse(json));
}```
This is the game object https://paste.helpch.at/uyigakihil.java
I dont convert back from json yet
can you show the lobby class
I don't think this is valid nowadays wc.generatorSettings("2;0;1;");
and by that I mean it isn't, lol
Im in 1.8 sorry i ment to mention that
[paper-1.18.1.jar:git-Paper-85]
I see, i uploaded some different files to the server. Forgot its on a different version, my bad. Thank you lol
You can use mojang's authlib pretty easy
Is it possible to get the texture of the head from a player?
remove the line that's sending the message
For what?
How do i open a door with nms? i cant find it
Can you compile latest HikariCP version using java8? (to support 1.8.8+)
have you considered using an older version of HCP?
Currently using 4.0.3
but seems to have some issues related to
x_isolation or something like that
when using MySQL 8.x
iirc
hence why i ask if someone used it in java8
java.sql.SQLException: Unknown system variable 'tx_isolation'
How to fix this in deluxe menus saying menu tittle for (menu) is not present
i would assume you make it present in the yml, also #general-plugins
Quesiton
Question*
I need opinions
What do you think is the best method to go for when trying to display a floating item/block but not being able to be picked up?
First Method: Spawn an invisible armor stand with a block with direction and other data values
Second Method: Same as first method but using packets
Ok thank you and I'm sorry for the wrong channel
Is simply cancelling the PlayerAttemptItemPickupEvent not good enough?
skip the extra armor stands and packets
i believe packets is the best way.

I don't just wanna display the item
I want it to bend and transform in different ways
rotation values
etc
although I ran into another problem
I'm unsure how to set a entity's main hand slot
with packets of course
using protocol lib
PacketContainer itemSlotPacket = new PacketContainer(PacketType.Play.Server.SET_SLOT);
itemSlotPacket.getByteArrays().write(0, new byte[]{0});
ah well with armor stands it's fairly easy, since you can lock equipment slots so they aren't intractable and the degree of freedom with them is huge, the only caveat is you have to know math lol
based off this https://wiki.vg/Protocol#Entity_Equipment
Well yeah I would hope I would know basic math to calculate trajectories lmao
Hmm weird
No field with type net.minecraft.world.entity.EnumItemSlot exists in class PacketPlayOutEntityEquipment
So I'm reading the documentation for the PotionSplashEvent. How would I modify the effected entities since getAffectedEntites() returns an copy list and not the original?
Figured it out lol
Still a problem, someone if you know anything about Protocol lib let me know. I'm going to bed π
was going to bed
fixed now
π
they recently updated protocol lib and changed the format of the packet
which i was unsure how to use and nobody had it online
^ why got that error
Is it possible to completely remove the hitbox of an invisible armor stand? Maybe with packets or idk?
What are you trying to achieve?
Literally what I said, also I found the setMarker method
You can deny the sending of the packet which spawns the armor stand for the client, but that means that anything else that the armor stand might have (items, name, etc) will be gone too. The armor stand would only exist for the server then though.
Setting them as a marker is your best option from what I know
have you done the bobbing normal dropped items do? like they go up and down slowly
Question, so i have a list of objects and inside each of those objects they store an integer, how can i sort that list by highest to lowest bassed on those integers?
implement Comparable<T> & compareTo in your object
then call Collections.sort on your list
Ok thank you
d;List#sort
default void sort(Comparator c)
throws ClassCastException, IllegalArgumentException, UnsupportedOperationException```
Sorts this list according to the order induced by the specified Comparator. The sort is stable : this method must not reorder equal elements.
All elements in this list must be mutually comparable using the specified comparator (that is, c.compare(e1, e2) must not throw a ClassCastException for any elements e1 and e2 in the list).
If the specified comparator is null then all elements in this list must implement the Comparable interface and the elements' natural ordering should be used.
This list must be modifiable, but need not be resizable.
1.8
c - the Comparator used to compare list elements. A null value indicates that the elements' natural ordering should be used
ClassCastException - if the list contains elements that are not mutually comparable using the specified comparator
IllegalArgumentException - (optional) if the comparator is found to violate the Comparator contract
UnsupportedOperationException - if the list's list-iterator does not support the set operation
π
is that preferred
I don't know if there's any difference but it exists
I wasn't thinking any functional difference
more so design wise
holding comparison/ordering logic in the object versus not holding it in the object
in the event two lists of the same type need to be ordered differently
well you can throw different comparators at each's sort method
idk it's kinda bleh, idrm
it's not like I'm sorting lists every day lol
well yeah that's what I was getting at with my 2 list example
@rigid mountain alternative above ^
ok thank you
@wheat carbon https://paste.helpch.at/aqiyepakup.java
everything is there
I'm using LWJGL
so l24 isn't working?
Hey, anyone that knows how to fix this? https://paste.helpch.at/bemelazosa.md i get this error with hikaricp when starting the server
how is gamescreen getting initialized?
you need to run your server with java 11
on the last line of the init method
it calls this method
public void changeScreen(Screen screen) {
currentScreen = screen;
}
and the currentScreen thing is an instance of screen
Debug everything lol
ah thats pain
There is Deluxemenu for 1.8.9?
Well its that or deep dive the code and see where it's giving a copy of the object.
wait
I think ik where it copies it
so if the floats get initialized in the Window constructor
will that affect it?
hi i'm trying to use this event in my 1.18.1 code but its don't work any explanation pls :
"BlockDamageAbortEvent"
Error : "Plugin ClickerGame v0.0.1 has failed to register events for class unnaincompris.clickergame.BlockInteract because org/bukkit/event/block/BlockDamageAbortEvent does not exist."
it says that the BlockDamageAbortEvent event doesn't exist. so maybe it wasn't added on the version your server is in?
does anyone know why this happens? the problem is that when I want to change a float that its from another class it doesnt change it there
The Window.getWindow().r/g/b?
yes
the getWindow method returns an instance of the WIndow class
which takes as parameter the height and width, and the name
on the constructor
does this print the updated values?
System.out.println(Window.getWindow().r + " " + Window.getWindow().g + " " + Window.getWindow().b);
nope
if I do it on the window class it doesnt
havent tested on the other class
a sec
I dont think
and sure give me a sec
https://paste.helpch.at/oweligoriz.cpp window class
alright if done on the class were the values are changed it does print the new values
apparently nope
yeah its fucking weird
somehow it is copying the values to the class were they are accesed
try making those fields volatile
well i'm all out of ideas lol
I'd say make the Window constructor private so you ensure you aren't creating new instances and always using the singleton instead
But other than that, attach a debugger
alright
I have the debugger on now but in what will that help actually?
havent used it yet
place breakpoints, step through each bit, list a class's instances and references etc
oh alright
IJ's debugger is really damn nice and powerful
Uhm, how can I check if my inventory can receive an itemstack?
I could check for empty slots
but I also want to count slots that also have like idk, 43 items of that itemstack
since there's still space there too
usually i just try to add the itemstack to the inventory, and check if the return of that method is empty
wdym?
cause addItem(ItemStack) returns a map of what couldnt be added
and how can I get that map?
addItem(ItemStack)?
addItem().isEmpty() thats what i do
tho its not a perfect method really
So when i try to create a table i get this warn: https://paste.helpch.at/vovacuzufu.rb any way to solve it? (the table is created tho)
code: https://paste.helpch.at/tepinihuze.cpp
you set the datasource class as driver class in hikari
setDriverClassName("org.sqlite.SQLiteDataSource");
so wait, I can do like if (p.getInventory().addItem().isEmpty()) and it will return something and add the item OR just return something?
This might the stupidest question ever
lol
now that I think about it
it might add the item
depends on if its able to
its are added, obvious
it returns either an empty map or a map with itemstacks that werent able to be added, with their stack size adjusted if some were added
d;spigot Inventory#addItem
@NotNull
HashMap<Integer,ItemStack> addItem(@NotNull ItemStack... items)
throws IllegalArgumentException```
Stores the given ItemStacks in the inventory. This will try to fill existing stacks and empty slots as well as it can.
The returned HashMap contains what it couldn't store, where the key is the index of the parameter, and the value is the ItemStack at that index of the varargs parameter. If all items are stored, it will return an empty HashMap.
If you pass in ItemStacks which exceed the maximum stack size for the Material, first they will be added to partial stacks where Material.getMaxStackSize() is not exceeded, up to Material.getMaxStackSize(). When there are no partial stacks left stacks will be split on Inventory.getMaxStackSize() allowing you to exceed the maximum stack size for that material.
It is known that in some implementations this method will also set the inputted argument amount to the number of that item not placed in slots.
items - The ItemStacks to add
IllegalArgumentException - if items or any element in it is null
A HashMap containing items that didn't fit.
i already do that when connecting
oh
you set the driver as driver, not the datasource as driver
so i should create a second variable for driver?
change the string you're passing to the sqlite driver class name
to?
the more i work with sqlite the weirder i find it to be
tysm
one weird thing tho
the server keeps crashing
because of the database
its spamming this: https://paste.helpch.at/odipiyumad.md
don't run database operations sync, run them on an async task through the scheduler
it crashes when i use the database to much orsm,
Main:
private Database data;`
@Override
public void onEnable() {
this.data = new Database();
data.connect();
data.createTable();
}
public Database getData() {
return this.data;
}
How i get it in other classes:
Database data = rsRugzakken.getInstance().getData();
it crashes because you're running sql operations on the main server thread and it's hanging there trying to wait for something to complete, so the entire server is waiting for you to complete your operation
oh, how do i do this async?
like this?
@Override
public void run() {
data = new Database();
data.connect();
data.createTable();
}
});
well not in onEnable, in your listener
oh
that stack trace above is coming from onInventoryClose
so like this then
@Override
public void run() {
Database data = rsRugzakken.getInstance().getData();
String base64ItemStack = Util.toBase64(e.getInventory());
data.setItems(uuid, base64ItemStack);
}
});```
looks okay
doesnt look like its crashing, ty
it does seem to be spamming this sometimes:
[22:21:38 WARN]: at com.zaxxer.hikari.pool.HikariPool.createTimeoutException(HikariPool.java:696)
[22:21:38 WARN]: at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:181)
[22:21:38 WARN]: at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:146)
[22:21:38 WARN]: at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:128)
[22:21:38 WARN]: at be.razerstorm.rsrugzakken.utils.storage.Database.getItems(Database.java:73)
[22:21:38 WARN]: at be.razerstorm.rsrugzakken.menus.RugzakGUI$1.run(RugzakGUI.java:46)
[22:21:38 WARN]: at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:64)
[22:21:38 WARN]: at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:52)
[22:21:38 WARN]: at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22)
[22:21:38 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[22:21:38 WARN]: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[22:21:38 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
>```
I was trying some stuff with my plugin, and got this error: https://paste.helpch.at/mujiyolemo.bash. My server just instantly crashed. It is not mentioning my plugin, so any idea what might have caused it?
Did you do something with an inventory and setting an itemstack to air / null?
I did yeah
I'm pretty sure this is the line that is killing my server user.getInventory().setItem(storage.getSlot(), new ItemStack(Material.AIR));. I've worked with this plugin for months though and I've never had any trouble with it. It just now decided to start killing my server for some reason when I use it.
Is there a way in 1.18 to get a material from the ID?
Registry.MATERIAL.get(NamespacedKey.fromString("iron_sword")) (also works for the namespaced versions like minecraft:iron_sword)
i have an item and everytime i click on it it gets a string from the database, why does it after only like 3 clicks (in a row) start to spam errors etc
what does the error say
can you send your Database class to see how you're actually handling the queries?
I mean the integer ids like 1 for stone
those no longer exist since 1.13
ok
like what "number" would spruce_sign be? it was added in 1.14, the id is minecraft:spruce_sign
I do not know
all the item and block IDs can be found in the Minecraft fandom (e.g. https://minecraft.fandom.com/wiki/Axe?so=search#Data_values, see the "Identifier" column)
Hey guys who can help me,
Hacker hack my primary account and he buy nitros and doing what he want how I fix that
Plz help me
?not-discord
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
@raven estuary read that carefully ^
But I donβt know what to do in the website Iβm so scary and my money is less and less
This is not discord support
support.discord.com is discord support
This is a Minecraft help server
I'm surprised more people come in here thinking it's an official discord support server then an official minecraft server lol.
Okay yeah you need to close your connections/statements/result sets, not closing those will lead to deadlocks/thread deaths/memory leaks/other kinds of stuff, you can close them like so
try (
Connection connection = hikari.getConnection();
PreparedStatement statement = connection.prepareStatement("blah blah ?")
) {
statement.setString(1, "blah");
try (ResultSet rs = statement.executeQuery()) {
rs.next() whatever
}
}
the try (thing = thing()) is called a "try with resources", it automatically closes the declared "resources" when it exits the try block. https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
+1 on using prepared statements tho, lol
so i just add
rs.next() whatever
}``` at every method that uses statements etc?
for all connection, statements and result sets usage, yes
it's possible that it's left waiting until a new connection is available before it can do anything next, but since they aren't being closed it's hanging there indefinitely
do i need to also do this in the connection method or doesnt that need to be done with hikari?
with the hikari.getConnection() you mean? yes
I mean hikari will do its own stuff under the hood too but it needs to be "signaled" when you're done using a connection
well in that case you don't need a result set, just put the statement in the try-with-resources thing instead (alongside the connection too) and call execute then
try (
Connection conn = hikari.getConnection();
Statement statement = connection.createStatement();
) {
statement.execute("create table blah blah");
}
You'll typically use PreparedStatement#executeQuery when requesting, so when doing SELECT * FROM tableName for example
and use PreparedStatement#executeUpdate or PreparedStatement#execute when modifying the table
although im not entirely sure what the difference is between execute and execute update
execute "may be any kind of SQL statement."
executeUpdate is for "an SQL Data Manipulation Language (DML) statement, such as INSERT, UPDATE or DELETE; or an SQL statement that returns nothing, such as a DDL statement." (whatever that means, just google ig lol) and returns the number of rows affected
executeQuery is for statements that return.. stuff ig, like SELECT
NBTAPI? I don't know what your usecase is but PDC would probably work just fine and is probably the best option
d;spigot PersistantDataContainer
public interface PersistentDataContainer```
PersistentDataContainer has 8 methods.
This interface represents a map like object, capable of storing custom tags in it.
when will someone make an nbt api that uses adventure-nbt π
When you make it.
Oh Glare don't tempt me..
Do it, you won't.
Never even heard of adventure nbt
I'll use PersistentDataContainer for now as my use case is simple, I was just curious if there were any better alternatives nowadays.
Different question that I can't seem to find on any tutorial - is there an equivalent for this.saveDefaultConfig() that can copy a file not named config.yml from the jar into the data folder?
this.saveResource("otherfile.yml", false);
NBTAPI by bananapuncher
^
hi, i'm trying to show health in tablist (with the heart) but instead of showing real health i want to show custom health (like divide the hearts by 2 so its 5 max)
anyone knows how i can do that?
i know how to show health in tab
but with custom hearts i have no idea
Did you try using the math expansion?
%math_1:1_{player_health} / 2% should probably work
make sure to /papi ecloud download Math and /papi reload first tho
no but i want to render minecraft hearts
You probably can't do straight up minecraft hearts, but you might be able to use the heart character
But also probably don't listen to me cause I don't actually know
Looks like this is what you'll need
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/scoreboard/Objective.html#setRenderType(org.bukkit.scoreboard.RenderType)
oh wait I just realized this is the development channel lmao
There might be a better way, but I use org.apache.commons.io.FileUtils.copyToFile(YourPlugin.getResource(ConfigFileNameInProject), DestinationFile); for my plugins. Just make sure DestinationFile.exists() == false.
Hi, anyone has an idea about why (presumably) VSCode keeps adding aliases to itself in my .zshrc? Thanks.
itβs establishing dominance
truly the correct answer
how come
if (sampleRateValue == null || sampleRateValue.asLong() <= 10) {
// ...
}```gives "Caused by: java.lang.UnsupportedOperationException: Not a number: null at org.hjson.JsonValue.asLong(JsonValue.java:410)". Should it not match the first condition and go into the `if` block anyway?
if (sampleRateValue != null && !sampleRateValue.isNull() && sampleRateValue.asLong() > 10) {
// !...
}
Youβre using &&, it has to match all conditions
sorry the second one is the solution
the problem is that sampleRateValue.isNull() is a separate check to sampleRateValue == null
so it was passing the latter
Is it possible to create a GUI like this Bukkit.createInventory(null, InventoryType.FURNACE); and actually get it to work without using a block?
Can you explain the goal? When providing the inventory type, it'd allow you to make the GUI look like that @queen plank.
To create a normal inventory in rows of you can do Bukkit.createInventory(null, 9, "Inventory Name'); // Multiples of 9, up to 54
Ok, so I want to be able to click with an item, bring up a GUI, lets say a furnace, and use it. A.k.a a portable furnace. I know I can open the GUI for a placed block, but I want it to be per player, and I can't just have 5000 furnaces placed somewhere.
I get a GUI, but the it does not work. I can place items in it, but nothing is smelting
I currently just have a furnace backpack lol
So you'd need to use a InventoryHolder, and use the player's open inventory via a task.
Let me make sure the method still exists, one moment.
So you'd need to implement a system that keeps track of a furnance's cook progress, burn time, total burn time of the items when it's supposed to be cooking a item.
As then you can use https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/inventory/InventoryView.html to set the property of burn time, cook time, ticks of current fuel/smelting.
declaration: package: org.bukkit.inventory, class: InventoryView
what is sampleRateValue? my guess it it's some kind of container which itself is not null but contains a value that is
Ahh...I was hoping for an easier solution lol. I allow the user to enter an inventory type in the chat. I'll have to make a ton of these systems then lol
JsonValue from hjson java library
Here's a plugin from 1.12 that seems to do what you want from a command.
It's outdated and may not work on the latest version but it's based on a command, but you may be able to update it to your need.
I can't use it though lol
Explain why not?
This GUI thingy I'm talking about is one of many abilities for my plugin. I'm planning on selling my plugin, not only using it my self. Also, I need it to work for all types of crafting stations
:>
So then you'd need to implement it for what you want.
You can't expect everything to be easily be done in coding, as sometimes it takes effort and debugging.
You'd also need to implement a data saving system in case the server shuts down, or player leaves.
I know I know, I was just hoping I would have missed something.
I guess I'll get to work then, thank you
You'd also need to give them xp based on cooking, if it'll be exactly like a regular furnace.
No problem, feel free to message here if you have any other questions regarding another inventory type etc.
This prints FURNACE and false for me. Why is this?
Block b = loc.getBlock();
System.out.println(b.getType());
System.out.println(b instanceof InventoryHolder);```
b is a Block, what you want to check is the BlockState (it's what contains the data) which, if the block is a furnace, then it will be a Furnace block state (which extends Container -> BlockInventoryHolder -> InventoryHolder)
Ahh, I see. Thank you!
Crossposting this to help a friend:
anyone got a clue on a solid way to do timebased checks on a block?
need to come up with a way to mimic vanilla farmlands dryout.Current idea was to store a PDC on the noteblock like furniture has for barriers
Then use the timer mechanic to set a say 3 second timer on it.
Then every x time check x blocks around for water, if found pog reset, if not change blockstate
thoughts?
How can I guarantee a loot table to drop two pools all the time?
I am trying to have two pools so that my block drops two different items 100% of the time, but it seems that each pool has a 50% chance of being dropped
Using java or Mythicmobs?
Java
The timer mechanic made me think you were doing an mm skill :p
can someone tell me way for disable chest opening on creative mode
on inventory open event, if its a chest and player is in creative, cancel
can you write me simple code?
How would you learn from that then?
I'm on my phone anyways
InventoryOpenEvent -> if event.getplayer .getgamemode or whatever == gamemode.creative, cancel. Easy to prevent inventory opening in creative.
Or if event.getinventory.type == chest? idk the type of the top of my head, && gamemode code above, event.setcanceled true
Try with the playerinteractevent
That works too but that is fired wayyy more.
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onInventoryOpen(InventoryOpenEvent event) {
Player player = (Player) event.getPlayer();
if(player.getGameMode() == GameMode.CREATIVE){
if (player.getInventory().getType() == InventoryType.CHEST) {
event.setCancelled(true);
}
}
}
tried with this
but still not working
Did you register the event?
yup
player#getInventory refers to PlayerInventory aka their own inventory
d;spigot Player#getInventory
@NotNull
PlayerInventory getInventory()```
Get the player's inventory.
The inventory of the player, this also contains the armor slots.
so i should replace it?
It'd be event get inventory get type
@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
public void onInventoryOpen(InventoryOpenEvent event) {
Player player = (Player) event.getPlayer();
if(player.getGameMode() == GameMode.CREATIVE){
if (event.getInventory().getType() == InventoryType.CHEST) {
event.setCancelled(true);
}
}
}
still not working
idk
Try .equals() instead? And make sure you actually registered your events in your onEnable and restarted your server
If you're using something like plugman or whatever to load your plugin on a live server for the first time, your listener won't register, it needs a full restart
fixed, thanks anyway
Well what was the issue?
not registered the correct event
Lmao
Does it matter if i write directly to the database or should i create a object for the player and save when the player leaves or the server shuts down?
If i save like kills to my database does it matter if i save it every time a player kills or should i only save when the player leaves
Alr ty
Generally speaking, what's better?
if (squaredDistanceTo(getOwner()) >= 8 * 8 && !isSprinting()) {
setSprinting(true);
}``` OR
```java
if (squaredDistanceTo(getOwner()) >= 8 * 8) {
setSprinting(true);
}```
Those are not the same semantically
Do you care if they are sprinting, or do you just always want to make sure they are sprinting when they are within the distance
The method as a "switch", so that if sprinting is set to true the entity sprints till it is set to false
Hence I am wondering whether it's worth checking that sprinting is false before setting it to true or not
It comes down to if you care
Do you have an alternative path for if they are sprinting? Or does it not matter
Especially if it happens often, like on a move event or something, you probably want to have as many checks as possible to avoid running methods you don't need
This is in the FabricAPI, but yeah the method runs every tick
Sheesh, then yeah you want to check as many things as possible as not running methods is ideal
I guess it comes down to which method is "beefier", setSprinting() or isSpriting()
But say that isSprinting was as simple as return sprinting; and setSprinting(boolean sprinting) was as simple as this.sprinting = sprinting
Is it worth checking isSprinting() every time before doing setSprinting()?
micro optimization, either is fine
First one probably is better context for readers
could also swap the order around, check the simple isSprinting first to early return, then do the expensive distance calculation
distanceSquared is pretty cheap
although yes that's a different method
it's entirely possible he's being extremely stupid, but i'm optimistic
is that a javax annotation
whoever wrote that is stoopid
classic bukkit code
classic bukkit code definitely didn't use jb annotations
guess someone added the annotation without removing the check then
MD added the annotations randomly to places, some that are even wrong
Like some NotNull annotated methods are 100% nullable lol
interesting
d;spigot ItemStack#getItemMeta
@Nullable
public ItemMeta getItemMeta()```
Get a copy of this ItemStack's ItemMeta.
a copy of the current ItemStack's ItemData
I guess not this one
Yeah some of them are just wrong
That's literally how you calculate the distance between two points lmao
he was saying that brister didn't know it was just "a^2+b^2+c^2"
the name may have not been properly descriptive of the logic
but then bm posted the actual function and it was that so all g
he did tho?
star assumed that brister's assumption on the logic was based on the naming of the function
seeing as bm bolded "squared" in the function name
but due to this
the name may have not been properly descriptive of the logic
star replied with "you don't know that"
Yeah klyser was technically using a different function for distanceSquared
Maybe it's return distance * distance π
yoy
And how do you calculate the distance? :trollv:
Calm down
no thank you
see someone gets me
yeah this is what I thought initially for distance, didn't see the squared part, but now that I think of it, can't you just use distance not square rooted if you just use that everywhere and it's not like in actual relation to the world
for like a heuristic or something
since it's all relative right
hi can someone help me fix this throw err;
^
SyntaxError: /home/container/config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensio
{
"bot": {
"token": "private",
"prefix": "n!",
"testguild": "895560577055883265",
"owner": "845312519001342052"
},
"embed": {
"color": "BLUE",
"footer": "NovaNodes"
},
"panel": {
"panelurl": "private",
"panelname": "Nova",
"panelapikey": "private",
"panelclientapikey": "private"
}
index.js?
const Discord = require('discord.js');
const { Collection } = require('discord.js');
const client = new Discord.Client({ intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_MESSAGES'] });
module.exports = client;
const fs = require('fs');
client.categories = fs.readdirSync("./commands/");
client.aliases = new Collection();
client.commands = new Collection();
client.slashCommands = new Collection();
client.config = require("./config.json");
require("./handler")(client);
let db = require("quick.db");
client.userData = new db.table("userData");
client.login(client.config.bot.token);
entire error
throw err;
^
SyntaxError: /home/container/config.json: Unexpected end of JSON input
at parse (<anonymous>)
at Object.Module._extensions..json (node:internal/modules/cjs/loader:1163:22)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/home/container/index.js:12:17)
at Module._compile (node:internal/modules/cjs/loader:1097:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
thats like entire error
@rugged bane client.config = require("./config.json");
its complaining here
don't you need another bracket at the end?
can u send the enitre message but where the bracket is
to end "panel"
"bot": {
"token": "private",
"prefix": "n!",
"testguild": "895560577055883265",
"owner": "845312519001342052"
},
"embed": {
"color": "BLUE",
"footer": "NovaNodes"
},
"panel": {
"panelurl": "private",
"panelname": "Nova",
"panelapikey": "private",
"panelclientapikey": "private"
}
}```
OH
ye
fixed it but theres an error
send it
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildApplicationCommandManager.set (/home/container/node_modules/discord.js/src/managers/ApplicationCommandManager.js:146:18)
at async Client.<anonymous> (/home/container/handler/index.js:53:9) {
method: 'put',
path: '/applications/857655637492498462/guilds/895560577055883265/commands',
code: 50001,
httpStatus: 403,
requestData: { json: [], files: [] }
k
lemme see
maximum lines index has is 23
this is line 9
client.aliases = new Collection();
@fiery pollen
Try this:
You did not select the right permissions when creating bot login link for your discord server.
Goto developers / oauth again, click bot and select all the required permissions that you're using in this bot.
Then copy the link generated and use it to login with your bot into your server.
Have you enabled the intents?
all of them
except 0auth advanced
i promised everyone its gonna be up in 3 mins
i got 2 more left
oh no
@fiery pollen async set(commands, guildId) {
const data = await this.commandPath({ guildId }).put({
data: commands.map(c => this.constructor.transformCommand(c)),
});
return data.reduce((coll, command) => coll.set(command.id, this._add(command, true, guildId)), new Collection());
} is there anything wrong with this as it complained here too
?
idk why
its the same one
The only thing i can find if i search on google, it says that you haven't given the bot the right permissions
i gave it admininstrator
nothing else
its also complaining here
await this.queue.wait();
try {
return await this.execute(request);
} finally {
this.queue.shift();
}
}
define "complaining"
ok
new error
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
damn
let data;
try {
data = await parseResponse(res);
} catch (err) {
throw new HTTPError(err.message, err.constructor.name, err.status, request);
}
throw new DiscordAPIError(data, res.status, request);
}
// Handle 5xx responses
if (res.status >= 500 && res.status < 600) {
// Retry the specified number of times for possible serverside issues
if (request.retries === this.manager.client.options.retryLimit) {
throw new HTTPError(res.statusText, res.constructor.name, res.status, request);
}
request.retries++;
return this.execute(request);
}```
send the rest of the stacktrace
whats that
do you know what type of bot it
is
its a pterodactyl server monitor
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Missing Access
at RequestHandler.execute (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (/home/container/node_modules/discord.js/src/rest/RequestHandler.js:51:14)
at async GuildApplicationCommandManager.set (/home/container/node_modules/discord.js/src/managers/ApplicationCommandManager.js:146:18)
at async Client.<anonymous> (/home/container/handler/index.js:53:9) {
method: 'put',
@kind granite
the new error appeared
@kind granite theres a new error

im confused
/home/container/node_modules/discord.js/src/rest/RequestHandler.js:355
if (res.status >= 500 && res.status < 600) {
^
SyntaxError: Unexpected token '.'
could anyone explain me this error? a bit confused
what's on line 20 of ItemManager.java?
1s
I guess you are using paper and have a different version of adventure on your project that the one available on the server?
possibly invalid MiniMessage or something, but yeah probably some weird version conflict
oh didn't know that could happen
are you shading Adventure/MiniMessage and if so, did you relocate it?
you can shade adventure and not use adventure methods from paper
Also, private final MiniMessage mm = MiniMessage.miniMessage();
oh sh@ I am implementing adventure, that should be compile only I suppose
may be that
yeah if you're not targeting spigot
I am not
does the version of the adventure-platform-bukkit matter?
does it need to be the one from 1.17.1?
seems like a miss match of adventure and minimessage versions
(version I am using)
any reason to use a version behind latest?
but yeah you should try and match up your version to the one paper has
although I don't even think you need adventure-platform-bukkit because Paper has its own
client is using it Β―_(γ)_/Β―
same
so what would I add to the build.gradle?
probably nothing, should just be in paper already
uh?
I mean same thing as before. there seems to be a missmatch between your minimessage version and your adventure version
breh
then there is no minimessage lol
^^
I think star meant to use whats provided by paper
using 1.17
has no minimessage
only latest has
(not using 1.17 by choice)
If you shade latest mini, you most likely also want to shade latest adventure
well I want to shade whichever version was for 1.17.1
but no idea which it was
cause github got basically "closed"
since it got added to paper itself
Is tabnine/kite acually good?
k il try copilot thanks
Anyone know where I can find some skins?
For NPC's?
oh no it had adventure, not minimessage
so i am getting this error using sqlite when i try to save something, the first time it allowed me to save but the second time not anymore: https://paste.helpch.at/aqadafonug.md
and this is the code i used: https://paste.helpch.at/degaquzibi.cpp
I need help
There is no time to wait! Ask your question @next pewter!
My discord account got disabled for a mistaken reason
this is my alt account
I have sent like 3 inqury's and no one has responded
its been like a week
?not-discord
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
heya i don't know where else to send this. but i am running into an issue with my minecraft server. its running on docker and I am able to join the server perfectly fine but my users are not. they get the error "connection refused" with no console output
anyone have an idea?
Well how are they joining the server? What IP?
through my domain
i could see if the bare ip works, but that would expose my vps ip
bare ip works, my domain ip only works for me though
Maybe it didn't propagate yet? How long ago did you set it up?
And how was it set up? Through an A record or a SRV record?
a record is for play and a srv record
@lyric gyro
can you maybe show how you set them up?
then the play just aims to the bare ip
okay are you sure your play IP is set to dns only?
because if its proxied it won't work
yep it is
Yeah I've no idea then π It might have to do with the way you set up docker
But I don't have much experience with that as of now so I can't help
fixed it
dunno how, but it works
Oh what was it?
If you didn't do anything then that means the IP just didn't propagate yet
i didn't do anything, but that setup has been there for months

π€¨
do your players that cant connect use tlauncher/badlion?
throw err;
^
Error: Could not locate the bindings file. Tried:
β /home/container/node_modules/better-sqlite3/build/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/build/Debug/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/build/Release/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/out/Debug/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/Debug/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/out/Release/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/Release/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/build/default/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/compiled/17.3.0/linux/x64/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/addon-build/release/install-root/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/addon-build/debug/install-root/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/addon-build/default/install-root/better_sqlite3.node
β /home/container/node_modules/better-sqlite3/lib/binding/node-v102-linux-x64/better_sqlite3.node
at bindings (/home/container/node_modules/bindings/bindings.js:126:9)
at new Database (/home/container/node_modules/better-sqlite3/lib/database.js:48:64)
at Object.<anonymous> (/home/container/node_modules/quick.db/src/index.js:7:15)``` can someone help me with this
What would be the easiest way to make an EnumSet where certain entries are excluded?
I want to make an EnumSet of Bukkit's EntityType but exclude specific entities from it such as ARMOR_STAND
EnumSet#copyOf maybe?
Creates an enum set with the same element type as the specified enum set, initially containing the same elements (if any).
ew
shut up
but yes, EnumSet.allOf and then remove entries to your heart's content
^
mkay
removeAll
ah
Other question:
How does a static { behave in a class?
Like when I have some objects - like a list - that I manipulate within the static, will this only happen once (similar to when you do stuff in a constructor and then call the new <object>) or will this stuff happen every time you call any (static) method in the class itself?
what you're describing is a static init block, which only happens once, ever
yeah on first initialization
Is this okay-ish or would there be better aproaches to this?
https://paste.helpch.at/senepakaxo.java
That wouldn't work?
Like the blacklist contains a different object
That wouldn't help?
?
Don't you see that ENTITY_TYPES is a List of EntityType?
That's why I use a removeIf
ENTITY_TYPES = new ArrayList<>(EnumSet.allOf(EntityType.class));
ENTITY_TYPE_BLACKLIST = Sets.newHashSet(EntityType.ARMOR_STAND, etc);
ENTITY_TYPES.removeAll(ENTITY_TYPE_BLACKLIST);
also any particular reason for ENTITY_TYPES being a List rather than a Set?

Primarely the fact that getAllowedEntityTypes returns a List and would break existing stuff
And I don't wanna do a stupid stream() there
Why is it stupid?
probably shouldn't break anything
although it might
is this public api code?
or is it just your project
if it's the latter, just change it and the compiler will say if anything breaks
public
According to the IDE is it unused, but you never know if another plugin uses it
Also, I keep the blacklist as a String set, because the API/plugin uses 1.13 version of Spigot and I'm not risking updating the depenency to later on have the plugin break. You never know
Guess that'll do for the Set thing:
public static List<EntityType> getAllowedEntityTypes() {
return new ArrayList<>(ENTITY_TYPES);
}
And another question again...
If I have this setup here:
private static final Map<String, String> DEFAULT_VALUES = Maps.newHashMap();
private static final CustomObject CUSTOM_OBJECT = new CustomObject("Some", "value", DEFAULT_VALUES);
static {
DEFAULT_VALUES.put("Some", "value");
}
...would the map be populated first before it is used in the construction of the CustomObject, or would the map be created, followed by the custom object and then the map is populated?
uh i dont think so
it runs in the same top-to-bottom order it's written, so it's passed to the constructor before you call .put
yeah
although it might not matter, depending on what the CustomObject constructor does
passing by reference and all
So I guess I should make a method that returns a created map with the values (i.e. private static final Map<String, String> .... = getPopulatedMap();)
yeah that sounds alright
I'm working on stuff like https://github.com/DecentSoftware-eu/DecentHolograms/pull/42
In case you're wondering
(The HashMap stuff isn't part of this PR but another one)
EnumSet will also be faster than a HashSet π
Hello gamers!
I need the Entity Animation packet but can't seem to find it in the protocol lib packet listener thingy.
Any ideas on how I might be able to listen for this exact packet?
Please @ me
Is chunk loading buggy in 1.12.2 (ChunkLoadEvent)?
It seams register only spawn chunks. IΒ΄m not so familiar with older minecraft versions (work fine in 1.16 and newer versions (I have not test versions between))
Seams if you are to close to spawn chunk it not trigger ChunkLoadEvent.
Hi, can i somehow make placeholder update not only when i join ?
Hello, i have my own plugin with custom placeholder. This is placeholder class: https://pastebin.com/4QGk6FxQ
in main onEnable i have instance of this class with .register() method. On the server with /papi list, i can see that this exist, but when im using this placeholder it doesnt works. It is %name%..
someone could help me?
try %mceconomy_ecoWezHajs%
never mind i did it, btw thanks for help
it was an issue
ok
What event registers a potion being thrown? I get nothing from PlayerInteractEvent, is it ProjectileLaunchEvent. If so, is it possible to get an ItemStack from the projectile?
yes
d;spigot ThrownPotion#getItem
@NotNull
ItemStack getItem()```
Returns a copy of the ItemStack for this thrown potion.
Altering this copy will not alter the thrown potion directly. If you want to alter the thrown potion, you must use the setItemStack method.
A copy of the ItemStack for this thrown potion.
i have a problem with vault π
damn
that sucks bro
what's the matter
yeah, its just i cant get the vault_rank to work
ah you mean the placeholder
yeah
yes, ask in that channel
i have
but nobody have seen it
someone will eventually, this isn't the correct channel tho so chances are even lower lmao
lmao
if you have a long class definition like
class ArrayMonitor<T>(override val monitorName: String, override val sampleRate: Long, override val platformRedisPool: JedisPool, value: ArrayList<T>?):ArrayList<T>(), Monitor {
should it be formatted like
class ArrayMonitor<T>(
override val monitorName: String,
override val sampleRate: Long,
override val platformRedisPool: JedisPool, value: ArrayList<T>?
):ArrayList<T>(), Monitor {
// ...
}
class ArrayMonitor<T>(
override val monitorName: String,
override val sampleRate: Long,
override val platformRedisPool: JedisPool, value: ArrayList<T>?):
ArrayList<T>(), Monitor {
// ...
}
first
i would say
but i would also add a space before and after the :
class ArrayMonitor<T>(
override val monitorName: String,
override val sampleRate: Long,
override val platformRedisPool: JedisPool, value: ArrayList<T>?
) : ArrayList<T>(), Monitor {
// ...
}
thats just me tho
Convention is first one
How to remove a item + amount from the player's inv, i've used many different codes but it still didn't worked
You can check the checkitem code under the remove modifier
does anyone exactly know how to convert a byte to an int or a string
I'm stupid enough to not know how its done or to find anything online
byte b = 123
int i = (int) b
String s = String.valueOf(b)
alright ty
Hi, I am trying to get a player's tag in DeluxeTags via the API:
String deluxeTag = DeluxeTag.getPlayerDisplayTag(pl);
However, this returns NULL despite the player having a tag.
This also is NULL:
Collection<DeluxeTag> ok = DeluxeTag.getLoadedTags();
Is there any way to fix this? I've got tags in my config file.
make sure you've not shaded deluxetags possibly? because DeluxeTag#getPlayerDisplayTag shouldn't really return null but rather an empty string
Guys i need help i can't figure this out. So i'm trying to get a block location but the location z is wrong. I have no idea why.
So i'm creating the new location like this
new Location(location.getWorld(),location.getBlockX(), location.getBlockY(), location.getBlockZ(), location.getPitch(), location.getYaw());
Y: 98
X: 111
Z: -85
I get this, but the z should be -48.
Any idea
now is it wrong when you get it here location.getBlockZ() or is it wrong after you've created the new location?
its wrong after i created the location
so if you print location.getBlockZ() you get the correct z?
then show us more of the code where you create the location
and after it
where you print the z
are you sure you're not mutating the location at some point?
is what I'm thinking
visual confusion
PlotSquared has its own location class as a large portion of the code does not depend on bukkit
so I have to convert it?
@urban questly
there is a BukkitUtil class in the bukkit module which has methods to convert between the different objects
@lyric gyro ly
ty. Also, off topic, is there a way to execute commands as console without spamming the console? (if that makes sense)
How do I spawn a dragon fire ball? Like a regular fire ball but purple?
Same as fire ball but DragonFireball instead
Waw, I tried DragonFireBall. I'm stupid
Since when dragons shoot fireballs?
Hmm? They have since like 1.9 or smth. The end update, whatever version that was
Ah ah ah
they blow the shit outta you

I mean have you tried reading what the warning says? you seem to be getting a warning there
yes
and?
"the import org.bukkit cannot resolved"
i can't import paper ?
"JavaPlugin cannot be resolved to a type" error two
yes
paper didnt working
my server is a paper will be problem ?
bcs i import a paper 1.16.5 and didnt works
and i upload spigot 1.16.5
works
Damn, could never find context to use this, it's the only word
sry my first plugin coding π
no. everything built against spigot should work on paper. idk how eclipse works but seems to be related with the library import
I'd personally recommend you use a build tool like gradle instead but since you're new to this that might take a bit of learning as well
ty
bukkit have docs ?
if u know can u give me ?
me suppressing my agony of seeing someone using eclipse
on a for loop, how can I loop once, execute code, wait 3 seconds and continue?
I actually legit forgot how to do the wait part
lmao
Thread.sleep() π
If you run it on another thread, something similar might be what you are looking for
I honestly need helping optimizing this https://paste.helpch.at/sozeyigono.cs
like, by a lot.
tps went to like 1.55 haha
import java.awt.Event;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin{
public void onEnable() {
getLogger().info("start");}
public void onDisable() {
getLogger().info("stop");}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
e.setJoinMessage("");
}
}
``` idk join messages still working why ?
You're missing two fundamental parts, first, you haven't registered the listener; second, you haven't implemented Listener in your Main class
you need to register the listener. the class you put the event handler in also needs to implement Listener
trying
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin implements Listener{
public void onEnable() {
getLogger().info("start");}
public void onDisable() {
getLogger().info("stop");}
@EventHandler
public void onJoin(PlayerJoinEvent e) {
e.setJoinMessage("");
}
}
``` is this true ?
how can i do register the listener
getServer().getPluginManager().registerEvents(this, this)
d;spigot PluginManager#registerEvents
void registerEvents(@NotNull Listener listener, @NotNull Plugin plugin)```
Registers all the events in the given listener class
listener - Listener to register
plugin - Plugin to register
thats how it works
in your enable method
anywhere really
but commonly used on the enable method
and if you use that method outside your plugin class make sure to first get an instance of the plugin class or do Bukkit.getServer() and so
oke i try
but only do the other thing if you really need it
for small plugins doing it on the enable method is enough
So for some reason im getting this error when trying to upsert with mongodb, https://paste.helpch.at/oyaderopez.cs . I thought it was supposed to insert or update the error seems like its only trying to update.
My code:
hey does anyone know why my block place event dosnt work on my minigame world?
it prints on the lobby world but wont print on the game world https://paste.helpch.at/emibavagez.cs
that's a block break event
not sure why that wouldn't work, can you double check where you register your event listener
?? it works oin the main world
also on a side note, this brings great pain
Game game = Main.getInstance().getGame(player);
lol
when you say 'main world' do you mean an actual separate world like with multiverse, or do you mean a separate spigot server
i cant use img??
post in a different channel like off-topic
i cant there
ah rip
well you get it
the main world like where the plugin folders are
C:\Users\emmac\Desktop\SkyWiz Server\plugins\SkyWiz\maps
sure
C:\Users\emmac\Desktop\SkyWiz Server\world
yep
main world
right
this is the game world
idk if you get it
the game world is inside the plugins folder?
yes
very weird but okay
so i'm assuming you only have one spigot server, and both of the worlds are inside the same server
no but it creates a active world
it copys the map world and creates a active world
ah okay
yeah i have no idea why your listener would only work on the main world
your best bet is to temporarily comment out any random stuff that isn't related to the listener being triggered and do some debugging
hopefully that leads you to the reason why it is not working
ima make a player interact event
see where the player is looking
see if its a right click
see the block he is holding
get the location
and set the block as the block he is holding
remove the block he just placed
BOOM
shiity block placing >:)
oh god π₯²
there's no reason your block place listener wouldnt work so there's gotta be some silly thing in the way
are you sure that when you test in your main world that the '1' being printed is actually coming from the block place event
'1' seems very ambiguous so maybe you have one left over from elsewhere that is being printed instead and you didn't realize
hmm
maybe bukkit is just weird with worlds you loaded in on the spot? seems kinda suspicious though, idk if that's actually the case
i think it has to do with politics
What might cause a variable to be null after I set the variable to a new Object in the constructor?
ugh I can't paste images
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
ima go jump off of something 
nah don't go hard on yourself lol. pretty common to make mistakes like these if you've been working on the project for a while
I literally looked over those spellings twice and my brain was like
all good here
Tier II people can, otherwise yeah stick to imgur for now 
I'm very close to getting there I think lol
noice
This is a form of cyberbullying
tier 2? πΈ
Assign the variable as final and then check if u are getting any errors
Could anyone help me out here? Kinda in need of optimizing this: https://paste.helpch.at/sozeyigono.cs
yup, 1.55 tps
xD
.txt it please.
1s
You can dm it if you don't want to repost it here.
ok
for context, it's a command to pickup all placed gens by me
the tests I did that went to 1.55 tps were only 1k gens lol
I think the issue might be somewhere in the adding the item, etc.
because I am doing that one by one
idk
- Creating a new itemstack every location (Should cache the item and adjust it accordingly.)
- Creating a new list of locations instead of using the already instanced list.
- Discarding the removeCache list every single location.
@worn jasper ^^^
the reason I create a new list is because I modify the actual list
var removedCache = new ArrayList<Location>();
for (var location : locations) {
cache.getGenerators().discardAll(removedCache);
db.removeAll(removedLocs.toArray(new String[0]));
}
```Put the remove methods outside the for statement.
You could use an iterator.
discardAll and removeAll remove all of them, no need to do it for each location.
just at the end.
disable physics when changing the block type
wait what?
Exactly... You have it in the loop and run discard on that list on every location
setType(AIR, false)
Also you have var removedLocs inside the for loop so it creates a new list every time instead of just adding to the list.
Consider using sets over lists where you dont need to preserve an order
fixed that already too
will do, ty.
does anyone know why my event doesnt work if im in a list?

okay so i have a skywars minigame
and when i join a game i get added to a activePlayer list
when i get added my block break and place events stop working like theyt dont even fire
probably becuase you messed the code
bruh
better show code
but when i join a game and get added to the activcePlayer list it doesnt even rpint
public void onBlockPlace(BlockPlaceEvent event) {
System.out.println(1);
Player player = event.getPlayer();
handle(event, player);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
System.out.println(1);
Player player = event.getPlayer();
handle(event, player);
}```
better show the handle
why?
because that code doesnt help
the event doesnt even fire
it simply prints
it fires in the main lobby but not in a game
i cant tell you events do work
@rugged bane How come I was banned from Analyse?
you probably made an error in other place of the code
Game game = Main.getInstance().getGame(player);
if (game != null) {
if (game.isState(Game.GameState.LOBBY) || game.isState(Game.GameState.PREPARATION) || game.isState(Game.GameState.ENDING) || game.isState(Game.GameState.STARTING)) {
event.setCancelled(true); // Cancel, game isn't active
return;
}
GamePlayer gamePlayer = game.getGamePlayer(player);
if (gamePlayer != null) {
if (gamePlayer.getPlayer() == player) {
if (!game.getPlayers().contains(gamePlayer)) {
event.setCancelled(true);
}
}
}
} else {
event.setCancelled(true);
}
}```
Charlie hates everyone, don't sweat it
Makes sense
how is that related to development? xd

