#help-development
1 messages ยท Page 1551 of 1
Maybe store everytime the player throw an enderpearl?
how would i know they didnt fall down 4 blocks before doing that
urgh dont tell me to implement pearls manually
wait
OnProjectileHitEvent?
i guess nevermind then
cancel pearl hit and pearl, teleport player, hit em for 5 hp
done
...nevermind again
that would make featherfalling stop working
uuurgh
huh
whats with that lousy reaction
How do I access the UUID of a player when it doesn't matter if they are online or offline? Right now I am using this:
Player target = (Player) Bukkit.getOfflinePlayer(args[0]);
Is there a better way of doing this?
Would I still cast it to a player? Or would I store it as an offline player?
you have to cast offfline player to player but can just do target = (Player) Bukkit..
You can not cast an OfflinePlayer to Player. You use offlinePlayer.getPlayer()
well, an offlineplayer could be a player, but there is no guarantee or sense in casting it
This might not work, but I am going to try to just use the getoffline function and the cast it to a player using the .getPlayer() it might work
if you need a Player, use Bukkit.getPlayer
if you need an offlineplayer, use Bukkit.getOfflinePlayer
very simple
You can not cast to Player. Player extends OfflinePlayer not the other way around. You have to use getPlayer()
All I need to do is convert a name of a player to a UUID if they are online or not.
then just call getUniqueId on the offlineplayer
I will try it, but do you know that this will work on online players too?
because online players are offline players
What is the name of the event when an anvil breaks?
BlockBreak event I think.
then you can test if the block is an anvil
that is for when players break blocks
But that is only triggered when the player removes it
Mb. You never specified. Idk then
If the anvil is used often, does it break itself, but there is no event for it?
i'm sure there is but i don't remember off the top of my head what it's called
How would I iterate through every block above a broken block?
a for loop just makes IntelliJ complain
a way is either through blockface or through location
It wants to put a colon there lol
a simple for loop should be the ideal way
No the event was not triggered
Yeah, but I can't get it to go into anything that would keep going without a for loop which it refuses to take
i mean there is a error why the for loop is not
working
wich usually the ide is rather explicit
It's just ; expected twice
show the for loop
What unit of time does Instant.compareTo return? Seconds or milliseconds?
I'm just stuck so don't be surprised if it's obv not gonna work lol
for (block.getRelative(BlockFace.UP).getType() == Material.SUGAR_CANE) {
}
Wait
you know what gettype returns right?
that obv won't work
good ol basics
however in your case a while would be better
but eh could get messy
also is this with condition? like only with a type only certain amount
What
do you want to go to infinity with it without care about stuff
I mean, kind of because you can make sugarcane as tall as you want
ah you want sugarcane
still didnt find how to damage a boat
private int checkUpSugar(final Location loc) {
final Location extra = loc.add(0.0, 1.0, 0.0);
int toRet = 0;
if (extra.getBlock().getType() == Material.SUGAR_CANE) {
loc.getBlock().setType(Material.AIR);
toRet = ++toRet + this.checkUpSugar(extra);
return toRet;
}
return toRet;
}
casting to livingentity does not work
Does BukkitTask.cancel() let the task finish it's current iteration before stopping or does it stop it right away
Is there a page for documentation on the plugin.yml file and different level of permissions for accessing commands?
whenever the call happens its gonna stop at
How can I let the task finish it's current iteration before cancelling it
That would cause a recursion issue in my use case then
a do while loop? It always executes the first iteration
tysm, my brain cells are gone at this point
Wait, but then how would I get how much sugarcane was above and give it?
i mean the method.. returns a int..
that int is the amount..
however this method doesnt care about the first block
its basically you call the method on a block,then it checks everything only above it
Oh
so i guess you can put toRet = 1 at start,and also break the block where you started
How do I make a custom help menu? Like what hypixel has. The normal spigot help menu is gross and shows what plugins I use on the server to the players.
custom help menu? almost nobody from here even play on hypixel its unlikely to even know what ur talking about
Ok. So like when you type /help I want to be able to customize what comes up rather than the default list of commands that spigot brings up.
ah
thats just default command list
you can override it with ur own plugin
just call the command help and it should run yours
I.e. someone types /help sees msg welcome to server. go to link for info
from there its all about your creativity to make it look nice
That helps. thx
Do I need to connect to disconnect from sqlite everytime i do some action?
what dies that mean? java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null
UUID uuid = DiscordSRV.getPlugin().getAccountLinkManager().getUuid(event.getMember().getId());
if (uuid != null){
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(uuid);```
uuid is not null
String playerName = offlinePlayer.getName();```
it means what it says
hmmm
but im using offline player
then it doesn't refer to the line of code you posted
to begin with, there is no variable by name of "player" in what you posted
google how to read a stack trace
doesn't look like it if you're asking for help with a NPE
paste the stack trace
[17:57:31 ERROR]: [DiscordSRV] java.lang.NullPointerException: Cannot invoke "org.bukkit.entity.Player.getName()" because "player" is null
[17:57:31 ERROR]: [DiscordSRV] at com.elunar.plugin.BitEconomy.getBalance(BitEconomy.java:201)
[17:57:31 ERROR]: [DiscordSRV] at com.elunar.plugin.DiscordSRVListener.discordMessageReceived(DiscordSRVListener.java:31)
[17:57:31 ERROR]: [DiscordSRV] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[17:57:31 ERROR]: [DiscordSRV] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
[17:57:31 ERROR]: [DiscordSRV] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[17:57:31 ERROR]: [DiscordSRV] at java.base/java.lang.reflect.Method.invoke(Method.java:567)
[17:57:31 ERROR]: [DiscordSRV] at github.scarsz.discordsrv.api.ApiManager.callEvent(ApiManager.java:134)
its longer tho but I dont think that will be useful
line 201 of BitEconomy class being
@Override
public double getBalance(String playerName) {
Player player = Bukkit.getPlayer(playerName);
return getYamlPlayerBalance(player.getName());
}```
that is 5 lines
return getYamlPlayerBalance(player.getName());
had to use @Override public double getBalance(OfflinePlayer player) { return getYamlPlayerBalance(player.getName()); }
seems like a simple fix
.
wat.
Cannot invoke Object.equals(Object)" because "v1" is null
v1.equals(null)```
so how do i see if something is null THEN?!
learn java
yeah but what the hell is the issue
LMAO
i always test if a object is empty like that
the issue is that you have no idea what you're doing
.equals is a method
methods exist on objects
null is not an object
you can not call .equals on null
v1 is a MetadataValue
and what do we do to compare things that aren't objects
also you mean i have to use == ?
v1 is not a metadatavalue if it is null
metadatavalue is the type of the variable; but the method is not called on the variable, it is called on the object in that variable
ah i see
if the value of that variable is null, there is no object, and you can't call the method; a NPE is thrown
org.bukkit.event.EventException: null
the variable, then, points at no object
it is a null-pointer
trying to invoke a method on it will throw a null-pointer exception
aah
You should store it by uuid not name
kinda
[Server thread/ERROR]: Could not pass event PlayerInteractEvent
Caused by: java.lang.IllegalArgumentException: Value cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[minecraft_server.jar:3161-Spigot-f773da8-f81f499]
at org.bukkit.metadata.MetadataStoreBase.setMetadata(MetadataStoreBase.java:40) ~[minecraft_server.jar:3161-Spigot-f773da8-f81f499]
at org.bukkit.craftbukkit.v1_17_R1.entity.CraftEntity.setMetadata(CraftEntity.java:769) ~[minecraft_server.jar:3161-Spigot-f773da8-f81f499]
at io.github.moterius.ofraces4.abilities.AbilityHandler.HandleRightClickThrowPearl(AbilityHandler.java:28) ~[?:?]```
That last method calls in that line the method below with a EnderPearl from `player.launchProjectile`, the key "nodamage_pearl" and the boolean value null.
```java
public static void setMetadata(Metadatable object, String key, Object value) {
object.setMetadata(key, new FixedMetadataValue(e,value));}
//E is the plugin main class instance stored in a static variable
Thing is: The metadata gets stored and retrieved - and i can run checks on it. So what's the error stemming from?
java.lang.IllegalArgumentException: Value cannot be null
setMetadata(MetadataStoreBase.java:40)
it isnt null
Read the error. and don;t argue. It says its null because it is.
the boolean value null.
java.lang.IllegalArgumentException: Value cannot be null
seeing an incongruity yet
errrr
wanted to say true
code says true
my brain gave up
EnderPearl pearl = player.launchProjectile(EnderPearl.class);
Echo.setMetadata(pearl, "nodamage_pearl", true);
pearl.setMetadata("EnderThrow", null);```
ah
forgot to delete that line
nevermind i said nothign
Why is your main class instance stored in an e var
its a static variable in the main class for quick retriveal
That has to break java conventions
since people told me to do that yesterday
but why is it e
e short for "what is this"
Use descriptive variables
variable/field names should be descriptive
especially so when they store important things that are accessed in a lot of places
true but since I'm always doing Echo.e and the only thing else stored in there is the FileConfiguration
it works fine for me
use Echo.instance or if you absolutely need to shorten it, Echo.inst
nobody knows what Echo.e is
eh cant argue with that
^^
by the way
1-character field or method names are a no-go (except for like, Location.x, Location.y, etc)
is java public static Echo Instance() {return e;} slower or just as fast as Echo.e ?
meet my 1 character localization method, public String _()
Firstly should be lowercased instance
no difference in performance
JIT will inline it
especially since it is static; if you were to make your class final then it has the highest chances of getting inlined
in english please?
Java is just-in-time compiled and java (not javac - even if javac will optimise some things) will optimise this
what does java compile during runtime? Isn't it a VM running only java interpreting the alredy compiled code?
whatever answer is given to you at this point will probably be misunderstood and won't help you achieve anything
don't worry about it yet
im just interested
sometimes i want to know the why instead of only the how
and that just isnt adding up
java gets compiled
you execute that compiled code
so where does JIT come in
javac compiles into JVM bytecode
JIT compiles it (the JVM bytecode) into magic, like machine code however
literally inside of Location its called x, y, and z
๐
Which is why I said the (except for)
JVM is capable of caching
What's the most used api for adding permission/economy compatibily to my plugins?
aah i think i understand. Javac makes the code as ready as it can be generally then java throws it thorugh the jvm. Is that why you can still sort-of read .class files given you use anything that understands java?
The CPU can also do that and it results in a lot of exploits
Vault
yes
Ok, I'll look it up
It is the main reason bukkit (and everything else) can exist in the first place
I found vault but it doesn't seem to support 1.17 yet ๐ฆ
It's capable of running
2 of my plugins are using it
oh, but it doesn't say 1.17 though
fine, I'll link you to a issue
now could people finally understand that bukkit is not forge
Thanks
vault doesn't receive updates, not because it's abandoned, but because it's "complete"
Lmao you took it personally or it's my idea?
Yep!
that said, that is a fucking joke as it doesn't even have uuid support
I have to agree, vault is meh
can we do a hostile takeover of it and update it by force
how is reserve looking? Last time it had quite a lot of issues
still pretty fringe and implemented like shit afaik
Is it hard to learn to implement the api? I'm new to making plugins not java
Did the author go MIA?
to be honest I'm more concerned by the fact that reserve is the primary alternative
Nope, pretty easy
with how horrible it is
not really
The author just doesn't touch to codebase anymore
Okay
And are there any other alternatives?
Eeeeh, even if there is, if it's not mainstream then it's going to cause "compatibility" issues with other plugins
then do it by force
How so?
pull requests everywhere
is the world.getTime() return analogous to the number of ticks passed in it?
since the docs only says 'analogous to hours *1000' and i dont know what that means
Then it isn't analogous to the amount of ticks
Lets fork vault
I assume that to obtain the day in the world you would need to do world.getTime() / 24000 based on that doc
I don't think that forking is much of an option
And continue by ourselves
It would need to have emitters, UUID support, removal of the depose/withdraw by name methods, actually proper bank support and much more
Forking would lead to nothing
Is a player group another way of saying a player rank? I am confused whenever I see this.
Rank is just an arbitrary name coined by servers to make the game more interesting, it can be groups with unique permissions
Okay, didn't know that
They way you said it is making me imagine that servers are con-artists ๐ ๐
I would call them PermissionSet if I were to name it something
can you forward the entire console to a player?
I mean, fork and... rewrite... the whole thing....
ah ok
i think its more about simply connecting to the logger
and forward it
I guess that is a better place
Why do you want to fork vault so much?
not sure it does what system out does,but it has a interface you can itneract with it at least
The issue is that paper uses another logging system
does it not use the classic 4logger
It may use it, but there is something added to it that may or may not change it
Nah just a thought, does it sound better if you tell the rest that this a fork of a well-known plugin
hmm i guess its a husttle then
I know that paper uses TCA and spigot not
Yea, true the "marketing" will just be way better than a brand new one
in that case connecting to current java instance and pullin console out its best case
dont think bukkit or spigot has anything that can connect to the console itself
its more of a java instance problem
I think you could mess with the log4j configutations - but I don't think that it is possible at runtime
the only problem i can think with log4 is that it only registers certain things
you wont have full console
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.metadata.MetadataValue.asLong()" because the return value of "io.github.moterius.ofraces4.Echo.getMetadata(org.bukkit.metadata.Metadatable, String) is null"
//Function a:
long time = System.currentTimeMillis();
Echo.setMetadata(player, "this_call", time);
//Function b:
long current = Echo.getMetadata(player, "this_call").asLong();
//This ^ is the line with the error```
I did verify that the metadata getter/setter work, and that the player variable refers to the same entity. So what's the issue here?
or rather why is it null when I'm clearly setting it just before
can you add a if check before getting it
did the server shut down in the meantime?
Well the methods are those:
public static void setMetadata(Metadatable object, String key, Object value) {
object.setMetadata(key, new FixedMetadataValue(echo_instance,value));
}
public static MetadataValue getMetadata(Metadatable object, String key) {
List<MetadataValue> values = object.getMetadata(key);
for (MetadataValue value : values) {
// Plugins are singleton objects, so using == is safe here
if (value.getOwningPlugin() == echo_instance) {
return value;
}
}
return null;
}```
But the key and the plugin variable are valid so it should alawys return a value
not too sure what you mean
whats the error?
ah i see
make sure your list is not empty, make sure this is true value.getOwningPlugin() == echo_instance
okay thats weird
it worked before but now that check is false
Oooookay backup
THIS: Echo.setMetadata(pearl, "nodamage_pearl", true); works with MetadataValue v2 = null; v2 = Echo.getMetadata(pearl, "nodamage_pearl"); that. BUT!
THIS: long time = System.currentTimeMillis(); Echo.setMetadata(player, "this_call", time); does NOT work with THAT: long current = Echo.getMetadata(player, "this_call").asLong();
The first instance returns a 'true' for the owningPlugin check, the second a 'false'
and it got nothign to do with the boolean values if i save a boolean as metadata instead and try to retrieve it it also says null
Does metadata not work with players?
@hybrid spoke
should work
well it doesnt
I'll try that
same wth the setMetadata
player.setMetadata
player.getMetadata("this_call").asLong();
player.setMetadata("this_call",time);
Hey, anyone know why me registering a listener class is returning:
java.lang.IllegalStateException: zip file closed
full error
?paste
are you using /reload
oh i thought it was caused by listener already registered
there are a lot of these errors since java 16, I've especially seen them happen on shutdown with network plugins
odd
plugins that utilize outside networking or async
Im gonna update my server jar real quick
like votifier, LibsDisguises
Hmm
but, on startup? haven't seen it.
EodHud.java:22?
.
Thats what that line is
can you post code tho
this.getServer().getPluginManager().registerEvents(new Handler(), this);
they might be something named Handler already
still name it something better like "EodHudEventHandler"
I'm trying to give a player a smooth animation when they join the server by making them ride an armour stand and teleporting the armour stand (I tried teleporting the player but it was very janky and didn't allow the player to look around). For some reason, when my armour stand is invisible, the player remains sat where they started riding the armour stand until they press shift, but they aren't teleported with the armour stand. However, when the armour stand is visible, the player isn't made to ride it at all, though I can see the armour stand does the animation perfectly. Anybody got any ideas why? https://paste.pythondiscord.com/totacekavo.java
what do you expect?
teleporting players is janky and shit no fix for that
The player to move with the armour stand
that aint the issue here tho so like ye lol
whats in your event handler
Well, a few people recommended having them ride an entity and teleporting the entity as that removes jankiness for them
I removed everything in it just to make sure it wasnt anything in there
can you send full code in a paste then
Who are you talking to?
shmezi
Alright
yeah idk but teleporting is really janky
Well, even if it's janky still, I know this will fix the rotation. But, at the moment, the player isn't moving at all
so how do you know your class Handler is the only class named Handler
if I click on it, it brings me to my handler class ?
why are you disabling the fucking plugin in onEnable
lol i see that now
lmfao
thats not the issue.
That was a mistake from the debugging lol
yes it is
it is the issue
because you cant register a event when the plugin is disabled
Probs was left from me trying to debug lol
how can i search further in a config option? lets say i want to get the individual lines of the scoreboard
this took forever (responsive too :) )
We never speak of this again ๐
I feel like an idiot, anyways thanks yall lol
#getConfigurationSection
and what would be the path in this case?
something like this?
String name = plugin.getConfig().getConfigurationSection("scoreboards").get("1").toString();
to get the title
hi guys i need help
how i get who kill on PlayerDeathEvent?
i dont see and method for that
what is the method?
On the damage event
Check the health and delt damage, if it is gonna be enough to kill cancel it and run any code you need
damn my plugin uses crop state
and the server just starts initializing legacy suport out of nowhere
is there a way to like tell the server to initialize when it starts up
Everytime I need to pull data or set do I need to connect to the database and disconnect? I'm using SQLite
They said it would be nice to keep a connection active, but when I remove the disconnect and connect option it returns null when pulling data.
hmmm
ShapelessRecipe rec = new ShapelessRecipe(new ItemStack(item));
declaration: package: org.bukkit, class: NamespacedKey
:/
is shapelessrecipe is deprecated
whats the recommend then
ah nvm
ur using a deprecated method lol
yea just realized it
new NamespacedKey(this,"BUKKIT")
this should fix it
ShapelessRecipe rec = new ShapelessRecipe(new NamespacedKey(this,"BUKKIT"),new ItemStack(item));
do you know css?
nav a::before {
content: '';
display: block;
height: 5px;
background-color: black;
position: absolute;
top: -.75em;
left: 0;
right: 0;
transform: scale(0,1);
transition: transform ease-in-out 250ms;
}
nav a:hover::before {
transform: scale(1,1);
}``` cuz the background-color on this isnt working ;-;
and i need help fixing it lol
nope
f
anyone knows a plugin to make custom model mobs on server?
mobs
custom models?
if you want mobs with custom models you need a resource pack
i think the models only apply for items
Basically impossible to tell unless you show us almost everything involved
alr
w/ txtpack you cant do mobs
U got it on GitHub?
no
So i've used the connect thingy with a bungeecord channel
public void connect(Player player, String server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(server);
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
Now I don't believe it returns anything, is there any way I can detect if it has succeeded or failed for whatever reason
What's the best method to use to figure out which dimension is a specific world is in?
Are there constants like Dimension.OVERWORLD etc..,
or do you need to use World#getName.contains("overworld") etc...
@ivory sleet heres my css https://paste.md-5.net/rimotafore.css
Damn so unused to css but yeah gimme a look
nvm, it's getEnvironment
lol
Uh well I will try help once I get on pc
Yeah dealing with css code is bound to unpleasant things which I canโt handle right now lol
any ideas?
Probably #help-server?
So i've used the connect thingy with a bungeecord channel
public void connect(Player player, String server) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF("Connect");
out.writeUTF(server);
player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
}
Now I don't believe it returns anything, is there any way I can detect if it has succeeded or failed for whatever reason
will this point to "title"?
plugin.getConfig().getConfigurationSection("scoreboards").getString("title");
(ignore those red stripes)
i'm pretty bad at this
I'd recommend you learn more about the yaml api and just standard practices
Considering that wouldn't work
do you depend on the server implementation ?
uhh i just want to access the .damage() method
@foggy bough you should learn how to read a stacktrace..
my main class and line 20?
yes...
yes
but I don't have a line 20 in my main class
ok
maybe changed it
Then you changed something, recompile the plugin and test it again..
ok
why don't you have an ondisable?
I really don't need it
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:139) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:394) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:301) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.loadPlugins(CraftServer.java:383) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.reload(CraftServer.java:879) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]
at org.bukkit.Bukkit.reload(Bukkit.java:651) ~[spigot-1.16.5.jar:2991-Spigot-018b9a0-f3f3094]```
I got this error again
Please read the stacktrace, it clearly says what the error is ๐
is my plugin.yml ok? main: com.joelj.plugin.Main name: OPStuff version: 1.0 api-version: 1.16 commands: opstuff:
If you're plugin.yml would be invalid you would get a other error message.
Please read the stacktrace (the first line...).
does persistent data in an itemstack also appear in the block persistent data container if is is placed from that stack?
no
also, are there some blocks that cant have persistent metdata?
Nice!
Do someone knows how to use kubernetes with bungeecord?
send dm
Feels like a google question, something more specific you need assistance with?
can you store custom data in placed blocks?
TileEntities
yea what it was is i was doing the pseudo elements on the a instead of the p
Oo
i have this now ```css
nav p {
opacity: 1;
position: relative;
}
nav p::before {
content: '';
display: block;
height: 5px;
background-color: var(--main-nav-text-hover-color);
position: absolute;
bottom: -.75em;
left: 0;
right: 0;
transform: scale(0,1);
transform-origin: center;
transition: transform ease-in-out 250ms;
}
nav p:hover::before {
transform: scale(1,1);
}```
when it wasnt working before it was with the a
i fixed a bug in it rn
when you where in the mobile mode and you open the burger menu when you went back into desktop mode it like moves the nav bar up and to the left more
fixed it by doing this ```css
@media screen and (max-width: 899px) {
.nav-toggle:checked ~ nav {
display: block;
transform: scale(1,1);
}
.nav-toggle:checked ~ nav a {
opacity: 1;
transition: opacity 250ms ease-in-out 250ms;
}
}```
instead of having it without @media screen and (max-width: 899px) {
Oh well I use sass so kinda unused to the syntax but yeah sounds reasonable
lol
this nav bar took me like 9-10 hours
xd
<?php
include 'site/base/index.php';
echo
'<meta property="og:site_name" content="Site">',
'<meta property="og:title" content="Site">',
'<meta property="og:description" content="Site">',
'<meta property="og:image" content="/test/site/img/icon.png">';
?>
<title>Site</title>
<link rel="stylesheet" href="styles/main.css">
<script src="js/main.js"></script>
<?php include 'site/inc/nav.php'; ?>
<content class="content">
<p>Test</p>
</content>
</body>``` im using php :)
๐ฅถ
lmao
is it really that bad
Uh no newer versions of php is fine
I guess it kinda has a bad reputation for its notorious history
I know for a fact a lot of php stuff back then didnโt use prepared statement for instance
?
can someone help me with this error?
i still dont know how prepared statement prevent sql injections
Prepared statements prepare the statement such that it canโt be changed, you can only set the params
A normal statement can be changed so for instance you could comment out half of the statement and then write your own sql thing
my toes hurt
Though I guess this explanation isnโt really whatโs actually going on but myeah something like that
w h y
i don't know, nerve damage or something
But you can still walk or no?
f
Do you program with your toes instead of your fingers or how do you accomplish such misery?
See I have an amazing skill of walking into walls or stubbing my toes randomly
First time I broke a toe was walking on smooth concrete that was wet
๐
it started back when I was in military
the doctor said it was like nerve damage or something, it was kind of unclear why things are as they are
too much marching ig
How fucking old are you NNY
your 7?
7 huh?
prove it
eg: voice recording
/face reveal
lol
I have a really weird question but can firework rockets not be shot downwards?
ยฏ_(ใ)_/ยฏ
wat you can setOp on a firework
declaration: package: org.bukkit.entity, interface: Firework
you can set op on any entity
but why on a firework
you can make lightning op
Well all entities can execute commands
found it
firework#setShotAtAngle
yeah it wasn't going down without that
weird mechanic
probs cuz they want to make sure that you cant make it shoot it down or diagonal when you place it with the firework item lmao
simply setting the velocity would do that
or maybe they lazy to set the velocity itself
or maybe its just there cuz why not
they probably don't want the direction to be affected by stuff that'd otherwise modify the velocity
f.e pushing it with a piston, or explosions
or that
probs that
but couldnt they just make it not pushable?
and have it phase into blocks instead?
i really dont know why you cant extend more than 1 class in java but then now i think about it they might be a few conflicts or something
cursed
im selecting two things
lol im using tab for one and then hovering over another one
xd
You just extend something that extends something else
i mean i guess but then its kinda not really like extending two classes
cancel the event?
afaik there is no even for it
there is?
You can not guarantee in a generic sense that extending two classes will not create conflicts. So instead there is an interface system, which is more coding, but in generic sense guarantees any conflicts will be solved. You can implement essential as many interfaces as you want. https://docs.oracle.com/javase/tutorial/java/IandI/createinterface.html
This beginner Java tutorial describes fundamentals of programming in the Java programming language
ah you can edit it in the fireworkmeta, I see now
lol
there are some languages that do allow multiple extension, but java doesn't do that
I can smell constructor and instantiation conflicts
How to send a player to another server (using bungeecord)? Like when the player types command /server event I want to do it server-side from a plugin (and forcing the player to use /server command is probably not good idea)
Register your plugin as an outcoming channel
Then use the PluginMessageRecipient to send messages to the BungeeCord channel
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I already read a similar thread to this (from 2018) and first look at the code, it looked unstable, but since this one is official I guess there is no other way
Ty
Itโs not official, anyone can edit it however itโs a good base
Didn't know spigotmc wiki is public, but if its correct and it works, its good
Nearly all of the wiki works just we keep it updated
i fucking hate burgers
shittiest innovation of web design ever
the logo is my favourite
rofl
what r u planning to do with it
making a cool site :)
oh ok
f
it looks tiny on ipad pro
apparently
oh theres a bug if you turn around on a phone you cant scroll lmao
well, is there something to scroll for?
ye
I fixed it
I just made the navmenu smaller when your rotated the other way
But I realised why it didn't work
The navmenu was fixed xd
React components ๐
Coding something yourself gives you more control :)
and worse results, generally
Yeah but who cares
jpg is shit and i think my phone takes screenshots in it
#eww
but also my phone has a shit screen lol
i think
that jpg image looks better on my phone lmao
oh if i open original it looks better
is that just discord making it look shit
i found out that 5rem is smaller than 100px
on my screen
So using this it is also possible to create custom channels? (Using a string other than BungeeCord)
How the hell does Location.getYaw() work? The Javadocs say that it will only output 0-360 but i seem to get -180 - 360
i thought its meant to be -360 - 360
How does that work then?
ยฏ_(ใ)_/ยฏ
I've been trying to re-implement something like the compass into my UI and it's driving me insane
wait isnt it meant to be -180 - 180
if I access the value of a public static final field before it's assigned, does it explode or does it return null ๐ค
I've got a question regarding unicodes and String conventions. I am have an int variable that I'd like to turn into a unicode to use as an emoji in game. This int is 0 <= x <= 31, and I combine it in a String using something like String unicode = "\\uEC" + num;. This gives me the correct unicode in a string format, but does not actually display the emoji that it should go with. If I were to manually write the unicode, like \uEC01 then it would work fine. Any ideas?
i would think null :)
one would think so yes
is it possible in a lan world to get port 25565 ?
create a char with the actual numerical value of the unicode code
that is, 0xEC01
use whatever method Integer provides to decode the hexadecimal string into an integer and cast it into a char
NNY is it possible to get port 25565 in lan worlds
i have to cuz my brother only like them
i think it just tries to bind the port and catches the error if it doesnt work
i have literally never looked into the client
Will try that, thanks
hey guys, how do I import CommandKit();?
but Do you think theres a chance it can be on port 25565
i sure hope it doesnt bind to 265565
why wouldn't you want it to bind to 25565 anyway
25565*
Do you have a CommandKit class anywhere in your code?
Nope, where should I create it?
Are you looking to cast the int to a char?
Well in order to create a new instance of CommandKit you need a class CommandKit, and that class has to implement CommandExecutor. Learn java
u know java?
I'm a beginner
ok, that's fine
your question will be answered when you start learning object oriented programming
Well I've got this code that will make a unicode with a given number, String emoji = "\\uEC" + (num < 10 ? "0" + num : num);, the only issue is that when sent in game it does not show an actual emoji, but rather the unicode (e.g. \uEC01 or \uEC31). If I were to actually write the unicode String emoji = "\uEC04" it would work and turn itself into an emoji
I'm coming from C#, and since I like Minecraft, I'm learning to create my plugins
General idea is : you can't create something that doesn't exist in this case CommandKit @true jacinth
thanks
c# is similar to java btw
what the hell
Minecraft doesn't have emoji support
It is in accordance with a texture pack, very hard to explain
I know what you mean
but that's not the way that way works
you need to either replace existing characters with emojis or make them in a custom font
I suppose the easiest solution would be to make a map with the corresponding unicode for the given number
but I am sure there is a solution where I could simply concatenate the number and other characters to form the unicode
that's not how mc works
You can, but minecraft doesn't convert that unicode to an emoji
Yeah, my issue exactly. If I send the player a title using the /title command it works
What command you used?
/title <player_name> actionbar {"text":"\uEC01"}
that displays an emoji to the player, and actually converts the given unicode to the emoji
a
You used that command along with a custom texture pack?
Yeah, displays the emoji fine
but I'd much prefer sending the player a message than using the command
additionally the command sends opped players a message
may I give a look to the texture pack?
Texture pack is private, here's a snippet from the default.json in the font folder:
{
"type": "bitmap",
"file": "minecraft:item/compass_29.png",
"ascent": 8,
"height": 9,
"chars": ["\uEC29"]
},
{
"type": "bitmap",
"file": "minecraft:item/compass_30.png",
"ascent": 8,
"height": 9,
"chars": ["\uEC30"]
},
{
"type": "bitmap",
"file": "minecraft:item/compass_31.png",
"ascent": 8,
"height": 9,
"chars": ["\uEC31"]
}
for context the given number is a direction that corresponds to a compass emoji
to direct a player to a given location
Have you tried sending the message to the player using Components?
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(emoji));
where emoji is a unicode like I explained (\uEC01 or \uEC24 for example)
what minecraft version you are?
1.16.5
Bear in mind if I were to explicitly type the unicode for example player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent("\uEC10")); it works fine
it is just how I am concatenating the string with String emoji = "\\uEC" + (num < 10 ? "0" + num : num); that does not convert it to an emoji
...something with how java works I suppose
whats the .spigot() for?
Yes, I know what, you are using a literal to define a character using unicode numbers
to send an action bar, not significant here
do you need it?
Yes
I mean, the unicode character gets changed all along when you write the complete sentence using the \u
If not, you will get a compile error, because I think that character is changed at compile time
ah ok
You are escaping the \ so it wont work
i was wondering what it was for
you need to find a way to get the character associated without using \u
hmm
MrTommy I am quite suspicious how you got that dot there
what's the best way to store cords to be grabbed through server restart that can change based on the world loaded. Using this for marking objectives for a minigame that has multiple maps
You could always store the Location value in the config
Would armorstands work?
well
you would need to keep track of the armorstands then so that you can somehow retrieve them post restart
yeah that is an issue
just use a flatfile in the first place?
wait there's a world.getentities() that I could sift through on startup. because it's a minigame world it's not like there are very many entities.
what does it mean when the java edition on the logo in the launcher is gone sometimes or turns transparent or half of it is gone cuz thats what happening to my brother rn
what config are you talking about here?
just a yml file
sounds odd. havent encountered such an issue myself
I have 8gb 
same
world.getentities only returns loaded entities
am I able to store a config file within the world folder?
don't do that
Realize I don't need to because I already have a different server folder for each map for world guard and stuff like that
Is there a way to check if an entity with the given UUID exists even if it's unloaded? I don't necessarily need the Entity object, just need to check if it exists.
Well in 1.16 world.getEntity(UUID) seemed to work fine even if the entities were unloaded (or I guess manually loading the chunk loaded the entity as well and I could therefore get it)
So I guess is there a way to force load an entity since loading the chunk the entity is in doesn't work any more
if the API says the chunk is loaded, all of the entities in the chunk are also loaded
like blocks, entities also belong to chunks and load and unload with them
How do I fix this? I tried editing my plugin.yml so many times that idk know anymore what to do
you forgot description
oh my god...
you donโt need description
i think you do
you dont?
got the error again
and author?
a version is already added, im gonna see about not packaged
i mean, if this is not packaged...
open it up
open it up in winrar
there are my classes here only
that means your plugin.yml isnt getting packaged
yo, any sort of event listener specific to cartography tables? looked on the spigot javadoc and couldn't find any
make sure its in src/main/resources
yea it is
do you have any tutorial on how to learn more about this? I don't think i did this
click the maven button in intellij
yeah @true jacinth run mvn clean install in the terminal rq and package that way. Send over a screenshot if it gives you an error message
maven button? sorry im a beginner
should be on the side
ah icic you're using gradle
XD
welp idfk about gradle
@true jacinth do you have gradle installed on your system or is it just added to intellij?
I tried doing this
added to intellij
then type gradle build
build successful
lmao im sorry for being dumb
no you're not dumb
@true jacinth check to see if the plugin works now
I believe this was actually changed in 1.17. I just checked and the chunk I was looking for a mob in was loaded but the entity did not exist
๐คฆ
this is the full error i guess
send a screenshot of your entire ide with the directory
^^^
oh, this?
yes
your main path is wrong
main points to your main class
I'm trying to find the main class but it seems I don't have one... but this seems wrong because I can build the project
the compiler doesn't give a shit about having a "main class"
"main class" as we speak of it is purely a bukkit concept; the java language or compiler doesn't care
if you still have the issue, you will need to remake your main class so go to the directory (me.mystAnorak.Commands) and create the MC_Kits class and make it extend JavaPlugin then add your onEnable and onDisable
It is already added, atm I'm trying to figure out why it says this. I could enable the plugin
perhaps is compatibility
give the full error
most of the time it can't enable for a reason
and send ur main class on https://paste.gg
A sensible, modern pastebin. Share text and source code snippets with no hassle.
you're probably instantiating your main class somewhere
and I don't know where
send your code for MC_Kits.java
it is according to your plugin.yml
i had to rename for this, instead of me.mystAnorak
does it work now?
yes, but still has that error
send the error
here
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
so at the top after extends JavaPlugin add implements CommandExecutor
thanks
your error is because new MC_Kits() doesnt return a CommandExecutor which the .setExecutor() is looking for
if MC_Kits is your main class, you should not do new MC_Kits()
Wdym?
you should not and you can not instantiate your main class
an instance of it is already created by bukkit, and it is expected to be a singleton
bukkit enforces this singleton property; if you try to make another instance, it explodes
shoudnt they use this instead?
yes
at start I edited from new CommandExecutor() to new MC_Kits() because I didn't wanted to add a new class just to add some lines of code when I could do in the same
but i guess its time to go back
you should learn java
yea
thats what is should be
(without imports cuz i dont know them off the top of my head)
this is my main class if this helps you out
hmmm thank you
ok
a question
why does the math.random like
output the same value multiple times
on some oocasions
cuz its random
The likelihood of it returning the same value 20 times in a row is slim to none
not eaxcly 20 times in arow
Unless you're casting it as an int and get very unlucky
how big is ur number range
i think i was just being unlucky
๐คท
hmmmmmmmmmmmmmmmmmmmmmmmmm
so java random is broken
why is it broken
MrTommy. (the dot at the end)
it was a joke lol
ah
I have never seen random generated this way in java
okay
Fire fire = (Fire) block.getBlockData();
System.out.println("block.getBlockData is instance of FIRE");
fire.setAge(fire.getMaximumAge());
} else {
System.out.println("Block data isnt instance of fire");
}``` is there a proper way to put out a fire without setting the block type to air? setting the age does nothing.
SplittableRandom 
the reason why they give similar output is because random uses like the system time or something as a seed internally
so if you create two randoms at the same instant you get two identical randoms and thus two sequences of identical random numbers
If u need something secure, SecureRandom does exist.
myes
the util random should never be used for things like cryptography or things that need security
indeed
i'd be surprised if 2 randoms generated at the same time gives the same results
I think JavaScripts Math.random() is time based like that Idk if the same deal goes for Java
Random random = new Random();
Random random2 = new Random();
System.out.println(random.nextInt() + ", " + random2.nextInt());
Yeah this never gives me the same int
2 seconds looking at the seed generation explains why
I believe Math::random uses a single random instance though
likely
is fire a block?
yes
also you cant put fire on TOP of a block without setting the block on top to air
or fire on the side
since if you place a block on the side with fire
it gets extinguished
yes well it prints the debug message.
i set the fire with
if(block != null) {
block.getRelative(BlockFace.UP).setType(Material.FIRE);```
why does that matter
it probably meant
that the fire got spawned
and extinguished
so you hit a block
and it stays lit, but trying to extinguish the fire is my issue, im trying to do it without setting all the blocks to air.
i'm listening to the blockignite event and adding all blocks burning by that fire to a list. I'm trying to put out the fire after 15 seconds
and then the block's top face get lit on fire
waht does .getRelative return the block you click on or the block above it
what's wrong with just setting it to air to extinguish it
the doc did a poor job of explaning
nothing's wrong?
because thats removing all blocks that are currently on fire
wdym all blocks
after the 15 seconds im trying to extinguish the fire
only the block thats on fire?
then just set the fire that you need to extonguish to air?
only the blocks that are on fire, if i set them all to air it works perfectly
but i'm trying to extinguish the fire instead after 15 seconds
then set it to air after 15 seconds