#help-development
1 messages · Page 1627 of 1
Location or chunk could be null make sure to check that first.
Yeah I assumed location is null because getChunk() can't return null. Just waiting on the kid to verify so I can give him support.
mood
I hate sql so much
Good luck
gotta keep the wifie happy
more like gotta make sure my parents don't accidentally kill themselves doing it instead
yeh, guess I'll post all these plugin updates later, might go play some games
has anyone used the goldencrates plugin?
livingEntity.getLocation().getChunk().load();
Bukkit.broadcastMessage(livingEntity.getLocation().getChunk().isLoaded() + ""); // true
livingEntity.remove();``` here's my code and I died at same world
and chunk is loaded
hmm
bump!
Chunk loading isn't instant... You need to check ChunkLoadEvent or add a delay to the removal.
ChunkLoadEvent would probably be safer
https://www.youtube.com/watch?v=dQw4w9WgXcQ finally has 1 billion views!
Isn't the team scoreboard running out when there are 16 or more people?
thanks you, but LivingEntity livingEntity = BossCore.getBoss(player); livingEntity.getLocation().getChunk().load(); Bukkit.broadcastMessage(livingEntity.getLocation().getChunk().isLoaded() + ""); new BukkitRunnable() { public void run() { livingEntity.remove(); Bukkit.broadcastMessage("Remove!"); } }.runTaskLater(totoServerPlugin.getInstance(), 20); code failed, so I tried
public void chunk(ChunkLoadEvent event) {
Bukkit.broadcastMessage("event");
for (Entity entity : event.getChunk().getEntities()) {
if (entity.getType() == EntityType.ZOMBIE) entity.remove();
}
}``` but still not working 😦
so much for preventing equipment of horse armor: https://paste.md-5.net/damuxoxusi.cs
Is the ChunkLoadEvent running?
Here is an example: https://paste.md-5.net/zokuyomona.cs
Debug the entities.
Try adding a delay on the load chunk then. That seems odd it wouldn't have entities.
Any known way of making dispenser drop certain items that contain special properties, like certain arrows, armor, potions
I don't think you need to load the chunk btw
.remove() should work anyways
are you getting the correct entity?
Do they not work with custom items already?
Still do
At least those with custom model data
Unless you are saying storing sth in PDC
Im trying to prevent a custom horse armor to be equipped through dispenser
Ah
But the worst part is neither BlockDispenseEvent nor BlockDispenseArmorEvent is called
That would probably qualify as a bug
Hmm, think so too
Probably would be best to cancel the dispense event for that particular item
^
Oh nice
Reported issue. other armor equipment, such as equipping villager with armor, are firing fine. seems to be an overlook
p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed"));
loc.add(p.getTargetBlock((Set<Material>) null, 3).getLocation());
Generators.getInstance().getConfig().set("Location", loc);
Generators.getInstance().saveConfig();``` I tried to make an arraylist for the loc variable so every time I place a new block it adds a loc and when I remove it, it removes the loc variable from the config, this just overwrites every location I place the block down
Can anyone help me with protocollib or give me a good tutorial for it?
My goal:
Listening to the entity position packet and get the delta x, delta y & delta z
Dont rlly know how to get started learning how to use protocollib
Love the video or need more help...or maybe both?
💬Join us on Discord: http://discord.gg/invite/fw5cKM3
Thank you for tuning in to this episode of TheSourceCode! ❤️
If you enjoyed this video make sure to show your support by liking , commenting your thoughts, and sharing for all your friends to see and learn!
All code is available on Github:
...
Those tutorials are somewhat old
But that guy's discord server has lots of help available
And I'm often there to help
I can help, explain what you've tried
ideas on how to implement zeuses bolt into minecraft
is there a way why fileconfig.getLocation would not work? or do i need to get the xyz apart
can anyone help here?
Does anyone know if it is possible to change the custom name of an entity based on the player viewing it (basically, a packet that can be sent to change entity name that is per-player?)
How are you instantiating your loc variable?
well this is my array list java ArrayList<Location> loc = new ArrayList<Location>();
then I add to it on each block placement
There's your issue. You aren't loading existing locations from the config
you are just making a new list every time and setting that in the config
It will be a lot easier for people to help if you put your issue in one message
alright
now?
so how would I save the list?
thanks
how do i get the args target name in to a nother class
saying that i am a beginner at java and spigot
1 - Follow naming conventions
2 - Don't name your main class as Main, there are like 20 other Main classes and it can get confusing
Initialize your configs onEnable and make a public getter instead of having the configs themselves public
add a return; after the Player is null message
First off, are you loading your files async during runtime? I'd either recommend doing that or only loading your list in onEnable and saving it onDisable (to prevent loading files on the main thread during runtime).
You are saving the list of locations fine, the problem is you don't seem to be loading the list from the config. Load the list from the config, add the location, then save it.
Okay done
ok
Now, what do I do to fix the coin problem?
Please.
is there a way to remove this message?
is this going to spawn an item at my location if the location is valid? ```java
BukkitScheduler scheduler = getServer().getScheduler();
scheduler.scheduleSyncRepeatingTask(Generators.getInstance(), new Runnable() {
@Override
public void run() {
switch (getWorld("world").getBlockAt(blockLocation).getType()) {
case IRON_ORE:
getWorld("world").dropItem(blockLocation.add(0, 1, 0), new ItemStack(Material.IRON_INGOT, 1));
}
}
}, 0L, 30L);```
I haven't got an item to spawn with this
It goes with my blocklocation var when I placew the block down
yeah i'm going to add more and I forgot to break out of the loop lol
@regal moat Connect to your db using async
is there a fast way to check if the item in the players mainhand is a sword?
whats that 😅
player.getItemInMainHand(); ???
AsyncPlayerPreLoginEvent
yea and not comparing it to every sword?
ah ok
i was thinking about Tag.SWORD but there isnt
oh yea
or i found this
if(EnchantTarget.WEAPON.includes(item))
dunno if that includes axes etc
i need to get the player though
and there is no #getPlayer()
and im confused
main.getServer().getPlayer(e.getUniqueId())
what about this
private static final Set<Material> SWORDS = EnumSet.of(
Material.WOODEN_SWORD,
Material.STONE_SWORD,
Material.IRON_SWORD,
Material.GOLD_SWORD,
Material.DIAMOND_SWORD,
Material.NETHERITE_SWORD
);
if (SWORDS.contains(material)) {
// It's a sword
}```
Thats because the player hasn't joined yet. They are going through the login process.
so would this work
yea i'm checking if the name contains "sword" rn 😛
I'd avoid name-based checks
add an NBT to the item
The EnumSet is going to be significantly more performant because it's backed by a bit vector
contains() operations are O(1)
hmm
Not necessarily. I would use Bukkit.getOfflinePlayer(UUID) if you absolutely need a player object.
lets use the enumset then
Yeah, you just have to copy/paste that set wherever you need to use it
or just make it public
It's mutable so I'd avoid that
Im under the impression btw that getOfflinePlayer stores player info and checks for it in the main world. So for my own plugin i should most likely store player data cached in database if i need that data to not rely on the world?
Well, I need to send the player a message
So, 😅
You can't during login
where can i get help for sql?
can somebody give me a guide like a link for custom textures
Hey, Is there a way to know if a player is walking by just using the object Player ?
no but there is .isRunning()
?paste
https://paste.md-5.net/fegeqerayi.java
How can I cancel the task when the player leaves
It keeps running when the player leaves
I know but ty ^^ I just want the information "isWalking"
?scheduling I suggest you read this
assign it a taskid and cancel it with BukkitScheduler#cancelTask
?services @tropic roost
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
you can like
set a variable on the MoveEvent if the distance is not 0
indicating the player is moving
and on the next tick, if the player is not moving, set it back
how do i get the status of a server in a bungee instance?
like whitelist, offline, online
I fixed the coin null problem but now the coin amount resets evertime I relogin.
?paste
no errors
i have no idea what i am doing wrong please help me
I'm storing the coin amount by the UUID
I mean, I hope I am
Because that is what I ment to do
Yeah I am doing that
Well
Kinda
It all says success
[19:36:48] [User Authenticator #1/INFO]: SUCCESS: Successfully connected to database.
[19:36:48] [User Authenticator #1/INFO]: SUCCESS: Successfully prepared statement.
[19:36:48] [User Authenticator #1/INFO]: SUCCESS: Successfully prepared statement.
[19:36:48] [User Authenticator #1/INFO]: UUID of player Splashny is 24cc915a-2997-4397-8d30-e1447d8dd8f2
[19:36:48] [Server thread/INFO]: Splashny[/127.0.0.1:59167] logged in with entity id 214 at ([world]-267.9647924464111, 70.0, 165.30000001192093)
Does all that while logging in
and sends the action bar when joined
and while logged in
Do you save your coins in the database on quit?
i use a command called /setcoin
wait
i know the problem
😄
i am changing the hashmaps values
not the databases
lol
the thing was about my command
all these times
omfg i am an idiot
lets just save the hashmap to the database on quit
Is the first time someone connected to a server saved somewhere?
Thank you.
is there an event that gets fired when the players changes gamemode?
declaration: package: org.bukkit.event.player, class: PlayerGameModeChangeEvent
aha thankyou
?paste
halp, i have no idea wot's going on ;-;, I had a command that wasn't working so i went back to my github to copy it from when it did work but now that's not working https://paste.md-5.net/tadayuhuxa.java
it used to send a message to the player with all the warp locations but now it doesn't, and instead it just prints
[10:02:44] [Server thread/INFO]: Radiant_Bee issued server command: /listlocations
[10:02:45] [Server thread/INFO]: []
in the console for some reason
Is there an event for server shutting down?
does adding a player to the server's banlist automatically kickes them?
Your plugins onDisable
try
doesnt seems to work
Then no
a-anyone?
the list seems to be empty
it shouldn't be i have three coordinate and name pairs in my json file
For some reason, when I use player.getLocation().getDirection() it gives me some very strange results. For example:
-1.0, -0.0, 6.123233995736766E-17
-1.2246467991473532E-16, -0.0, -1.0
1.0, -0.0, -1.8369701987210297E-16
It makes no sense as to why the numbers should have values extremely close to 0 not be completely 0. Any reason why this is happening and how I can fix it?
This would be because of precision errors. The easiest way to fix that is simply to round the value
Make a new vector with the rounded values of the incorrect vector?
Yeah you can do that. Why do you need an exact value, might be a better way to do things
Im using those values in calculations, so even though the error is very small... after a lot of equations that error gets bigger and messes some stuff up
how to checjk status of a sevrer
ah I see
You ping it with a handshake packet
how 2 handshake serever
Do you have NMS in your project
hell naw
Building something standalone?
You want to look at this then: https://wiki.vg/Server_List_Ping
Then use Netty or whatever to send the request
or you could just send anything and see if there's a response from the server...
to complicated
Try this then
uhh when i start my plugin the config file doesnt include all the lines from the default one
like normally i have 70 lines
and now 20
i dont see errors
Delete the saved one and let it regenerate
i already did i guess let me try again
it doesnt
hmm i think it is a method overwriting something
switch (args[0].toLowerCase()) {
case "iron":
p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE);
blockLocation = p.getTargetBlock((Set<Material>) null, 3).getLocation();
loc.add(blockLocation);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed at " + blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ()));
Generators.getInstance().getConfig().set("Location", loc);
Generators.getInstance().saveConfig();
}``` how do I save an arraylist of locations in the config? this just overwrites it; ArrayList > ```v
ArrayList<Location> loc = new ArrayList<Location>();```
how could this break the file?
plugin.getConfig().set("spawn.world", l.getWorld().getName());
plugin.getConfig().set("spawn.x", l.getX());
plugin.getConfig().set("spawn.y", l.getY());
plugin.getConfig().set("spawn.z", l.getZ());
plugin.getConfig().set("spawn.yaw", l.getYaw());
plugin.getConfig().set("spawn.pitch", l.getPitch());
ConfigManager.saveConfig(ConfigManager.FileType.CONFIG);
do you have one config file or more?
more
ah
yea the filetype..
Pretty sure Location is serializable
You don’t have to read all of that
yes i'm sure
Then why you doing it
i'm changing it and forgot that one..
are you just setting one location?
yes the spawn location of the world by default
I need help with an array of locations
in onEnable atleast
this
iterate over them and save them to the file
hm ok
its broken again
when i remove the file and reload the plugin the file is created normal
so I have this much java switch (args[0].toLowerCase()) { case "iron": p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE); blockLocation = p.getTargetBlock((Set<Material>) null, 3).getLocation(); Generators.getInstance().locations.add(blockLocation); p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed at " + blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ())); Generators.getInstance().getConfig().set("Location", Generators.instance.locations); Generators.getInstance().saveConfig(); } main class: java public List<Location> locations; public void onEnable() { locations = (List<Location>) getConfig().get("locations"); } and location is null
still overwriting the config
nah
you dont have a license nor a readme
set up your github correctly smh
thanks
switch (args[0].toLowerCase()) {
case "iron":
p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE);
blockLocation = p.getTargetBlock((Set<Material>) null, 3).getLocation();
if (Generators.getInstance().locations != null)
Generators.getInstance().locations.add(blockLocation);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed at " + blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ()));
Generators.getInstance().getConfig().set("Location", Generators.instance.locations);
Generators.getInstance().saveConfig();
}``` notnull check stops the error but the locations are still getting overwritten
.
Any help with this?
is a location also deserializable?
yeas
my code is doing strange things
Any class that implements ConfigurationSerializable will automatically be able to be automatically serialized and deserialzied with the bukkit yaml api
iirc has to be registered with ConfigurationSerialization but yeah
You can include an open source license in your repository to make it easier for other people to contribute.
nvm, PacketPlayOutEntityMetadata is the packet I'm looking for
Hey, how would I make a custom event that exectutes when a specific condition is met.
this seems too long for nothing
https://github.com/2Hex/OnceUnCraftable/blob/main/src/main/java/me/hex/onceuncraftable/commands/ChangeConfig.java
does anybody know a good way to test plugins (1.16.x) in singleplayer
not?
oh
for some reason this damages my config file
return plugin.getConfig().getLocation("spawn");
Spawn.setLocation(getServer().getWorlds().get(0).getSpawnLocation());
if I is greater than 1 how can I be less than 1 if I is greater than 1
:fluh
update the plugin when you compile it :/
why not when you publish a new version
?paste
i need this for a sec
Main: https://paste.md-5.net/irudumerew.java
Listener: https://paste.md-5.net/azicewulok.java
So I am trying to save some info to the database when the server is shutting down.
But It ain't workin'.
Giving an out an error at line 60 (new OnJoin(this).prepareStatement("UPDATE usercoin SET COIN = '" + getUserCoin().get(p.getUniqueId().toString()) + "' WHERE UUID = '" + p.getUniqueId().toString() + "'").executeUpdate();)
Error: ```java
[21:38:01] [Server thread/INFO]: [Shaza] Disabling Shaza v1.0-SNAPSHOT
[21:38:01] [Server thread/ERROR]: Error occurred while disabling Shaza v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
at sh.aza.OnJoin.prepareStatement(OnJoin.java:111) ~[?:?]
at sh.aza.Shaza.onDisable(Shaza.java:60) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:266) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:350) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:437) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:424) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:417) ~[patched_1.12.2.jar:git-Paper-1618]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.disablePlugins(CraftServer.java:363) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.stop(MinecraftServer.java:486) ~[patched_1.12.2.jar:git-Paper-1618]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:702) ~[patched_1.12.2.jar:git-Paper-1618]
at java.lang.Thread.run(Unknown Source) [?:1.8.0_291]
Why not save when they disconnect?
well i do that
but it doesnt save it when the server shuts down
the player does disconnect
Are you saving whenever they get a new coins or removed?
I am saving it when the player quits
java.lang.NullPointerException: null
at sh.aza.OnJoin.prepareStatement(OnJoin.java:111) ~[?:?]
line 111 is ps = conn.prepareStatement(query);
What is conn and query
conn is connection
The only reason that could be throwing a NPE is either from conn being null (which is likely), or the method throws a NPE
Nothing else
it will never open the connection so it stays null
you are trying to use a connection which doesnt exist
you never instantiate it
just if a player joins the server which is not the case in onDisable
No. I am saving all the players info on disable
yeah
but to nowhere
since there is no connection
and because of that you are receiving a NPE
hi everyone i have a question
i am making inventory GUI plugin and i have a problem
i set eventhandler on item inside inventory to close inventory
and eventhandler with hight priority with event.setCanceled(true)
but when i click shift+left click on this item inventory close but item
duplicating in player inventory, how i fix it?
Could we see some code?
yeah 1 second
Java finds that 38%0.4 = 0.3999999999999979 (taken from system out println)
But if I type this in my calculator it sais 32 / 0.4 = 80, that means the rest is 0
@EventHandler(priority = EventPriority.HIGHEST)
public void onInventoryClick_(InventoryClickEvent event) {
if (event.getInventory().equals(owner) && Objects.equals(event.getCurrentItem(), itemStack)) {
event.setCancelled(cancelMovement);
}
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getInventory().equals(owner) && Objects.equals(event.getCurrentItem(), itemStack)) {
onClick(event);
}
}
protected void onClick(InventoryClickEvent event) {}
gui.addPatternCorrespondence("ds", new ChestGUIClickableItem(diamondSword, gui.getInventory(), true) {
@Override
protected void onClick(InventoryClickEvent event) {
event.getWhoClicked().closeInventory();
}
});
?paste
Using packets does anyone know if it is possible to hide an entity but still show its custom name?
@forest edge maybe you want something like this? https://www.spigotmc.org/threads/tutorial-holograms-1-8.65183/
I'm trying to do this with enderpearls, unfortunately. Using only armorstands for my purpose (player nametags) does not get the right spacing
or... maybe it does? going to test some more.
does anyone know how to save more than one location to a config?
So for luckperms I put the db file that has the ranks and everything already made , then when I start the server, it overwrites everything and only leaves the default rank. Anyone know a solution to not have it overwrite everything? I can paste the code that’s in the file. It’s like 6k lines though.
wdym
to multiple configs?
a config can have multiple nodes
What exactly is stopping you from doing this
What are you trying to do
switch (args[0].toLowerCase()) {
case "iron":
p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE);
blockLocation = p.getTargetBlock((Set<Material>) null, 3).getLocation();
if (Generators.getInstance().locations != null)
Generators.getInstance().locations.add(blockLocation);
p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed at " + blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ()));
Generators.getInstance().getConfig().set("locations", Generators.instance.locations);
Generators.getInstance().saveConfig();
}```
public List<Location> locations;
public void onEnable() {
locations = (List<Location>) getConfig().get("locations");
}``` Main class
I need to save multiple blockLocations to the config
but every time I create a new iron gen, it overwrites the cfg
Now I'm not receiving a NPE, but something different.
Error: https://paste.md-5.net/azaqaqebis.md
It's something about the connection
But I'm also new to databases :p
Caused by: java.net.UnknownHostException: null
fuck
how can i make player fly?
p.setAllowFlight(true);
p.setFlying(true);
i think.
ty
java.lang.NullPointerException: null this is not a NPE for you?
yeah since you never instantiate the connection. accept my help..
I didn't read the full error
until now
😄
What?
I am horribly, terribly new to databases
I am also new to Java 😅
what is the best way to remove all blocks from a world
@Override
public void onDisable() {
for (Player p: Bukkit.getOnlinePlayers()){
try {
new OnJoin(this).prepareStatement("UPDATE usercoin SET COIN = '" + getUserCoin().get(p.getUniqueId().toString()) + "' WHERE UUID = '" + p.getUniqueId().toString() + "'").executeUpdate(); // this will not work, since "conn" in your #prepareStatement method is always null.
} catch (SQLException throwables) {
throwables.printStackTrace();
}
}
getLogger().info("Shaza -- Goodbye!");
}
Now you are asking yourself: "Why is that null? I am instantiating it in my #onLogin method!"
Yes, you do. But since you never register the event and neither a player is logging in on disabling the plugin (most likely, and if they do the plugin won't notice it anymore), your EventHandler will never fire, so conn stays null.
public PreparedStatement prepareStatement(String query){
PreparedStatement ps = null;
try {
ps = conn.prepareStatement(query); // conn is never being instantiated until here, so it **will** be null
System.out.println("SUCCESS: Successfully prepared statement.");
} catch (SQLException x) {
x.printStackTrace();
System.out.println("ERROR: Couldn't prepare statement.");
}
return ps;
}
set all block to air when a chunk is loaded?
?paste
okie thx
getServer().getPluginManager().registerEvents(new OnJoin(this), this);
i am pretty sure
i registered
the event
yeah another instance of that class
which will act as your listener
?paste
but not the one you are using since you are creating a new one
*new* OnJoin(this).prepare..
https://paste.md-5.net/torejulewo.java my RecipesManager class
error
thanks in advance
how do the render distance work. a 8 chunk by 8 chunk area is generated around the player?
if the render distance is 8
or is it a 17 chunk area
8 + 1 + 8
the player can see in
NoSuchMethodError:
each direction
1 is the chunk the player is currently in
16*8 blocks
16 by 16 not 17?
eeeee im lazy kinda of
so the chunk the palyer is in counts
and if someone can please help me understand why did that error occur
no
what error
oh nvm yes
probably because your server api and dev api arent the same
What does that mean?
I'm using a spigot 1.16.5 server
that you are coding with another api than your server provides
my google froze 0 mbps...
what
For example, you coded in 1.16, but you ran it on 1.14
As an example
That’s not allowed
No (for this case)
it is allowed but you have to look up which methods arent there anymore in the higher version or even in the lower
but im using it in 1.16.5
There is likely a big difference in 1.17
my server is 1.16.5, my plugin is 1.16
that was out of curiosity, sorry
then this method was removed in one of these 5 subversions
Yeah
Did you switch versions
no
and then you added this peace of code NamespacedKey.fromString(Ljava/lang/String;Lorg/bukkit/plugin/Plugin; and it stopped working as you can see
i dont see smth wrong with it though
??
your server don't have that method
any ide's that doesnt eat ram like chromium but has good autocompletion suggestions?
since its running an other api-version
its like playing minecraft 1.5.2 on 1.17
currently im on Sublime Text 4 with lsp-jdtls eclipse language server
your plugin yml just have the api-version to let the server know for what version you are coding
2Hex, you realize MC Version and API must be carefully chosen and coded to match. If you choose a higher MC version for the server you need to take account methods that may have been moved, modified, removed etc. if you are running a lower MC version you have to take account methods that may have not existed.
intellij 
aaaaaaa
so what do i do
I’m not spoon feeding you bro
it eats cpu usage and ram usage so much
Then use Eclipse 🤡🤡
it get freezes when i use intellij
is your computer a potato?
That’s not a potato
"[21:58:40] [Server thread/INFO]: This server is running CraftBukkit version 2991-Spigot-018b9a0-f3f3094 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
["
^
100%
it has like mini stutters
btw pulse
which i hate
"[21:58:40] [Server thread/INFO]: This server is running CraftBukkit version 2991-Spigot-018b9a0-f3f3094 (MC: 1.16.5) (Implementing API version 1.16.5-R0.1-SNAPSHOT)
["
lul
I’m out, going to take a break. Spigot discord is really not my mood right now
you can lower the ram used by intellij
where?
^
whats wrong with it?
are you using any build tools?
uh
didnt get ur question
Yes my plugin uses maven
is your dependency just the spigot-api?
yes
try to change it to spigot
wait a fucking minute
intellij idea literally keeps my CPU usage at 80% on dile
there we have it
i suggest using Clear VS 8.1 theme from deviant art
how in the fuckery fuck did that happen
not their fault
with aeroglass
IT IS
HOW DID THAT HAPPEN
IDIDNT WRIETE KIRHWUEIFGWEFWUEOFGWFH
are you drunk?
so i do i just change version to 1.16.5
yea
wats that
especially with aero glass
its a windows 8.1 theme
which makes windows 8.1 a bit more modern
how do i get it
from deviantart
btw i dont get why is there "RO" in the version
ok
its not a RO, its a R0
probably release
1.17.1-R(elease)0.1
o
ew is your hentai on pfp
but idk if there is any
well my IDE looks like this :D
that's great in a dark room
but when you have sun directly at the computer
FUCK
it sucks
my windows are never opened
||rename that folder entitties||
IM NOT PAYING FOR CUSTOMIZING INTELLIJ BRUH
always sitting in a dark room
el_titties
Vscode
vscodium ftw
Nah, I've had too many plugin issues with codium
how do i edit material ui plugins
Or I could just use vscode
i can run eclipse autocompletion on st4
before everything were purple
Green
intellij works for me except when i want to run test client and server for my plugins
it halts my system completely
Does intellij have docker capabilities?
what about netbeans tho
if i had more ram to spare...
but fucking ram is so expensive these days
and you cant mix them
intellij has docker support (mostly for dockerfiles and running these tho)
just use notepad++
You kinda can
mixing them is like playing russian roulette
what
use the intellij font ?
a good font for material ui lite
i don't want to spend money on thing which has 50/50 chance to work
kinda sucks
jetbrains mono is pretty neat
Most cases it works, you just need to use the lowest common denominator for timings
Segoe UI
have anyone tried netbeans before?
is what i am using
is it good?
I'd say 90% chance of working, almost 100% if you do some research about the kits
Netbeans is trash
define
how is the font size an issue of the font tho 😅
just increase your font size, doesn't mean the font is trash
you need to go to the editor config setting
i can just hold ctrl and scroll to change it
Editor > Font
ok now nothing is being written to the config java p.getTargetBlock((Set<Material>) null, 3).setType(Material.IRON_ORE); blockLocation = p.getTargetBlock((Set<Material>) null, 3).getLocation(); if (Generators.getInstance().locations != null) Generators.getInstance().locations.add(blockLocation); p.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("Generator Placed at " + blockLocation.getBlockX() + ", " + blockLocation.getBlockY() + ", " + blockLocation.getBlockZ())); Generators.getInstance().getConfig().addDefault("locations", Generators.instance.locations); Generators.getInstance().saveConfig();
It does have Docker UI now
I personally love docker for test servers
does chunk.load forceload a chunk
Yeah it's not bad
I'm working on adding custom recipes for custom items I made. They are based off of Iron Nuggets and use the 3x3 recipes to form a different item. For example; 9 copper -> 1 iron, 9 iron -> 1 gold, etc.
The current problem I'm having is the Recipe Book. I have it registering the recipes, but it doesn't seem to recognize the items in the inventory (but the crafting works). https://i.imgur.com/lG0CRq1.png
Any ideas how to fix?
you don't
I think we had this issue with nathan a few days ago
the client basically does not send the exact item to pick but only the material
are they custom items?
the server tho interprets its as an exact item match
which means items with NBT will not be selected to fill the recipe
It is basically a custom item using the ItemStack; using an existing material but pointing to a different texture using CustomModelId.
are the ingredients custom ?
Yes.
Oh
^ exactly
maybe this will help from my custom crafting project ```java
public void checkCraft(ItemStack result, CraftingInventory inv, HashMap<Integer, ItemStack> ingredients){
ItemStack[] matrix = inv.getMatrix();
for(int i = 0; i < 9; i++){
if(ingredients.containsKey(i)){
if(matrix[i] == null || !matrix[i].equals(ingredients.get(i))){
return;
}
} else {
if(matrix[i] != null){
return;
}
}
}
inv.setResult(result);
}
Does that do something for the Recipe Book or just the crafting?
the recipe book
then I made the recipe using ```java
checkCraft(new ItemStack(ItemManager.invertedApple()),e.getInventory(), new HashMap<Integer, ItemStack>(){{
put(0, ItemManager.compressAmethyst());
put(1, ItemManager.compressAmethyst());
put(2, ItemManager.compressAmethyst());
put(3, ItemManager.compressAmethyst());
put(4, new ItemStack(Material.GOLDEN_APPLE));
put(5, ItemManager.compressAmethyst());
put(6, ItemManager.compressAmethyst());
put(7, ItemManager.compressAmethyst());
put(8, ItemManager.compressAmethyst());
}});```
should work
why tho xD
obv replace this with your items
they could just use custom recipes
you can't use custom itemstacks in a recipe
shapeless recipes only accept materials?
they accept ExactRecipes
why does one need an SQL client xD
Just no
https://paste.md-5.net/sazurohoki.java my RecipesManger class, check last lines i have a onjoin event that gives the player the recipe discovery of the custom recipes i have created, why is it not working (player can craft the item but not see the recipe in the green book)
there is also this error
https://paste.md-5.net/zoqoqeweye.bash
for ease of access?
i mean
yea
you could do queries
oh like debug
I just use intellijs integrated one
or just download dbeaver on your pc and connect to sql server
?paste
pretty sweet for fast debug
for easy management
else, I just CLI tbh
https://paste.md-5.net/sazurohoki.java my RecipesManger class, check last lines i have a onjoin event that gives the player the recipe discovery of the custom recipes i have created, why is it not working (player can craft the item but not see the recipe in the green book)
there is also this error
https://paste.md-5.net/zoqoqeweye.bash
Is this just a bug that we have to wait on for Mojang to fix or is there any creative workarounds available?
not really a bug as far as nathan was able to find
seems rather intentional
one possible workaround is the paper event
paper event?
PlayerRecipeBookClickEvent
doesnt nms have a method to check recipes?
on paper
recipe book is useless
which you could basically listen to
bruh
and then execute your own logic instead
tho naturally that moves you into paper-only API
Oddly enough NEI/JEI registers the recipes
so does the recipe book right ?
someone pls help
a
but recipe book works differently from NEI, in order to craft something you need to get the items first while in nei you can see recipe like its in wiki
that's more useful
especially for people who don't know no recipes
i even use a mod to remove that recipe book from my client
and oddly enough you can get recipe book in your hands since its namespaced item by using minecraft:recipe_book
I am only using some of the functions
That’s cursed lol
and the player join and quit thing works fine
@paper viper uhh i have a question
why when i have a config from my old version of my plugin
and my new version changes the config
the config does not change
it stays as the old version config
Why do you have to ping
saving the default config only writes it if no file exists with that name yet
😤
im sorry
Oh
i have this in my main
saveDefaultConfig();
is that perhaps causing the issue
there isn't a spigot build in method to just overwrite a config if it changed
because that makes no sense
then what do i do
They need you
*so much *
o
but hwo do i overwrite
sorry for being a dumb fuck
Save the file with the same name
o
@hybrid spoke
https://paste.md-5.net/sazurohoki.java my RecipesManger class, check last lines i have a onjoin event that gives the player the recipe discovery of the custom recipes i have created, why is it not working (player can craft the item but not see the recipe in the green book)
there is also this error
https://paste.md-5.net/zoqoqeweye.bash
help pls
this thing must have a problem
return NamespacedKey.fromString(name().toLowerCase(), RecipesManager.plugin);
pls help
.
You are creating a new instance of a namedspacekey but never storing it anywhere
How?
Well you are never assigning it to anything
So you need to either store it in a map or array
What
Hey, I have seen that there is a method to know if a pressure_plate is pressed but it's deprecated https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/material/PressurePlate.html
and it says : Use BlockData, but in blockdata I don't find the new method to know if a pressure plate is pressed or not.
Someone know the new method ?
declaration: package: org.bukkit.material, class: PressurePlate
He is right afaik
Oh
Can you give me a brief idea of how can I do that
like an example or something. if possible
Umm
Yeah so have a recipe manager in another class
And have just the enum class for the purpose that it serves (being an enum not a manager)
seems like a question for the paper folk 👀
They normally know
Then within the recipe manager you can store those namedspacedkeys
Wait a second
No you just have the functionality in the wrong place
Sec let me show you
Once an entity is already attacking a player, how can I stop the entity from attacking?
Could you explain step by step what is supposed to happen because it is a bit vague 😮
changing/nulling the target, setting the AI to false
I am currently programming a plugin that allows players to tame entities. I want hostile entities to be able to be tamed without a problem, so I want tamed hostile entities to no longer target players and attack them. As of right now, using the EntityTargetLivingEntityEvent, I am able to cancel initial targeting of players. When a player logs in, their hostile pets will not attack them. However, when hostile entities are initially tamed, they are already targeting the player, so they continue to attack the player. It seems that EntityTargetLivingEntityEvent only handles initial targeting. I've tried to set the target to null for the targeting entity, but the hostile entity continues to attack once tamed.
In a sentence, once the entity is tamed while it is already attacking the player, it should stop attacking the player.
I have tried "event.setTarget(null)" and "monster.setTarget(null)", and I am getting the same behavior.
how can I make it so that the right click event only runs one time when the player clicks or holds click?
I suspect that once the player is already targeted, then the EntityTargetLivingEntity event doesn't fire. I'm not sure if that's correct, though.
what version?
The API version being used is 1.13, but I am currently testing on a 1.17 server.
1.17.1
can you show me what you got?
check for the hand involved in the event. PlayerInteractEvent is fired once for each hand
also holding rightclick is in minecraft not frequently. its everytime a new click for minecraft.
dam so if a player holds the button it just runs the code over and over?
if(e.getHand() != EquipmentSlot.HAND) return;
This is what I have at this time:
https://www.codepile.net/pile/9VjrvDVo
no. minecraft will fire the event again after the arm animation is done
you could check the latest and current click and compare their ms. if its 199~200 for a few times the player is probably holding rightclick
I have this added but it still fires twice
// Check if item is in main hand
if (e.getHand() != EquipmentSlot.HAND)
return;
and oh okay good to know
Could you show me the event @granite burrow in ?paste
You may need to check against which action you want to run.
wait would it be because of this?
if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) { because when I click the air it only runs once
@hidden torrent What debug values are you getting?
bro
the amount of people that ask this question is so insane lmao
anyway
the code runs for each hand
check if the hand is the off/main hand
follow the chat
Are you trying to break out of the loop because this return statement does nothing.
before judging people
o
didnt judge him tho
im not even good myself who am i to judge people :D
ye
I was trying to end the whole statement like no more loops or anything
did just realize that it wouldn't work tho
Then you want to use break; not return
nvm. its not. docs says it can be null my bad
he can also return immediately
did you debug until when its fired 2 times? @granite burrow
or since when
no Ill do that right now
wdym tho
i just went thru the chat
@granite burrow also ru cheacking if the hand is main hand
checking*
if not do that
yeah he do
oh okay good
the whole event runs twice
Here is some of the output in the console. The error stems from the target being null when attempting to print its name.
Could you also debug to see if the target is null in the first instance?
Before you set the target to null?
Well not check if it is null, but check what the target is?
could it be because when I right click I make the player look at a new block? @native nexus
because when I look at the ground it works good but a block above it sends double message
yeah okay after some testing that seems to be whats happening, is there anyways to prevent this?
What is inside the lookingAtBlock function?
private boolean lookingAtBlock(Player p) {
Material targetBlock = p.getTargetBlock(null, 100).getType();
for (int i = 0; i < openableArray.length; i++) {
if (targetBlock.equals(openableArray[i])) {
return false;
}
}
return true;
}
basically check to see if your already looking at the block
Does anyone know how I would teleport a entity to a player?
Or spawn one on the player
entity.teleport(player); ;-;
Thanks
my message that sends when there is no ores only sends once and you don't get teleported so im pretty sure its that
Hmm
is there a way to see if the player just teleported using the interact event?
What interact event causes a teleport 😅
Hey guys, im having an problem with NMS getDirection().a(), at a certain distance of blocks away, they dont work
oh no nms
throwing an enderpearl?
((CraftGuardian) guardian).getHandle().getNavigation().a(path, 2)
.
(returns false)
how can i set dig speed on custom item? meta.addEnchant(Enchantment.DIG_SPEED , 10 , false); don't work
I think the last boolean should be true not false.
^ hes right
the boolean is for ignoreMaxEncahnt
how would i make an armourstand that's name is different for everyone
sorta like that
how it says "Your stat is = this"
packet
You would have to spawn them using packets
Hey Elgar
It was 5 minutes later, I can understand some delay
na
North America?
sure
eu
HI, in the am here and I'm lost down the youtube rabbit hole.
That makes the guardian move to a certain location with the speed of 2
I believe the max distance is like 32
either that or 8 not sure
Creating via packets or modifying the packets before they get sent, both work
invisible pfp nice
had it for years
i did the same thing in google meet
I don't really know first-hand, but just from thinking about it
Packets give a ridiculous amount of control, huh
I did an entire hologram menu with packets
it does
it can do stuff spigotApi cant
How could interception of client -> server packets be useful
Um
block hax
ProtocolLib likes that
I used that interception to make client-side blocks
You can do some really hacky stuff
Ghost blocks?
This menu is purely client-side
Like that but clicking on them doesn't make them disappear
and you can break them and such
its gonna mess the hell out of anti cheats
if I'm doing this fancy stuff might aswell make my own anticheat
So what's up with that. If you begin damaging a block that doesn't actually exist to the server, what do you do
The server doesn't get mad?
it breaks
lol
wait no
if the server dont sent break packet
Yeah
it stays there?
Let me explain how this works
but it wont break
because I did this exact thing
imillusion protocallib expert 👏
Tag me
1 - Server sends Block Change (Or multiblockchange or chunk or whatever) packet so that the client renders the block
2 - The player tries to break the block, client renders the block breaking, sends "Block Dig" packet to server and renders the block breaking manually
3 - The client sends a Block Dig packet with the "Finish Dig" state (if the block isn't insta-broken)
Every time the player clicks, the server tries to send a Block Change packet with the block type
I have to cancel that for the effect to work
Now, right clicking is a lot worse
There' the Player Block Placement packet
But I was an idiot and decided to listen to the Use Item packet
Which fires only containing the hand used to click
So with a bit of raycasting and vector math I finally obtain the clicked block face and do my checks
Then I got my ego up and added worldedit schematic support
if (location.getLocations().contains(blockLocation)) {
if (p.getLocation().distance(blockLocation) < 2.2)
p.getInventory().addItem(new ItemStack(Material.IRON_INGOT));
}``` I need to get the distance of the block location but blockLocation is one variable and I need to access my arraylist of locations and get the distance
With some minor optimizations to send 1 packet per chunk section
how do you set multiple names to a entity?
I didn't really get that part about the "finish dig" state
PacketPlayInBlockDig
Is this sent when the block is actually broken from a manual dig?
There's an enum with the dig states
So a packet is sent on the start of digging, and on its finish
There are like 7 states
Christ
But I only listen to Start dig and stop dig
how to kick a player from the proxy
Like, one for each state of breaking texture? Or what are they for
Lemme see
answe dont got all day
Ohhhh
The breaking texture is rendered client-side for the player breaking
And there's a Block Break Animation packet sent to all other players for every state
There are either 7 or 9 states I don't remember quite
might be 7 too
What's up with that about the location always being 0 0 0 and the face always being -Y?
yk what would have been better
Or use the plugin message api
There's no block being broken anymore as there's no tool to break it
It should be like a block cancel and a player can only be breaking 1 block at a time anyways
iterative

