#help-development
1 messages · Page 1790 of 1
thats inside the if
show ur whole code
put here
i already do that x384
conclure
You return above, so the code is never reached
the second outermost if statement wont ever be reached
this is due to that both branches above ensure code termination within method
How can i declare this outside the if statement and then calling it in the if statement?
i mean
i have to delete return true;?
might wanna do that
outside what if statement adri?
as code runs linearly (usually)
done and same error
player.teleport(new Location(player.getLocation().getWorld(), Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[3]))); throws an error in console
But normally you just do
BukkitTask task0;
outside and then task0 = ... inside the if
send it caye
i want to cancel it in other if statement
?paste
but
but? o.O
the if i call task0 from other statement, it will have the task value?
the entire method
let me send an example
yeah, it will, if you set it
Hey please i need help. I dont why the data stream its not getting opened!!!
You're still returning
where is that second picture at
https://paste.md-5.net/opinigawuf.js @fast onyx
check out that code
remove the second "BukkitTask"
it solves the problem, take notes and learn
it created another problem
but i have to declare it as an int
to use it
cant resolve result symbol
what why
which line caye?
oh
anyone
when return
what does it say?
use scheduleSyncRepeatingTask instead of runTaskTimer
that
that will give u an int id
but
but?
i don't want that
is there a diff?
xD
runTaskTimer().getId()😀
1.8 ☹️
wdym
i mean that you wrote "args[3]" instead of "args[2]"
xD
Also that fork ;/
i see :D
@ember estuarynow i can't cancel the task
you can also save the location in a variable and then use it:
Location whatEverYouWannaNameIt = new Location(player.getLocation().getWorld(), Double.parseDouble(args[0]), Double.parseDouble(args[1]), Double.parseDouble(args[3]));
player.teleport(whatEverYouWannaNameIt);
why not o.O
Bukkit.getScheduler().cancelTask(taskID);
can methods annotated with EventHandler be private/protected?
or would it cause problems
what?
use this
Yes but make them public so paper can optimize them at runtime
oke thanks
kill05 yes but it’ll have to use reflective invocations then
kk ty
and will this work 100%?
Try and see
how can i check if it works? xD
Run it
and btw
make a jar from it, and then put it in plugins folder, and then restart server
public static void setCold(double cold) {
PlayerHeight.cold = cold;
}```
here the setter
```java
task0 = scheduler.scheduleSyncRepeatingTask(plugin, () -> {
setCold(+1);
}, 0, 20 * 10);```
will this add 1 to cold every second?
help? 😦
every second
i see
when i do
@EventHandler
public void onPlayerRightClick(PlayerInteractEvent e) {
Player p = e.getPlayer();
Action a = e.getAction();
Block b = e.getClickedBlock();
this.player = p;
if (a == Action.RIGHT_CLICK_AIR || a == Action.RIGHT_CLICK_BLOCK) {
firstCondense(p);
}
}
``` right clicking the floor runs `firstCondense` twice for some reason, how can i only make it run once. (Right clicking air is fine and only runs it once)
setCold(getCold() + 1)
is the usual approach to that
or make cold public and do cold++
np
Check if you have registered Listener class 2 times
no that cant be it
as it only runs once if I right click air
its just when i right click a block
onRightClick seems good
Im waiting to get my answer....
Can you provide us firstCondense code?
task0 = scheduler.scheduleSyncRepeatingTask(plugin, () -> {
cold++;
}, 0, 20 * 10);```
so this will add 1 cold every second?
Yes
Wait
that doesnt matter
doing this
if (a == Action.RIGHT_CLICK_AIR || a == Action.RIGHT_CLICK_BLOCK) {
System.out.println("Hi");
}
``` has the same problem
If you are using a stream in java you should put the stream#flush()?
It prints Hi message twice?
Only needed with IO and network stuff
i thing you should take the cursor and then check if the cursor is seeing a block or air
wtf
im guessing its seeing both
when u look at block
that's doing as well i guess
that's why is executed twice
you probably got a return somewhere above
how can i stop that @acoustic pendant
np
Depends on your situation
Try print action
Because im having an inssue since 1 or 2 weekends and i cannot resolve it
wdym
System.out.println(a);
oh ye\
can i dm you?
Why not
Oh thats strange
Allright i will post the code on paste md5 and i explain you what inssue im having
when u right click block it just prints
[22:47:00 INFO]: RIGHT_CLICK_BLOCK
[22:47:00 INFO]: RIGHT_CLICK_BLOCK
are item frames entities and can therefore be placed mid-block?
I will debug it tomorrow
I need to sleep rn
is there a equalsIgnoreCase for contains in a list?
i love how I made a packet listener nms class with a packetevent wrapper to listen to get the player loading the chunk and now i don't know how to get data from the packet ;-;
just grab from the var where you made the packet
nope, you gotta loop
or make it all lowercased
Are you using your own packet api?
thanks
kinda
ok lol
I suggest to use ProtocolLib for that
it's just 2-3 classes that inject into the netty channel
do i need to replace "search_value" with anything?
yea, what ur searching
Yes
what am i searching...
Since it's a powerful packet lib for now
is it just like a string var or something for the elements in the list?
yea a string
ah ok
true
Slow but readable
xD
Anyone knows a good YAML parser lib?
But its lack of types is meh
true
it was at this moment in my life i realized i asked a very stupid question
Since spigot's one don't save comments
xD
Snakeyaml and eoyaml
Yes because yaml comments are a fucking pain
But eo yaml actually does respect some comments
Like commented nodes
can anyone help?
ah k
anyMatch(pred -> pred.equalsIgnoreCase(answ+".yml"))
I hope that's what do you want
can anyone hjelp?
i'm trying to play a sound but from 1.8 to 1.9 the sounds has changed so i dont know how to play the same sound on 1.8 server and 1.16 server using 1.13 api version
is possible ig?
yes
how
you gotta use anvilinventory instead of regular inventory
AnvilInventory anvilInventory = (AnvilInventory) Bukkit.createInventory(null, 27);
is that possible?
nop
what's 27
slots
im trying to make a plugin for 2 servers
lobby on 1.8 and survival on 1.16
but the sounds arent the same so..
i guess that doesnt matter in an anvil iventory
anvil has 27 slots?
might wanna play around with it
no
what do you know
first thing on google
meets your exact criteria
not sure how the sounds arent the same
they might be named differently
yea
im running 1.13 api
so if i put ORB_PICKUP on 1.8-1.13 server it works
but if i put entity.experience_orb.pickup or ORB_PICKUP on 1.14-1.17 doesn't
gives an error that the sound doesn't exists
AnvilInventory anvilInventory = (AnvilInventory) Bukkit.createInventory(null, null); player.openInventory(anvilInventory);
doesn't work
no errors but errors in-game & console
?
what are the errors
null, null ?
set the 2nd null to InventoryType.ANVIL
suggest you look at the InventoryType argument
declaration: package: org.bukkit, class: Bukkit
i gotta stop reading that as 1.8
💀
private static final Pattern patternUUID = Pattern.compile("/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/");
if (skull != null) {
SkullMeta skullMeta = (SkullMeta) iM;
if (patternUUID.matcher(skull).matches()) skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(skull)));
else {``` my regex pattern i found on the internet isn't working
it's supposed to check if a string is a player uuid for playerskulls
still errors
when id o this
kk
@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(!(sender instanceof Player)) {
sender.sendMessage("You cannot execute this command in console.");
return true;
}
if(!(sender.hasPermission("anvil.use"))) {
sender.sendMessage(Color.translate("&cYou don't have the required permission to perform this command."));
return true;
}
Player player = (Player) sender;
AnvilInventory anvilInventory = (AnvilInventory) Bukkit.createInventory(null, InventoryType.ANVIL);
player.openInventory(anvilInventory);
return true;
}
}```
a good one
some ppl just want to run a server with good pvp

'some people'
?
pvp is one of if not the biggest server category on mc
idk if theres more than one
ya and theres plugins on latest versions that bring back that pvp
not the same
BackToTheRoots
could someone help me with this if available
if you know decent amount of Java and Minecraft you replicate the pvp pretty much
what does skull equal
are u providing a uuid to string
the players uuid
in a string yeah
the string can either be a uuid or a custom texture
mmm
i found an old stackoverflow post for the regex pattern
doesnt seem to work
i did the debugging too, and it's caused by that condition
u can probably just do UUID.fromString and if it throws an illegalargumentexception then its not a proper uuid string
like a try catch or?
alr
int z = chunkPacket.getClass().getDeclaredField("b").getInt(chunkPacket); is this the right way to get a field?
or do i have to make it accessible first
how can you shove a try catch into a condition
make it accessible
fixed it
by shoving it in 😛
fix: player.openInventory(Bukkit.createInventory(player, InventoryType.ANVIL)); if anyone's interested
:|
can you be a little bit more concrete wally? xD
the other dude said to use a try catch statement to see if uuid.fromstring() or whatever would be a real uuid
UUID uuid = null;
try {
uuid = UUID.fromString(skull); //works
} catch (IllegalArgumentException e) {
//didnt work
}```
oh so the try catch would essentially be my if else
in a way
for(Field field : armorStand.getClass().getDeclaredFields()){
field.setAccessible(true);
}
int x = chunkPacket.getClass().getDeclaredField("a").getInt(chunkPacket);
int z = chunkPacket.getClass().getDeclaredField("b").getInt(chunkPacket);
so something like this?
it is sort of a conditional control structure
seems legit
actually
cache the reflective objects
i don't really like having to do this since it's gonna get called for each chunk loading
is possible?
u'd have to use the same object probably
yeah
so a private static array somewhere
in the class
oh actually i don't need it to be static
nvm
well just to make it a bit faster, idk if it still goes thru security manager and stuff when just getting the field but yeah
private int getInt(String field, Object obj)
{
//no idea what exceptions these throw i forgot
Field f = obj.getClass().getDeclaredField(field);
f.setAccessible(true);
return f.getInt(obj);
}```
ReflectiveOperationException is enough
uh at this point i might as well go full api mode and develop a whole structure for getting fields
can someone help me?
kotli-...
before i compile, is there a better way to get what player loaded a certain chunk
😮
isnt there a chunkloadevent
or smthn
yea but no player
check the server version in an if-else, and then play the corresponding sound?
o
and playermoveevent can detect for walking in a new chunk but doesn't get the exact loaded chunk
u wanna make the plugin work on all versions if i understand right?
btw in this way you are not caching data are you
yep
all the code is working on every version except this that isn't working on +1.13
nop, if you put ORB_PICKUP (example) then it works
if you put that on +1.13 is not working, even if you put: entity.experience_orb.pickup isn't working too on +1.13
im running 1.13 api version that someone recommended me for more stability
ORB_PICKUP
so just lowercase?
uppercase
huh
didnt u just say it doesnt work on 1.13
"if you put that on +1.13 is not working"
if you put that on a server running 1.16 as example, it doesnt work
+1.13
i mean 1.14, 1.15, etc, yea
i see
isnt there a sound enum
yea but if you pur entity.experience_orb.pickup it doesn't work too
that is the name of the sound on 1.14
and not working
no ofc not
it has to be the enum name of it
declaration: package: org.bukkit, enum: Sound
meaning it has to equal the enum nane exactly
uppercase and everything
replace . with _
of the value that the player puts on config
Wish we had a matchSound
the string (from config) must be exactly equal to ENTITY_EXPERIENCE_ORB_PICKUP
Sound.ENTITY_EXPERIENCE_ORB_PICKUP
how do i set the amount of what the player is holding to x
so if i do /more 5 it sets my 1 dirt to 5 dirt
get the itemstack, add 5, set the itemstack
.setAmount on itemStack
kk ty
that wouldn't work on 1.13 or lower, true?
on that version needs to be ORB_PICKUP?
They are mutable, so I don't think you need to set it
oh u can just do that and it updates? alright
I don't think it normally updates?
same but idk
yea
is setAmount on 1.8
weird
all sounds names changed from 1.8 to 1.14?
there isnt any sound with the same name right?
IIRC they changed in 1.13
java.lang.NullPointerException: Cannot invoke "String.toCharArray()" because "text" is null
at me.clip.placeholderapi.replacer.CharsReplacer.apply(CharsReplacer.java:44) ~[PlaceholderAPI-2.10.10.jar:?]
at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:70) ~[PlaceholderAPI-2.10.10.jar:?]
at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:98) ~[PlaceholderAPI-2.10.10.jar:?]
at me.wally.guilds.GUI.ItemBuilder.itemBuilder(ItemBuilder.java:35) ~[Guilds-1.0-SNAPSHOT.jar:?]
at me.wally.guilds.GUI.Menu.Format.menu(Format.java:19) ~[Guilds-1.0-SNAPSHOT.jar:?]
at me.wally.guilds.GUI.Menu.Events.playerRightClickNPC(Events.java:24) ~[Guilds-1.0-SNAPSHOT.jar:?]```
```java
String skull = PlaceholderAPI.setPlaceholders(player, config.getString("SkullOwner"));```
config.getString("SkullOwner") is %player_uuid%
player.getInventory().getItemInHand().getItemMeta().setAmount(5); doesn't work
where is "text"
wdym
player.getInventory().getItemInHand().setAmount(5);
system out println config get string skullowner
[2236 INFO]: [Guilds] [STDOUT] 5737b161-9c71-4095-878e-e41b0f6d8bb0
so it sets the placeholder?
Integer amount = 64;
} else {
Integer amount = Integer.valueOf(args[0]);
}
player.getInventory().getItemInHand().setAmount(amount);```
"amount" on the last line is red (doesn't work)
okay so then its not the like of code u showed
Is String skull = PlaceholderAPI.setPlaceholders(player, config.getString("SkullOwner"));
me.wally.guilds.GUI.Menu.Events.playerRightClickNPC(Events.java:24)?
cuz it only exists inside the ifs
oh
String skull = PlaceholderAPI.setPlaceholders(player, config.getString("SkullOwner"));
System.out.println(skull);
ItemStack i = new ItemStack(material, count);
ItemMeta iM = i.getItemMeta();
iM.setDisplayName(name);
iM.setLore(lore);
i.setItemMeta(iM);
if (skull == null) return i;
SkullMeta skullMeta = (SkullMeta) iM;
try {
skullMeta.setOwningPlayer(Bukkit.getOfflinePlayer(UUID.fromString(skull)));
i.setItemMeta(skullMeta);
} catch (IllegalArgumentException e) {
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", skull));
try {
Field profileField = skullMeta.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(skullMeta, profile);
} catch (IllegalArgumentException | NoSuchFieldException | SecurityException | IllegalAccessException error) {
error.printStackTrace();
}
}```
int amount;
if(args.length == 0) {
amount = 64;
} else {
amount = Integer.valueOf(args[0]);
}
player.getInventory().getItemInHand().setAmount(amount);
Which one is line 24
u talkin to me?
still errors
which
u did it like i did?
yes
show ur code
Integer amount = 64;
} else {
Integer amount = Integer.valueOf(args[0]);
}
player.getInventory().getItemInHand().setAmount(amount);```
u didnt do like i did
u edited ur msg
I don't think Events line 24 is blank
xD
Oh wait I'm reading backwards
it just opens the gui the item is in
at me.wally.guilds.GUI.ItemBuilder.itemBuilder(ItemBuilder.java:35)
35 is
the bottom codeblock
ty @ember estuary
no problem ^^
if(player.getInventory().getItemInHand() == ItemType.AIR) {
AIR is in red
tried Item.AIR
as well
Also you should be checking getType, not the item itself
How could I connect to a internet connection?
do .getType() == Material.AIR
Also Material.isAir
tyty
is it possible to something like this
set var to "" if executor is player, else ""
wdym set var
variable
if (sender instanceof Player)
ye that's what i meant thanks
o
ok
package net.iso2013.mlapi.structure.transactions;
/**
* Created by iso2013 on 6/13/2018.
*/
public abstract class StructureTransaction { }
why
do this
just because yes
why would you use this in the first place
you're not implementing anything
i get it
Take a look at org.bukkit.event.Listener
but that defeats the purpose of the classes
¯_(ツ)_/¯
that's not going to make it easier to do this since you would need to do if statements to check the type
that just seems unnecessary for me
concrete class + strategy 😄
I would rather make a map containing Object as a type
its not as if you're not going to check the type anyways
Does this work for anyone ```
<dependency>
<groupId>io.github.thanosfisherman.wifiutils</groupId>
<artifactId>wifiutils</artifactId>
<version>1.6.6</version>
</dependency>
Has anyone in here created custom worldguard flags before?
I made one that allows certain blocks to be broken in an area, however when i set the eventPriority to HIGHEST and setCanceled(false) it stills cancels the event, do you need to cancel another world guard flag or something?
You need the Repository for that dependency
jitpack 🌞
packjit?
"when it works"
how do u kill a player
i have like... 10 versions that are all for jitpack fixes on my api xD
almost have more releases than commits now
I tried setting up jitpack, I gave up after 9 hours
it really took that long?
For me it pretty much worked right away
my only issue is when i release tags, they arent available from jitpack servers even hours later, so i end up needing to make another release to get jitpack to register it...
oh yeah prolly too complex for jitpack
my gradle setup and jitpack were just arch enemies
I get Cannot resolve io.github.thanosfisherman.wifiutils:wifiutils:1.6.6
jitpack is good with things that are normal, but when it comes to switching compile options good luck
I had to create a file in order to fix mine, and it is a simple maven file too
🥲
the repo you have doesnt match the dependency
well I'm def not doing it wrong
It has a jitpack option it seems
so try doing it that way
1.6.4
I've looked at the jitpack one and it didn't work
1.6.5 is broken along with 1.6.6
try using version 1.6.4 unless those 2 version have something major in them
Cannot resolve com.github.thanosfisherman:wifiutils:1.6.4
also, if its not importing it may be best to clear maven cache, as well as asking the author about it
Don't forget the blood sacrafice
^
No wait that's for gradle
sec
looks like the entire thing is broken
If I may, what’s jitpack?
the notorious repository
nope it doesnt
Could I have multiple EventHandlers in 1 class?
Sure
ofc
can someone help me with this
any answers for this?
Isn't that already a WG feature
suprisingly not
its on the board to be created as a flag
not WIP or anything just on a board
Doesnt show up in game on 1.17
the moment when you listen to all packets, broadcast them and the broadcasting calls a packet:
oh my
"Still working tested on 1.17.1 Survival Server working perfectly!
Hope it gets updates someday"
According to reviews anyway
You can look at their source at least
when the todo list becomes a dont-do list
Yeah might do that
Yeah they have so much stuff on that list 😦
It will probably be 2022-2023 by the time that flags added
even though i could of used it way back in 2015
Burchard maybe pr?
isnt worldguard managed by enginehub
such a sad little dev team they are
spends their days answering support questions in their discord
Idk if WorldGuard has any specific formatting for adding flags to theyre repo, but im only doing the BlockBreaking one since im making a quick regen blocks plugins
oh Could not find artifact com.github.thanosfisherman:wifiutils:jar:WifiUtils1.6.3 in jitpack.io (https://jitpack.io)
hmm I thought you could pr an api addition for custom flags
Does Spigot have a TODO list :p
Mine is just 2 classes, static flag with register in constructor, and then class holding events for the flag
I probably could but if i PR'd what i had now it might make the total code quality go down since it wont match the other flags but i might look into it
i got a problem i'm trying to create Files and folders it works fine on my pc
but then i run it on my hosted server
Its weird that flag doesnt show up on the extra flags plugin
it fails!
How are you creating the files?
hmm yeah, it'd surely have to be done properly
i finally mastered relative teleportation, yay
its dumbfounding though its not added yet
yeah indeed
Like it was just a few lines
However my method is a bit sloppy
Spigot TODO list when
since im relying on the break blocks flags to be allowed when this flags is set
yessir
todo comments lol
Fair
public static void CreateFile(File File_Input) {
CreateFolders(File_Input.getParentFile());
if (!File_Input.exists() && File_Input.getParentFile().exists())
try {
File_Input.createNewFile();
} catch (Exception excep) {
excep.printStackTrace();
}
}
public static void CreateFolders(File File_Input) {
if (!File_Input.getParentFile().exists() && File_Input != null) {
File_Input.getParentFile().mkdirs();
try {
File_Input.getParentFile().createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
}
whenever i have a todo comment it barely lasts 5 minutes
wait if there's a nullpointer or any exceptions on packet communication the player gets kicked? interesting
sir this is java not C#
xD
okay lemme actually read the code
Is 390 TODO too many?
holy cow
wait why is that so complicated
personally nevr reached so many
When you pass the file in the argument
Does it have the JavaPlugin#getDataFolder() as a parent?
Are you like being serious or nah
how do i get the size of players in a world
World.getPlayers.size
thanks
yes
it does run
And it doesnt make any folders or files?
but it creates files and not the folders
File_Input.getParentFile().mkdirs();
try {
File_Input.getParentFile().createNewFile();
Are you trying to make a file out of something you just made a folder?
World world = args[0]; how do i convert this to a world
Bukkit.getWorld
You can look into my createFile method if you need to
thanks
should i removed the Top one?
How can i require the type of a method parameter to be a class extending another class (Menu)?
public void myMethod(<T extends Menu> menu)
doesnt work xD
Just make it be the extending class eg Menu
wait how
static void createFile(Path file) throws IOException {
if (!Files.exists(file)) {
Files.createDirectories(file.getParent());
}
Files.createFile(file);
}
then just
createFile(getDataFolder().toPath().resolve("config.yml"));
or smtng
and then instanceof Menu check when you want the actual class instance
ah
but i dont want the original menu to be able to be inputted, only subclasses that extend it
floskater what are you trying to do?
how do i check if a world exists
[00:27:10 WARN]: java.io.IOException: The specified path was not found
[00:27:10 WARN]: at java.base/java.io.WinNTFileSystem.createFileExclusively(Native Method)
if Bukkit.getWorld(world) == null
showingTo.addAll(Arrays.asList(players)); can you not do something like this? (players is a Player... param)
Is this how you do a text block? """ + networkSSID + """
exactly what i asked for. theres no easier way to describe it xD
I have the method public static void openMenu(Player player, <T extends MapMenu> menu), which you must pass a class, which extends MapMenu
Why not just pass the whole class?
Can't you just addAll an array
Well
nope, needs a collection
convert List to Collection
"<T extends MapMenu> menu" is wrong tho
iirc you can cast or a static Collection method exists to convert
if there's no type token which can strictly conform T then T can be any derived type of MapMenu thus the type parameter is useless
do i have to do bukkit.getOnlinePlayers to send a message to all players in a world
. this what happens then i removed File_Input.getParentFile().mkdirs();
pretty much yeah
okay
whats a typetoken
static <T extends MapMenu> void openMenu(Player p, T menu)
static void openMenu(Player p, MapMenu menu)
1 or 2, they both would accomplish the same
as they have the same erasure
this project for me looks like wannabe great
hm lemme check
no u
Ive done it before so its definatly possible
anyways type tokens can make sure the type is not erased at runtime
i see
Converted a Collection of Chunks to a List of Chunks which was kinda stupid
usually thru anonymous derivations
Collection<Player> collection = Collections.unmodifiableCollection(Arrays.asList(players)); i've found
not sure if it would work
looks fine?
lemme test
Yep thats how it was done
best way
Arrays.asList takes anything iterable/loopable iirc
it takes an array
oke testing time
Caused by: java.lang.IllegalAccessError: class me.kill05.cosmicprcore.utils.animations.PacketArmorStand (in unnamed module @0x23d61f66) cannot access class com.sun.tools.javac.util.List (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module @0x23d61f66 ugh
the line is the one that adds to the list
oh i figured out the worldguard thing
you use WorldGuard events not bukkit events smh
why tf does intellij prefer that over java's list
top ten intellij mysteries developers are yet clueless about
intellij is braindead sometimes
dude i can count on my hand the times the right list was auto imported
I wanna pass SpecialMapMenu.class, not an instance. how do i do that then
dovidas can help you with that as he seems to be writing smtng now
xD
i really love generics you know
irony? xD
I dont think so lol
use Class object
Class<? extends SpecialMapMenu>
iirc
ah
flo if you for instance want to AT COMPILE TIME demand an instance to be conformable to by the type
use
<T extends MapMenu> void lol(Class<T> type, T instance);
works, ty!
public static <T extends MapMenu> void openMenu(Player player, Class<T> menuClass)
MapMenuAPI.openMenu(player, ClaimChunkMapMenu.class);
i hope thats right xD
and then you have some sort of map which maps the class to the instance?
pweese 👉👈
wildcards are runtime checked?
i use reflections
idk
but like the type param at Class is safe to use since yeah
then we got type token
i will try to change my java version!
where essentially
TypeToken<Map<Integer,Collection<Map.Entry<String,Boolean>>>> TOKEN = new TypeToken<Map<Integer,Collection<Map.Entry<String,Boolean>>>>(){};
would keep the nested type
this looks really readable
since its effectively same as
class O extends TypeToken<Map<Integer,Collection<Map.Entry<String,Boolean>>>> {
}
where the type must stay at runtime since the class needs it to define method signatures and such
Dear god why
imagine including this in public api
oh shit
Oh no I have given him ideas
DeluxeAsyncJoinMessage is such a revolutionary plugin
Dev who created it should be hired by mojang studios
lmao, yeah maybe I should make it inject itself into other plugins /s
public final class FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler
extends @NotNull @Nullable @NonNls JavaPlugin implements @NotNull @Nullable @NonNls Listener,
@NotNull @Nullable @NonNls Plugin,
@NotNull @Nullable @NonNls CommandExecutor,
@NotNull @Nullable @NonNls TabCompleter,
@NotNull @Nullable @NonNls Serializable,
@NotNull @Nullable @NonNls ConfigurationSerializable,
@NotNull @Nullable @NonNls Executor,
@NotNull @Nullable @NonNls ExecutorService,
@NotNull @Nullable @NonNls TabExecutor,
@NotNull @Nullable @NonNls BiConsumer<@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler,@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler>,
@NotNull @Nullable @NonNls BiFunction<@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler,@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler,@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler>,
@NotNull @Nullable @NonNls Supplier<@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler>,
@NotNull @Nullable @NonNls Runnable,
@NotNull @Nullable @NonNls Iterable<@NotNull @Nullable @NonNls FinalProUltimateDeluxeAsyncChatJoinMessagePluginImplFactoryAbstractCommonMainProviderBootstrapExecutorHandler>{
😌
It's beautiful really
yuck
So beautiful it almost hits the discord char limit
lol
Imagine parsing annotations of this plugin KEKW
I wonder what it looks like when compiled
can you make fields abstract?
or would i have to use an abstract getter in that case?
yes
Surely the compiler must optimize a lot of the garbage quality code
ok :D
🎵 this🎵 is🎵 why🎵 we🎵 have🎵 encapsulation🎵 polymorphism🎵 inheritance🎵 abstraction🎵
exapsulation polymorphism inheritance abstraction
i would actually like to hear someone make a fluid song with the words encapsulation polymorphism inheritance abstraction
DeluxeAsyncJoinLeaveMessage should use unsafe to change the constant false to true
if you know that term you should be able to get a job a google ngl
Because apparently true and false are just constants in Boolean
whit a cherry on top? 🍒
Does it support 1.2.1?
DUDE
I opened
github repo
of deluxeasyncjoinmessage plugin
and my ungoogled-chromium crashed
The heck is an ungoogled chromium
lmao
Isn’t that just edge
Google chrome without google shit
pure chromium without any trackers and google services
So Firefox
basically yes, but on V8 rendering engine
two cherries? 🍒 🍒
I just made something litty
thats four
ok ima just resend it at this point
java.lang.NullPointerException: Cannot invoke "String.toCharArray()" because "text" is null
at me.clip.placeholderapi.replacer.CharsReplacer.apply(CharsReplacer.java:44) ~[PlaceholderAPI-2.10.10.jar:?]
at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:70) ~[PlaceholderAPI-2.10.10.jar:?]
at me.clip.placeholderapi.PlaceholderAPI.setPlaceholders(PlaceholderAPI.java:98) ~[PlaceholderAPI-2.10.10.jar:?]
at me.wally.guilds.GUI.ItemBuilder.itemBuilder(ItemBuilder.java:35) ~[Guilds-1.0-SNAPSHOT.jar:?]
at me.wally.guilds.GUI.Menu.Format.menu(Format.java:19) ~[Guilds-1.0-SNAPSHOT.jar:?]
at me.wally.guilds.GUI.Menu.Events.playerRightClickNPC(Events.java:24) ~[Guilds-1.0-SNAPSHOT.jar:?]```
```java
String skull = PlaceholderAPI.setPlaceholders(player, config.getString("SkullOwner"));```
at me.wally.guilds.GUI.ItemBuilder.itemBuilder(ItemBuilder.java:35) ~[Guilds-1.0-SNAPSHOT.jar:?]
at me.wally.guilds.GUI.Menu.Format.menu(Format.java:19) ~[Guilds-1.0-SNAPSHOT.jar:?]
at me.wally.guilds.GUI.Menu.Events.playerRightClickNPC(Events.java:24) ~[Guilds-1.0-
actually wally
if you got it on gh, send the gh link
have you tried debugging config.getString("SkullOwner") its nullable and should be marked in yellow on your IDE?
it's able to go through the placeholder things cus i have it logging skull in console afterwards and it shows my uuid
so im not really sure where the error is coming from
send ur itembuilder
show me line of ItemBuilder class - line 35
actually
the second codeblock is line 35
send the entire stacktrace to begin with
@EventHandler
public void playerRightClickNPC(PlayerInteractEntityEvent event) {
if (event.getPlayer().getWorld() != Bukkit.getWorld("ul_plex")) return;
if (event.getHand() != EquipmentSlot.HAND) return;
if (event.getRightClicked().getName().equalsIgnoreCase("npc-guildmaster")) {
new Format().menu(event.getPlayer());
}
}```
can you send use the whole ItemBuilder class
sorry no idea what wrong is here and its 2AM for me so im going to bed
ok :(
gn everyone
gn sleep tight
wally there should be a caused by clause in the stack trace
I think?
this is the stacktrace i think
this is my config file
send Format class
package me.wally.guilds.GUI.Menu;
import me.wally.guilds.GUI.Data;
import me.wally.guilds.GUI.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.Inventory;
public class Format {
ItemBuilder builder = new ItemBuilder();
Data data = new Data();
public void menu(Player player) {
Inventory GUI = Bukkit.createInventory(null, 27, "Guilds");
if (data.getGuild(player).equals("None")) GUI.setItem(12, builder.itemBuilder("Menu_guildUnset", player));
else GUI.setItem(12, builder.itemBuilder("Menu_guildSet", player));
GUI.setItem(14, builder.itemBuilder("Menu_guildInvites", player));
player.openInventory(GUI);
}
}```
can you paste
ItemBuilder
Format
Events
and make sure the lines are correct
format
?paste
format = https://paste.md-5.net/xopobiveri.java
events = https://paste.md-5.net/cavadadavo.cs
itemBuilder = https://paste.md-5.net/wifebugulu.cpp
can you print config.getString("SkullOwner") (ItemBuilder line 35 or smtng)
When you inject a command twice to Bukkit's CommandMap will it get registered twice, or will any command registered after the first identical command is registered just be overwritten?
The scenario is a reload, i call onDisable and onEnable and it registers the Command in onEnable
your stacktrace contradicts your code then lol
yeah idk what its problem is lol
hmm I don't think so
its giving me errors for a line it was able to do
oh I think we'll wait with my definition a bit
hm?
anyways can you print config.getString("SkullOwner") also
there is
Bukkit.getServer().getOnlinePlayers().hasPermission("").size doesn't work
but I don't have the energy to go through it with you today
Tested it: It didnt thank god
oh ok
tomorrow tho
You need to use forEach or for
alr
WE COULD OF HAD IT ALLLL
/* 1 */ public class Core {
/* 2 */ public static void main(String[] args) {
/* 3 */ System.out.println("\"Hello World!\"");
/* 4 */ }
/* 5 */ }
when does the client render an entity?
when the entity is in render distance or is there a fixed distance?
i'm playing an entity spawn packet when a player loads a chunk
and the packet is sent but the entity is not there
Does anyone know what seems to be wrong with my build.gradle file? It seemed to be working perfectly fine but now doesn't recognize the repository.
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
maven { url "https://hub.spigotmc.org/nexus/content/repositories/public/" }
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
implementation 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' // Spigot API
}
test {
useJUnitPlatform()
}```
First of all, compileOnly for the spigot dependency
Not implementation
But yes that should work?
In case something’s not working
Might wanna try invalidate caches
And bump gradle version
How can i force someone extending my class to implement a specific static function?
i cant seem to combine static and abstract
but abstract is the only way i know of to force someone to create a function in the subclass
No because static was never meant to be with inheritance
¯_(ツ)_/¯
does anyone have any reasons that "section" can sometimes be null?
Like a ConfigurationSection?
yeah the variable named section
Might be null due to representation of its absence
is it harmful for the server to pull information directly from the database and not cache it?
but in the first if condition I check to make sure it is existence?
I'm making a house system but I don't know how to do it in cache, so I'd like to pull it directly from the database
Do it in your own thread pool async
and I even check in the YML file to make sure it is there right before this code is ran?
Well usually you just check if the data is in the cache, if not you get the data from the database and put it into the cache
That’s not the issue
Yes, however I don't know how to cache all single player houses.
wait then what is it?
The compiler cannot guarantee that calling the same method twice results in returning the same object twice
From a theoretical point of view: calling the method a second time could give you another config section object
Literally just a ConcurrentHashMap<UUID,PlayerDataClass> or smtng?
Then ofc ensure entries get expired properly
so like what can I do bout it?
Variable
uhh
Can you help me make a base?
I have a cache system to pull information from players, but I can't develop for houses.
No not right now, but caching just means that you store objects somewhere
like this?
private UUID uuid;
private String name;
private Location loc;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Location getLoc() {
return loc;
}
public void setLoc(Location loc) {
this.loc = loc;
}
}```
this is my class for home
I mean
How do I store multiple objects in a hashmap?
I mean... how would you do it?
cause like what if it again just set it to null again?
Well
What do you want if the section is null?
Reassigning it won’t help
As it will presumably be null again
So it will end up in a freeze
It should be giving me a hashmap back, from a yml file
thus crashing the server
what
if it’s not there
no, it is there
if nothing is there nothing should be given back
I thought that the .contains would do that for me
Yeah then don’t do anything?
no no no, the problem that I am talkin' about is that there IS stuff in the YML file, but it is still sometimes null
That’s why need to handle the failure properly
So you can figure out what went wrong
if (section == null) {
// handle absence of section
}
what would you put in that statement for instance?
Hugely depends on what you’re doing
I'm trying to make persistent data
it saves a few different values for a Class var
Ig I just wasn't reloading the config enough
so some changes were not taking effect
can someone please help me with making this less laggy? i need to have a bunch of these methods
when i pass an ItemStack to the constructor of a class and then save it in a variable in that instance (this.itemStack = itemStack),
when i then do thatItemStack.setItemMeta(..) , does it also update it inside the instance?
it should, right?
If it is the same object, it will change the item meta