#help-development
1 messages · Page 1720 of 1
Sir
still same error tho
API versions are 13+
after fixing
Don't use 1.8
!!
remove .8S
Just 1.8
also ew 1.8
same things
Is it even a valid API version?
I thought it 1.13+
it worked for me
upgrade to new versions, why do you use this old stuff
Dear the machine in the future, we love to be an old dinosaur that still good
Material.STAINED_GLASS_PANE, 1, (short)14
Material.STAINED_GLASS_PANE, 1, (short)5
anyone know what colors these would be in 1.13+?
It's a waste of time to make 1.8 server
Not rly
It will run for ~1 day
Most servers are in 1.13+ now 🙂
If it's popular
A minigame server mainly depends on combat features, which depend on 1.8
Not really
Old combat mechanics exist
I have a modified viaversion installed so u can play even in 1.17
Need to know 1.13+ Material name
google my dude
Bruh StackOverflow answers didnt work
at this point its illegal
- Are the files even in the jar
I really dont know
me new to ze java
im trying to package the dep with the jar
open the jar....and look for postgres classes, I'm not sure on the path they use but as long as you're not using a shit IDE you can probably find out
nope, its not packaged
Me who uses IDEA Ultimate: Is it Shitty?
well then google "gradle how do you include dependency classes in a compiled jar" and it'll probably help.
I personally don't use gradle cause #FuckGradle
Nah, not if it's in an actual repository.
You'd use <dependencies>, maybe there's a <scope> you can use, however I don't use it lol
Is there a way to get all entities inside of an entityblockstorage? dont see anything
and nearby entities doesnt show them.
Use shadowJar plugin
Material.SKULL_ITEM anyone have any idea what this is?
Is it just the skeleton skull?
(dumb pre 1.13 code is dumb)
SKELETON_SKULL
^
Can't wait until this shit's updated and cleaned 👀
quite literally most of the errors is legacy material bullshit
does it use nms?
Yea, the material stuff is direct Material calls Material.MONSTER_EGG though.
it's 2016-2017 code
that’s not nms lol
I will
....no fucking clue what I'll replace Material.MONSTER_EGG with though 😐
like... the fuck..
better go get yourself a de obfuscated decompiled jar
huh - no that’s not what i mean. when you go to say CraftPlayer - all the fields and methods are named like ,a,b,c cause they are obfuscated- so any nms work becomes a chore as unless you can use the return type you have to look them up
Not really the case here, to an extent anyways. It's not super heavy NMS
right ok
In other news, i still have no fucking clue what Material.MONSTER_EGG is
Yes... I'm aware..
There's 392423904390 now
I'm not even sure you can get a generic spawn egg 👀
this just in:
Fuck anything below 1.13 even more
Everything says it's fucking stone, really?
REEEE
thank fuck i have 1.12 and below jars
MONSTER_EGG(383, 64, (Class<? extends MaterialData>)SpawnEgg.class),
1.12.2
383 being the id
what the hell are you doing lol
converting a project made in 2016-2017 to be modern
first i need to find a very that accepts ids for /give ejfreiowjrioewjrfeiofjrioejrteiotjie4tior
383... literally just a general spawn egg... the fuck
#GonnaHopeForTheBest
WOOD_DOUBLE_STEP(125, (Class<? extends MaterialData>)Wood.class), the literal fuck
@opal juniper BRUH
the fuck
you fricked minecraft
I had to go back to 1.7.10 for this shit, and it's useless
the literal fuck is this shit
how haha
lol
WHY
https://github.com/Conclure/cityrp-core/blob/master/build.gradle.kts @zealous terrace
thx
java 69
Could not determine the dependencies of task ':compileKotlin'.
Could not resolve all files for configuration ':kotlinCompilerClasspath'.
Cannot resolve external dependency org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.61 because no repositories are defined.
Required by:
project :
-
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. -
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 419ms
Great, Bukkit is broken now
Did u copy mine literally?
wdym
bruh im dumb, I removed kotlin dep
great I dont know how to add it back now
I never had a kotlin dependency to begin with
Dude
ur entire project setup would be good if I could have a look at
this is my build script ^^
Well you must have changed?
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id("java-library")
id("com.github.johnrengelman.shadow") version "7.0.0" apply (false)
}
group = "com.rithulk"
version = "1.0"
description = "ranks"
java.sourceCompatibility = JavaVersion.VERSION_17
subprojects {
apply(plugin = "java-library")
apply(plugin = "com.github.johnrengelman.shadow")
java.toolchain.languageVersion.set(JavaLanguageVersion.of(16))
this.buildDir = File(rootProject.buildDir,this.name)
repositories {
mavenCentral()
mavenLocal()
maven {
url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}
flatDir {
dirs(
File(rootProject.rootDir,"libs"),
File(rootProject.rootDir,"libs/cache"),
File(rootProject.rootDir,"libs/plugins")
)
}
}
dependencies {
implementation("org.postgresql:postgresql:42.2.24.jre7")
compileOnly("org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT")
implementation("org.jspecify:jspecify:0.2.0")
}
}
yes and that wont work
why
because you copy pasted it
thats not what matters
anyways when I said add shadowJar plugin
I didnt mean copy paste my build.gradle.kts
just add the plugin
id("com.github.johnrengelman.shadow") version "7.0.0" apply (false)
one line
why is the apply(false) important again?
no you can probably remove it
it means it should be added to the project but not applied to the project
bruh still the postgres jdbc mf is not in hte org folder
probably because you did something wrong
wait I see it
I think
IT WORKS
THANKS A LOT CONCLURE
im too happy sorry
it took a whole friggin day
now I gotta look at how to compile the jar in a seperate folder so that I dont have to move it every time
ok hav a gret tam
u have any idea? xD
ok
which is executed after shadowJar
gif embed fail :p
@opal juniper i take it back, there is NMS pain 😐
has to do with villagers
public VillagerNMS(EntityTypes<? extends EntityVillager> entitytypes, net.minecraft.server.v1_16_R3.World world) {
entityTypes, what, if anything gets passed to that 🤔
People have already helped you though
And you shouldn't be designing a plugin like you would with command blocks
i have over 100 items on my server that are made and work with commands i cant just start over
You probably should for performance
But fine if you don't want to... what do you still need help with
Im making a leaderboard for stats that doesnt let me choose what position to get (Like get 1st place or 5th place of %statistic_mob_kills%)
what would be the best way to do it myself?
i want to do it with a bunch of different stats from different plugins
using PlaceHolderAPI
my(Lions_lmao) score is 1 as seen on the sidebar but when i try to run a test that detects if my score is 1 it fails.
You would have to query the statistic from each player and store it somewhere. Do note that placeholders might not work on offline players and thus you need to store things yourself
thats my problem
Plugin scoreboard might be different from the one vanilla uses 🤷♂️
You might as well just force the player to run a command
ok thanks. I could probably loop through all OfflinePlayers, add them to a Map with their UUID and the kills value then sort that. pretty sure thats what vault does
also should I do it as a PAPI extension or as an actual plugin?
oh boi over 100hours lost yayyyyyyyy i want to dieee
Plugin
ok thanks
i just realized i dont even know how to make the items with just plugins. im just frustrated at this point.
How to give score to the player?
There are usually 2 entity constructors available, that's the second
I believe you gotta teleport after spawning it in
Yea, i figured it out
my pain is now schematic bullshit since this is all pre 1.13
The generic type requirement is there because there are multiple classes that extend it
reallllly hoping XMaterial can help here lol
I believe I had to find this out because zombies
Elaborate 👀
It's working off ids instead of how things are done now
block.setType(Material.getMaterial(iduri.get(loc)));
block.setData(data.get(loc));
block.getState().update(true);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
so I'm gonna just chuck XMaterial into the plugin and hope for the best lol
are you updating a plugin or something
Yea
You better be getting paid good to be updating tons of NMS on a plugin to 1.13+
It's not tons of NMS actually
and the above code doesn't touch NMS at all
and I'm doing it myself cause it would be nice to have this resource available on newer versions 👀
I wouldn't need XMaterial, but i cba to update this single class to work with how it's done now
mainly because i dunno how 👀
I can take a look if you send the class
I half-assed it with XMaterial it's fiiiiiiine
just need to deal with the NMS stuff though.
It just seems like they're making it so the villager doesn't move however, so i don't think NMS is needed at all anymore lol
nvm, they have modified pathfinder goals
I'll need to look into it when i get up though
how to apply this to an entity
Wait, i need to ask you guys this:
so you guys have a way to increase the variables as a way to count time (like each 20 ticks increase by one, yeah), but when we stop the server, is the variable still have the same variable when start the runnable again?
No
what are you even doing @vagrant stratus
what the hell is this method ? getI18NDisplayName
i try to get display name of an item (bukkit one)
and the method is just name like this
“In computing, internationalization and localization or internationalisation and localisation, often abbreviated i18n and L10n, are means of adapting computer software to different languages, regional peculiarities and technical requirements of a target locale.”
ctrl + f ?
If you want to store data in an entity you should use its pdc
edit nbt not pdc
i use pdc for storing data
and that is nms
Don't use that bloated class lol. I made my own enum with like 3 methods instead of the 30 or so in xmaterial.
Yea, I know.
block.setType(Material.getMaterial(iduri.get(loc)));
block.setData(data.get(loc));
block.getState().update(true);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
that, lists, and loops are what I'm working with so I didn't consider it worth the effort
Yeah I have an exists method in mine instead of valueOf so it returns stone in stead of NPE. But outputs if it's missing. But that's about it.
Meh, cba to update the class since it handles schematics.
Once i rewrite it so it's not shit perhaps I'll just make W.E. a dependency if i can implement it in the same way
I got my own schem system to lol
I'm working off pre-made schems & code, not really an option to make both from scratch
I'm stuck with pre 1.13 schems afaik
Block physics are fucked up in 1.17.1 though so it's hard to keep portals and shit lit. Or sand from falling.
Having problems to get nbt tags shown in a HoverEvent, any idea how to fix it?
hevent = new HoverEvent(HoverEvent.Action.SHOW_ITEM, new Item(item.getType().getKey().getKey(), 1, ItemTag.ofNbt(jsonItem)));
Only the name of the item is shown
Why my enum value null?
Enum
https://paste.md-5.net/ivuyoyofib.cpp
I set the value in onEnable
Checking the value
https://paste.md-5.net/dizikepiqu.cpp
Check their yaw
aight thanks
yeah ik
still getting an error
idk if it's exactly what u sent but it should work
i know iam not supposed to ask about the version 1.17/1.18 here but how can i send Bungee TextComponents to a spigot player, because i dont see any .spigot() method or spigot class in the player class itself. Any Ideas?
ent.setVelocity(ent.getLocation().getYaw(new Vector(3, 3, 3)));
idk how to use vector so how can i throw the player away from hiw direction?
Just reverse the player's deriction and then multiply it
And use that as the velocity
its hurting to say that but could you send me the code so it works?
I'm on my phone but you could multiply the x y and z by -1 to reverse it then you can just use direction#multiply and multiply it by something like 5
kk
Then you can use that vector directly in setVelocity
👍
Bump
are you sure you're setting it in the on enable? and are you sure the instance on where you set it is the same that is used in the command?
Certain on settings it and I set it again using a debug command and it still doesn’t work and I defo set it
well the runtime isn't know to be funny and just randomly change values, there's something that you're doing that you either (accidentally) set it to null or you're using two independent objects
I’m not randomly changing it. I set it on boot, command one a do command two there is no reason why it should not work
Yet it doesn’t work
well if you can share some cohesive piece of code I could tell you what could be wrong
I can’t tho it’s 1am and I’ve decided to go to bed I have explained everything I am doing and sent all the code that has ANYTHING to do with the enum sending more won’t change anything
¯_(ツ)_/¯
I also sent the whole join command class
am I missing something because I don't see that in any of the pastes
Checking the value, this is everything in this class
well that can't be true, because otherwise eventManager would give you an undefined error
Apart from obv and instance of the manager
that is the important part
if you have a new EventManager() in that instance of the code
and the same in the other part
those two instances are distinct from each other
Private Manager manager;
Public joincommand(manager manager) {
This.manager = manager
}
Ignore caps I’m on phone
I mean that looks good, so do the other parts
but depending on how those are stitched together I can still think of ways for it to go wrong
obviously also how it could go right, but I can't tell because that's all that I'm working with
What other parts? That is everything in that class
and how is it used?
Then for the other classes same thing, that is everything related to it in any way
how does the plugin class create these?
Everything else is TOTALLY unrelated in every way
Wdym?
not it's not. if you do this.getCommand("command").setExecutor(new joincommand(new Manager())) it would fail
because new Manager() -> new instance -> definitely different from what you're working with -> does not have status set -> NPE
that's why it matters how you're setting things up
That’s what I did without the this, I think I did have an instance of main tho can’t remember what should I do?
if that is exactly what you're doing, you need to ensure that you don't create multiple Manager instances, instead creating one and passing that one around
Aight so I’ll just define it at the top of the class then right?
Oh you@edited
Yeah
that would be an option
Anything else if that doesn’t work
uuhh the alternative is fixing whatever else is broken for that to not work
Ok I’ll look more into it tomorrow ima go to bed now thanks for the help
public class MeowCommand implements CommandExecutor {
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("Meow")){
Player p = (Player)sender;
if (sender instanceof Player) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"Playing cat meowing sound"));
p.playSound(p.getLocation(), Sound.ENTITY_CAT_BEG_FOR_FOOD, 2F, 1F);
return true;
}
}
return true;
}
}
``` how to fix this? it doesnt send the message and doesnt make the sound
You are casting it to player before the instance check btw
and
is it registered?
are there errors
I feel like we've discussed that exact piece of code before
warning comes from the instance check...
whats the point of checking if sender is instance of player if you are already casting it to a player just above..
also anyway thats not the problem,how do you register the command
Getting back to Spigot development after some time, heard there's now the possibility to have full 24 bit color in chat. That works, but for some reason not in the Tablist. Is it not supported there?
Hmm then im doing it wrong
Maybe it doesn't work because i use Papers new shitty Component API
🤔
Its not that bad
its just different
anyways
It’s actually good
ChatColor supports hex
Yeah it does now
It always have I’m pretty sure
i forget whether it is only md_5 one
Well
or bukkit one too
i put this
and get this
im on 1.16.5
but it works in chat
:thonk
Let me try to not use kyori.adventure
isnt kyori.adventure a paper one?
ye
Especially because ClickEvents etc don't work in the tablist :5head:
Oh surprise it works when i use the "deprecated" function Bukkit has been using for 10 years
build project?
Yes
oh test german tomorrow
Our whole school is making a build project where we build the school in minecraft, and i'm in charge of setting up the server :sadge:
HTL stands for Höhere Technische Bundes- Lehr und Versuchsanstalt
Hope it works, expecting up to 100 players at once
But it's on a flat map with 300 block worldboarder so should be fine
😳
i hope...
pff still haven't figured out what the problem with my gui class is after days
What's the problem
its kinda difficult to explain
the point is i an action for some slots and they wont work because my inventory id is null
i can show the classes maybe that helps
Yeah that would help, since I have no idea what that means
?paste
this is the class i create gui's with
https://paste.md-5.net/tohunupasa.java
this listener for it
https://paste.md-5.net/abawigixud.cs
Okay, and what's not working exactly?
well if you look at the listener action.click executes the action linked to the slot, that works, except when the action is to open a new inventory, then the actions dont work
Oh, try delaying the openInventory
why do the drops mix
code incoming
https://gist.github.com/6688d8e0100d7a72db8a070165da476f why do they combine the drops
like, if i kill a creeper, it can also drop arrows
Something else might be adding it.
wdym by that
Like, another EntityDeathEvent is probably dropping the arrows.
but like
how
if im just killing a creeper
how can the game think im killing a skeleton
It doesn't, that's why it's probably a different method.
I can almost guarantee you, it's not Spigot.
but then
how do i fix it
idk its telling me this thing
but i think it wont fix anything
The killer can be any entity though???
Not according to getKiller()
but that wont fix the problem will it?
You have to use EntityDamageByEntityEvent if you wanna determine any other entity afaik
So if a skeleton kills a creeper it won't return a skeleton?
No probably not
Nope, it'll be null
BROKEN!
As long as they're in different classes it doesn't matter
oh waitttt
Has anyone tried working with the generator-settings property in server.properties in 1.16? It changed in 1.16, now accepts json, but not even the json from an minecraft employee works
before i found out you can just use else if (random == whatever)
i just made an int for every like uh
item
could that be it?
Try escaping : with \
It does that automatically
Does it? 
Yeah, but maybe it only does after trying to load it, i'll try starting 2nd time
Wdym
It does yep
And it still didn't work the second time?
Looks like it's a bug
Very nice
pretty sure i fixed it
https://bugs.mojang.com/browse/MC-182421
Check the replies of that @haughty nexus, someone posted working JSON.
Ah
thank you
let me try that
Oh lmao thats exactly the one i tried
from the mojang employee
What are you putting into your server.properties
I found my issue with ItemStack.deserialize(Map<String, Object>) Unless I am reading this wrong...
If the map has enchants it won't add the itemmeta
if (args.containsKey("enchantments")) {
raw = args.get("enchantments");
if (raw instanceof Map) {
Map<?, ?> map = (Map)raw;
Iterator var9 = map.entrySet().iterator();
while(var9.hasNext()) {
Entry<?, ?> entry = (Entry)var9.next();
Enchantment enchantment = Enchantment.getByName(entry.getKey().toString());
if (enchantment != null && entry.getValue() instanceof Integer) {
result.addUnsafeEnchantment(enchantment, (Integer)entry.getValue());
}
}
}
} else if (args.containsKey("meta")) {
raw = args.get("meta");
if (raw instanceof ItemMeta) {
((ItemMeta)raw).setVersion(version);
result.setItemMeta((ItemMeta)raw);
}
}
one sec
You're reading that right
Welp. Gotta just make my own xD
When i drag the world from singelplayer onto the server, do i need to load the chunks or does the world generator understand it's not a normal flatmap?
Funnily enough it even throws an error when i leave the generator-settings field empty

who tested this and thought "yeah this throws an error in the console but who cares" and released it
:thonk:
Also why can't i use external emotes here
:3Head:
You have to boost to use them
pff
But yeah I have no idea why that setting is so finicky
At that point I wouldn't even trust it
Yeah it throwed that error the first time i started the server and thought i fucked up
didn't know what it meant though
God even the Discord API is more predictable than this
:kekw:
Hello, is this support?
ahahahaha
Ok... so
if (map.containsKey("meta")) {
raw = map.get("meta");
result.setItemMeta((ItemMeta) raw);
}
```Doesn't even work lol
God I was really trying not to have to write my own serialization methods lol
There is no constructor for ItemMeta outside of the ItemFactory
That code is from ItemStack.deserialize(Map<String, Object>) lol
Are tools? (Like a diamond pickaxe) shaped recipes?
Yes
And Diamond shovel?
Yes
You can Craft it in 3 different ways, how does that work
Still shaped, but it's 1 wide so it can be crafted in any column
how does the shears recipe work
I'm a bit confused on how to create scoreboards in plugins, any help?
just watch a tutorial on youtube or something
because if you're asking on how to make it, its a bit hard to tell so might should just use youtube
my brain died trying to read that sentence but ok
sorry lol
what i mean is just go to youtube and search "how to code a scoreboard using spigot" and it will pop up trust me lol
personally dont feel like im learning anything when watching a tutorial, would rather get an idea from other people and then do it myself rather than copying it from a tutorial that wastes my time
FeatherBoard
idk what ur talking about
Team noNamers = board.registerNewTeam("noNamers").setOption(Team.Option.COLLISION_RULE, Team.OptionStatus.NEVER);
The code gives me this error:
its not a builder
Honestly man I’d say don’t do it, it’s not worth the time. Just use placeholder api and feather lard.
Featherboard*
I dont like using api's in my own plugins
Exactly. There's no point seeing how FeatherBoard is stupid lightweight and will accomplish everything you need and more.
Don't try to reinvent the wheel.
how do i make it a builder?
I’m against re making utility plugins unless you absolutely have to
Remaking plugins that actually affect the player experience, that does matter imo
You don;t. you store teh Team you first get, then you set options
you can;t chain
im not remaking a whole utility plugin im just using the base tools that bukkit gives me so i can build a good foundation for my plugin
adding a bunch of apis and libraries will get messy
Hello
I understand what you’re saying, but if you start trying to make your own permissions or worldedit, to me I think that’s really not necessary. And I think the same really applies to any utility plugin that exists. But I get why you want to do that.
how do i check if an arg in a command is equal to a player's name ?
if (args[0] == Bukkit.getOnlinePlayers()) {
}```here's what i tried
which doesn't work
Bukkit.getPlayer(String) != null
It’s a string array, so you’d determine which part of the array you want to check. If args[0].equalsIgnoreCase(name)
But if you want a player instance from args don’t do it like that
oh ?
Player player = Bukkit.getPlayer(args[0]);
yeah but args[0] isn't always a player
Then check if the player is null or not before using it, or just use a try catch if you don’t like null checks
Don't use a try catch over a null check
no it’s not that was an example, it’s however your command is set up. You should use a try catch absolutely if there’s gonna be a lot of null checks
Relying on exceptions when you can avoid them is bad form
And exceptions aren't cheap to throw
That’s not true at all, I generally wrap my entire commands with a try catch through my command api
I never said anything about remaking plugins. Im not building a foundation to the point where im making a whole new plugin
I dunno I’m reading a book called “clean code” and the error handling section says basically the opposite
Unless I’m not understanding it correctly
exceptions are best avoided, if you can, however the performance has greatly improved recently.
You mean now that we aren't stuck in Java 8 purgatory
Should we not use java 8
?
16+
not unless you have to.
did 17 really add anything other than support for different OS
I believe it aded a nice new switch feature
well i code in java 8
when i used 16 i got a compiler error in mu plugin when loading it
because it has to be minecraft 1.17
Or 1.16.5
no
wrong exprimation dude
develop plugins for mc 1.16.5
The latest spigot release for 1.16.5 should support java 16
that was already in 16
it didn't yesterday ^^'
preview. its in release 17
JEP-406 is great
but you should just use Kotlin anyways
shutup
anyways how the hell does this works java if (Player player = Bukkit.getPlayer(args[0]))
I
it doesn't
What
what
i tried what you guys told me
that is an expression, but it is semantically incorrect as that expression does not have a boolean type
No one told you to do that
i'm dumb
i just wanna check if args = onlinePlayerName
if (Bukkit.getServer().getPlayerExact(args[0]) != null))
getPlayerExact or getOnlinePlayer ?
getPlayerExact
may i ask why ?
it matches for the player with that exact name
it's null if the player is not online/not found
declaration: package: org.bukkit, interface: Server
dumb question
What is the difference with getPlayerExact anyway
shouldn't it be reversed
especially since "case insensitive" suggests that it's slightly inexact
¯_(ツ)_/¯
why even have a case sensitive version?
i dont know
To the source
names are case insensitive anyway
just put the case sensitivity responsibility on the API user
there can't be a Ben and ben for eg.
so many unneeded methods
backwards compatiblity
unneeded methods, poor documentation, out-of-datedness
Update losers!
aren't most plugins already broken by updates bc of NMS?
@Override
@Deprecated
public Player getPlayerExact(String name) {
Validate.notNull(name, "Name cannot be null");
EntityPlayer player = playerList.getPlayer(name);
return (player != null) ? player.getBukkitEntity() : null;
}
vs
if they truly cared about backwards compatibility, NMS would have proper mappings
@Override
@Deprecated
public Player getPlayer(final String name) {
Validate.notNull(name, "Name cannot be null");
Player found = getPlayerExact(name);
// Try for an exact match first.
if (found != null) {
return found;
}
String lowerName = name.toLowerCase(java.util.Locale.ENGLISH);
int delta = Integer.MAX_VALUE;
for (Player player : getOnlinePlayers()) {
if (player.getName().toLowerCase(java.util.Locale.ENGLISH).startsWith(lowerName)) {
int curDelta = Math.abs(player.getName().length() - lowerName.length());
if (curDelta < delta) {
found = player;
delta = curDelta;
}
if (curDelta == 0) break;
}
}
return found;
}
what ze fuck
what...
When I saw the code above yer text, this was the reaction of me too.
(also they're both deprecated??)
😕
that just cannot be real
theres no way the dev actually though that was good code
the power of Bukkit/Spigot code!
this is bukkits fault
Yep the api methods are not deprecated
but shouldve been changed
you see why I find the API shit now?
🙃
yeah anyway, ima get back to my math hw, bye
Shouldn't if (args[1] == null) wprk ?
We basically ditched most of the API over at OTG
not looking for a player
that will never be null
just an empty arg
there cannot be an empty arg
check the length of args
if there is not arg
Check args.length
oh like arg.length < 1
yes
yes
yes
Yes
yes
Indexes always start at 0 with java
lua: 🤡
🤣
lua is very 🤡
lua just built different
What is this delta stuff even checking
Ah
ImagineDev
WAIT WAIT WAIT
it might be sorted, but still why
THAT'S A FUCKING STARTSWITH CHECK!?
yes
I guess it makes sense, I do like using essentials /tp
AAAAAAAAAA
Since you can just enter the first few letters
Did maowcraft just died or something...?
Think so
on another topic, how would twitch even leak their entire database
ok now it works but doesn't...
Probably by accessing their database phpmyadmin.
Once ya acces yer phpmyadmin, ya have rights for all yer databases 🤣
like no errors but doesn't work
first Mark lizard internal error, then twitch database leak
i cant wait to see twitch get sued so badly they have to shutdown
nope
😂
moaw
HAHAA! 😄
I applaud you
if (Bukkit.getPlayerExact(args[1]) != null) {
Player p = Bukkit.getPlayerExact(args[1]);
String name = p.getName();
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
SkullMeta phMeta = (SkullMeta) playerHead.getItemMeta();
phMeta.setOwner(name);
phMeta.setDisplayName(ChatColor.GOLD + name);
playerHead.setItemMeta(phMeta);
inv.addItem(playerHead);``` anyone explains ? it has no errors but doesn't add the head to inv
Thank you! 😄
save it as a variable
Looks like it was an internal breach?
Twitch originally had some complaints. And I think one day there was this boycott where streamers wouldn’t stream for a full day. It’s related to pay or something
wdym
Then a hacker really wanted to get revenge
Player player = Bukkit.getPlayerExact(args[1]);
if (player == null) {
sender.sendMessage(ChatColor.DARK_RED + "That player is not online!");
return true;
}
// Code
@trail oriole
how are twitch streamers complaining about pay
they never get dmca'd, they can put 15 ads if they wanted to
Well they were getting DMCA'ed but only for their VOD's
teams are not working i made a team manually with commands, changed the name tag visibilty to never and it still doesnt work pls help
ik that
you can stream it but not save it publically
But now Twitch has a contract with some music company so that might go away soon.
It’s cause of some other smaller streamers or smithing
get popular
I mean, they do work pretty hard
Seems weird that you can stream copyrighted music but not have it saved
No proof you used it 😉
since its not being saved, there's no sufficient evidence
Guess they don't want people using twitch vods to make a playlist
that too probably
I feel like that would be way too much effort to avoid giving the artist's money
woah this is a dev chat not a talk about streamers chat
google: shutdown discord bot for music
google: never show music ads in google search
Stonks
general is ran by vector
The dump also reportedly contains Unity source code for a game called "Vapeworld."
Dank
Anyways I do have a twitch account. I added 2FA to it
...and?
Im watchin TechnoVision teaching me how to create custom items and for the next video im gonna see the custom recipe
No
TechnoVision is like the alpha worst male
kody is alright i watch him the most
Why they do...? .-.
What about Rolix? .-.
Or Pamkutya..? .-.
Because they tell you to copy and paste code without understanding it, and usually it follows very bad conventions, unnecessary code
And a lot of other stuff
Anyone else notice the only youtube videos about coding for spigot is just copied and pasted from spigot threads? Never see any original code in those tut videos.
yep
I wonder if the youtuber I watched 8 years ago is still around
Shame I don't quite remember the name
can someone help me with my issue tho?
I was mentioning non-coders but oky.
If ya'll say so
still doesn't work
if (args[0].equalsIgnoreCase("open")) {
player.openInventory(inv);
}
else if (args[0].equalsIgnoreCase("add")) {
if (args.length < 2) {
sender.sendMessage("§8[§6BingoBook§8] §cIncorrect syntax");
sender.sendMessage("§8[§6BingoBook§8] §fUse /bingobook to see the command list");
return true;
}
Player p = Bukkit.getPlayerExact(args[1]);
if (p != null) {
String name = p.getName();
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
SkullMeta phMeta = (SkullMeta) playerHead.getItemMeta();
phMeta.setOwner(name);
phMeta.setDisplayName(ChatColor.GOLD + name);
playerHead.setItemMeta(phMeta);
inv.addItem(playerHead);
}
else {
sender.sendMessage("§8[§6BingoBook§8] §cPlayer doesn't exist");
}```
sent a huge part of the code
but it's annoying
it won't add the head to the inv
plus i don't know how to make the inv global
Save the inventory into an public variable?
well that isn't really what i need
Don’t make it global though, just pass it to the class needed as a dependency
Then what's the thing u need
global throughout the players, so that if you add a player through /add command, everyone has it in their inv when doing the command to open that inv
Map some inventories ma buddy
Map<UUID,Inventory> or something where the players unique id acts like key
no
and this is confusing ^^
It’s a data structure you’ll have to learn sooner or later, especially in spigot/minecraft context
but can i fix the issue before adding some more advanced java stuff ?
like please explain
i'll dig in mapping right afterward
If scarcely know the basics of Java, then the obvious is to tackle that first
?learnjava these links can get you started
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.
on mapping ?
On anything
Java basics generally
Is bytecode manipulation included?
i kinda have the basics
No
Terrible :p
Then learning the Map structure shouldn’t be too difficult to learn
can you guys just help me with inv.addItem(playerHead); that isn't working ?
i usually learn on my own and ask when it's messed up xD
?paste the full class first and foremost
class naming 101
At least it isn't just Main
Extract the variable to outside the method
Specifically inv
You see, in there you create a new inventory every time
So it won’t stay persistent
On today's lesson, Variable Scope
^
Second, format your code, it helps everyone see what the if and else statements do and so on
It should be a function in your ide if you use one
i use eclipse
ctrl shift f
oh
yeah
that
i mainly wrote my code like this if () { } else { } etc
but someone told me not to
is it better ?
For your level it doesn’t matter
oh xD
But generally we should avoid if else as they do more than one thing
No it’s not about advanced
It’s just that when you learn the very language it’s best if you don’t care about what’s the most optimized solution
Just learn the tools the language gives you
after that you can start looking into speed optimizations, memory optimizations, code readability and so on
But ofc if you know that one solution is worse than another you shouldn’t choose the worse one
When I said formatting
"Extract the variable to outside the method
Specifically inv" how do i do that ? 😅
I didn’t mean what control structures you’re using (if else, try catch, switch etc)
Look into that
It goes over variable scoping
Once you’ve understood that then we’ll continue
ok
ok i got it working a tiny bit more
now it resets on server shut down/restart/reload
which is not what i'm looking for
but it's an advancement
even in the main onEnable()
what do i do 😦
You need to write data to a file or database to have things persist
You've got options and it depends on what you're storing
Could be a simple text file, could be a JSON file, could be a binary file, could be a database, whatever
As long as it's written to disk somewhere
Some are just more practical than others
ItemStack itself is already serializable by Bukkit, so yes absolutely
String name = p.getName();
ItemStack playerHead = new ItemStack(Material.PLAYER_HEAD);
SkullMeta phMeta = (SkullMeta) playerHead.getItemMeta();
phMeta.setOwner(name);
phMeta.setDisplayName(ChatColor.GOLD + name);
playerHead.setItemMeta(phMeta);
inv.addItem(playerHead);```
public Inventory inv = Bukkit.createInventory(null, 54, "§6Bingo Book");
any ideas on how i can store this (and more in the future)
google says through the config file
What are you tryna do
i sent the entire code higher
a command that puts player's head of specific players in an inv
and keep this inventory running forever
like even with server restarts
Am i being annoying ?
i should probably work all this on my own
nah, just wait till someone knows the answer
how can i make it so that i can apply my Unsafe enchant books while also being able to combine safe books
cause i have something that copies enchants
but i need something that adds enchants
Check if it's an unsafe book before you do the copying
Otherwise let the game handle it
You can get the enchantment and its level, yes?
bookmeta.getStoredEnchants(Enchants, level) doesnt work ._.
ah
ItemStack item = p.getInventory().getItem(e.getHand()); can I shrink this down? (Doing it like that to check for both block placements from offhand and main hand)
Can I add icon to existing plugin?
yes, click the edit resource icon link in the sidebar
Thanks I did not notice this option
Loop through the entry set of that map
And check if the value is > the enchants max level
ayo why is World.Environment always returning normal even if i run the command while in nether/end
public String getEnvironmentName(World.Environment e) {
if (e == World.Environment.NORMAL) {
return "Overworld";
} else if (e == World.Environment.NETHER) {
return "Nether";
} else if (e == World.Environment.THE_END) {
return "End";
} else if (e == World.Environment.CUSTOM) {
return e.toString();
} else {
return "Unknown";
}
}
How do u invoke the function
World.Environment env = p.getWorld().getEnvironment();
String worldDimension = getEnvironmentName(env);
that code is inside of a commandExecutor class ^^^
p is a sender which is a player
btw player.getWorld().getEnvironment().toString() gives the same exact result
always NORMAL
What can i use to host a simple api off of my spigot plugin
github & jitpack
github to host the code, jitpack for dependencies
Do you mean like the server running the plugin actually hosts a JSON request API?
Idk what you mean by simple api lol
i meant hosting a REST API actually in the plugin
use spring
Can you hover over the red line so we can see the error
But if i had to guess its that your second argument is a boolean
yeah
what are you trying to do
its a boolean
Thats it?
you're passing a boolean
dont do that
then just do
custom inventory check with a name?
or a custom inventory holder without api implementation
private Inventory inv;
public void createInv() {
inv = Bukkit.createInventory(/* do whatever */);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
if (!inv.equals(e.getInventory()) {
return;
}
// Your code
}
wouldnt that break if multiple people have the inventory open at the same time?
no?
CraftInventory#equals is overriden
well all implementations
viewers do not matter
bro
look up
implement that version
not titles
It probably will but its not a good way to do it
Honestly I've heard of spring but never used it before where would you reccomend me going to to learn about it?
it comes before summer
What parts of the api are okay to access while being in an async task?
||trying to get a request from my database, but well, the whole async issue is causing problems||
There's no definitive list, though generally speaking you can fetch something asynchronously then execute anything with the result synchronously
Or, rather, on the primary thread
Hmm, that means I can query nearby blocks async
I mean with a ChunkSnapshot, in theory you could. Not sure why you'd want to though lol
Looking at nearby blocks for a temperature system
ok boomer.
When the server shuts down all stuff in memory gets erased
That’s why it’s called short term memory sometimes
hmmm then i still want to have a way to prevent that...
Hey guys where is a good discord to get a plugin developer
this maybe
?services
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/
Says I need to have at least 20 posts but I rather not spam the forums
then just spam helping everyone 👌
Wack
🦆
But wait, this isn't the right channel for you to ask that right?
Should be in #general instead.
Oh thanks
thats the small issue I am having
I am not sure how to take the result of the async operation and use it in a sync context
Look into futures
uh
Or just call a sync task from inside the async one
oh, alrighty
would i be able to access the result of my async operations-? if so, how?
Is there a way where I can rotation something.getLocation().getDirection(); by 45 degrees?
what would happen if I were to try and access api related things in an async context?
server crashes or something more major?
That crashes the server? 
mhm
Surprised no one in the line has fixed that
still looking for some assistance here
Math
anything in specific?
not bad pog
Well your dealing with rotation, I dunno man I’m not super math smart, thinking about trying to be though. Probably something to do with sin cos or tangent, maybe sin in your case? I’m not 100% sure
I'm just trying to create a whole new vector
If that doesn't go where I want it to go I'll try it your way, ty!
When you are using asynchronous tasks (CompletableFuture, Future, etc) you have to wrap your head around that the whole task itself also must be asynchronous. The only way for it to be applied to be a synchronous context is for it to be blocking (and wait for the result), but that would make the asynchronous part the first place useless anyways.
This is why futures are great
Mhm
Except people seem to think you are meant to call get on them
confusing, but i'll go read up on the Future thing, thanks!
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (!(sender instanceof Player)) return false;
Player p = (Player) sender;
Location loc = p.getLocation();
World.Environment env = p.getWorld().getEnvironment();
String worldDimension = getEnvironmentName(env);
Long x = Math.round(loc.getX());
Long y = Math.round(loc.getY());
Long z = Math.round(loc.getZ());
p.chat(x + ", " + y + ", " + z + " @ " + worldDimension);
return true;
}
It always returns NORMAL and never returns NETHER or THE_END even if i am in different dimensions
Well what's getEnvironmentName()?
public String getEnvironmentName(World.Environment e) {
if (e == World.Environment.NORMAL) {
return "Overworld";
} else if (e == World.Environment.NETHER) {
return "Nether";
} else if (e == World.Environment.THE_END) {
return "End";
} else if (e == World.Environment.CUSTOM) {
return e.toString();
} else {
return "Unknown";
}
}
there
i tried using my method
and tried using the normal player.getWorld().getEnvironment().toString();
this normal code always returns NORMAL
and my method always returns Overworld which is NORMAL
so somehow in both cases it returns NORMAL
so what are you trying to do
get the environment name
in any dimension
it just doesn't work properly somehow
in overworld it returns normal
nether? normal
end? also normal
trying on enable it is faster to debug maybe then try multiple codes
you dont need to use only 1 code
That’s, strange
wait let's check this https://papermc.io/javadocs/paper/1.16/org/bukkit/World.Environment.html
declaration: package: org.bukkit, interface: World, enum: Environment
yea
nothing sucks, i think it still the same page in spigot api
Not sure what you hope to find with the javadocs
