#help-development
1 messages Β· Page 2250 of 1
i think resources > some crap gamerule
if youre not helping then shut up
I tried helping bro
oh god not another discussion on changing weather in code
not mocking anyone just last time we delved tooooooo far into mc client and server code to see how weather worked
bump
man its so hard to make easily shadeable lib
when your lib uses bukkit api
i bet I can add doWeatherCycle gamerule in 1.8 with some NMS wizardry
Someone knows how to modify the default Day/Night cycle length ? (in my case 1m30s instead of 10m)
why not just use a scheduler to set the weather to the current weather
you could speed up the cycle ticks
idk how
was that a thing in 1.8 already?
urgh
Doing this smoothly is a bit hard. You can try using a scheduler and manually setting the world time
dont remind me. I'm fairly certain my name is older than that shitty movie
setTime in world class would do the trick ?
that movie was fantastic smh
it does
This is probably a very specific issue with your setup.
Your copy method looks fine. Just a bit outdated. Using nio you could do something like this
public static void copyDirectory(String rootSource, String rootDestination) throws IOException {
Files.walk(Paths.get(rootSource)).forEach(source -> {
Path destination = Paths.get(rootDestination, source.toString().substring(rootSource.length()));
try {
Files.copy(source, destination);
} catch (IOException e) {
e.printStackTrace();
}
});
}
PS: Your code is a hit in the face for the java code style
What do you suggest is the best way to create an instance of a party? Best way to register the party inside java code? If someone can give me an example I would appreciate it.
You do the same approach you do with every live data.
Key-Value storage with a dedicated manager class.
Ill give you an example.
Ah alright
Is there any way to chenge the gamemode of the fake player?
Your data class
public class Party {
@Getter
private final UUID partyId = UUID.randomUUID();
private final Set<UUID> participants = new HashSet<>();
public void addMember(UUID memberId) {
this.participants.add(memberId);
}
public void removeMember(UUID memberId) {
this.participants.remove(memberId);
}
public Set<UUID> getMembers() {
return new HashSet<>(participants);
}
}
Your manager class for that data:
public class PartyManager {
private final Map<UUID, Party> partyMap = new HashMap<>();
public Party createParty() {
Party party = new Party();
partyMap.put(party.getPartyId(), party);
return party;
}
public Party getPartyById(UUID partyId) {
return partyMap.get(partyId);
}
public void deleteParty(UUID partyId) {
partyMap.remove(partyId);
}
}
yes, I'm creating a completely new server player / craft player object for fake players on the tab
And I want to set the tablist fake players to spectator
i think there is a method in the EntityPlayrr
that's right, there is a setGamemode() method
but if noticed correctly, the gamemode does not change
Is there any packet for gamemode? (i'm sending player info packet)
hmm, no, it doesn't...
craftPlayer.setGameMode(GameMode.SPECTATOR);and test
[11:55:42 INFO]: SURVIVAL
log code pls
Thank you a lot actually mate!
private @NotNull ServerPlayer createServerPlayer(ServerLevel serverLevel) {
GameProfile gameProfile = new GameProfile(UUID.randomUUID(), "");
gameProfile.getProperties().put("textures", this.DEFAULT_SKIN);
ServerPlayer serverPlayer = new ServerPlayer(this.minecraftServer, serverLevel, gameProfile);
CraftPlayer craftPlayer = new CraftPlayer(((CraftServer) Bukkit.getServer()), serverPlayer);
craftPlayer.playerListName(Component.text(" ")); // 28 spaces
craftPlayer.getHandle().latency = 1000;
craftPlayer.setGameMode(GameMode.SPECTATOR);
System.out.println(craftPlayer.getGameMode());
return craftPlayer.getHandle();
}```
ohh if (this.getHandle().connection == null) return;
so when i open a chest inventory to a bedrock player, there seems to be a chest above the player right not related to spigot
questions made here does not need to be necessary about spigot
as long it is related with programming
ya but its probably an issue with the plugin making cross compability
if i do "@r" in a another multiverse world it sometimes tps another guy in a different multiverse world how fix :(
anyone know how to make a if statement with random inside that make it do the inside with more than 60% chance
well yeah.. @r checks for a random player
@r means random
and the right place is #help-server
Math.random() < 0.6
I have Random random
thanks
@golden turret ok, I solve that gamemode using this π
craftPlayer.getHandle().gameMode.changeGameModeForPlayer(GameType.SPECTATOR);``` works good!
tablist, and when I change my gamemode I keep my sorted position on the tab
unless it has a purpose
still ugly
i believe hypixel skyblock also has a tablist like this
and if they tried to cram that information into a normal one
nah not if its like hypixel skyblock
i dont play on hypixel
it would look so much worse
I think it is a good solution, e.g. for mini-games, where you need to sort the teams in the right places, e.g. for columns
like
I think mcc also have that?
if you need so much informatiobn on the tablist
first of all you probably have a big design issue
secondly, yeah you should go with a tablist like this
guys my plugin doesn't load since I added LunarClientAPI to my pom.xml
I compile a jar with dependencies in it and the LunarClientAPI loads
there is no error but not the "Loaded plugin v1.0" either
any idea ?
If you add a jar to your plugins folder then there are only 2 outcomes:
- The plugin is loaded successfully
- An exception is being thrown
So show us the exception if your plugin is not listed or red when typing /pl
no exception π
Nice. Then the plugin is loaded.
?paste latest.log
is there a way to recognize the real-time voice and then do something with it in spigot
π
Only with client side mods or if the user opens a website in the background
i got it i will use google speech
the plugin name is 'AbadrochAPI' but nothing refers to it
I'm sending a screenshot of the plugins directory
There are no plugins other than via on that server
um, API?
I named it API because I put it on my lobby servers AND mini game servers
You cant just shade the api in. Its a standalone plugin.
<scope>provided</scope>
And add the api jar to your server.
so basically you shaded in the LunarClient API and it took teh place of your plugin
oh okay thanks for the help
@tender shard
^
How do I send player Title using BaseComponent?
Title takes a string not a BaseComponent
ye ikr
thats why im asking
not?
Your question makes no sense
well no clue what does make sense on that but lemme recapitulate
I have BaseComponent ( I need to change the font , therefore its BaseComponent/TextComponent) and I want to display it as Title for the player
ik about that
You can not use a BaseComponent in a Title
not even using NMS?
why would you want to anyways?
Fonts are client side
I have binded texture to Unicode Char
and its inside seperate font I made
therefore I need to set the font so it displays the texture over whole screen
if your font is on the client in a pack you just send the unicode
I have lots of textures binded onto different unicodes
so in order to make it more organized, I have multiple fonts in one resource pack
Client title will use whatever teh client has set as its font
ok but that doesn't help me at all :))
Since I need to adapt the font of title I send to player
as I already told you. The Title uses whatever font is set on the client. you can;t change that in the title
well clearly u can in chat for example
https://jd.papermc.io/waterfall/1.16/net/md_5/bungee/api/Title.html
Found this but its for Paper..
that would have require modification of client ig
probably not
most chat things on teh client translate json
a simple test, try setting the title to "{\"text\":\"test message\",\"color\":\"dark_red\",\"font\":\"minecraft:default\"}"
or whatever font
Im trying rn to send something into chat
but looks like it has size limit
did the title work?
nvm it doesnt
I noticed it like a minute ago..
sooo didn't tried yet
also i dont have any clue how json w/Mc works
I yet don't even know the name of font
I named it icon.json but thats all ik
Hey, does anyone know a free head database api I can use?
internet is a thing
I have 4 worlds: 3 normal worlds (overworld, nether, end) and a world called "lobby". It has all necessary files and even worked until today. From now on, when I try to get the world using Bukkit.getWorld("lobby") and try to teleport there, i get a error location.world
I changed the test to use teh default font so you can test if it even accepts json
litterally just send that text as a title and see if it displays
Can I somehow make anvils apply overleveled enchants? (like sharpness VI)
you could listen to teh https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/PrepareAnvilEvent.html and set the result yourself
?
oh, I didn't know such event exists, thank you!
what error?
and how are you loading this world?
But i haven't found nothing
java.lang.IllegalArgumentException: location.world
What should I do, in order to change player name tag???
nm, I know what your issue is. How are you loading teh world? Additional world have to be loaded before you can access them
CraftPlayer#teleport checks if the world of the location is notnull iirc
Bukkit by default only has teh default 3 worlds. Toi use extra you have to load them
Ok, how?
If it was workgin before you must have been loading it somehow
a plugin or in your code
so Bukkit.loadWorld() or something?
WorldCreator.name("lobby").createWorld();
how to catch an event, if an itemframe breakes? i thought it's EntityDeath, but thats just for living entitys...
ill try that, thanks?
pme?
player move event
not easily
i ask for that x)
due to auto step
Yes..
also stairs
In fact, i just want to disable the jump when player are sprinting
you have to detect an increase in Y and not onGround() is probably the simplest way
Okay i will check that way
if (event.getFrom().getBlockY() < event.getTo().getBlockY() && !event.getPlayer().isOnGround()) {```Probably
nop
somethign close then
player.getVelocity().getY() > 0
i use that code to detect jumps
Y will trigger for going up stairs or autostep
I just try that i will see
Server side??
Velocity is nto applied in Y when going up stairs?
no
oh thats nice then
checking the velocity y is good
yes
but i think it is fired when you do it in mid air too
In that case test velocity and onGround
Nice thanks for all your helps i will check that
So what, you just teleport the player back to the ground when he jumps?
Yes, i case, in real life when somedy run, he didn't jump to go faster
Player player = event.getPlayer();
if (player.getVelocity().getY() > 0 && !player.isOnGround()) {```
remove !
I'm just saying that cause it will feel like if you're glitched. And I'm pretty sure that if you have some ping it won't reduce de speed
Nice !
I will check taht
Stay me up to date please π
Do you by chance know if I can set a level cost for that?
no clue
on AnvilIntentory
i think you can ask to mfnalex himself
ask away
I've done that before π
me too but i was coding at night
edit
sleep for the weak lmao
just put them under the code lol
finally made that stupid stuff from yesterday and i came to the conclusion that it might not be so useful as i thought lmao
how to get the nearest player of a location element?
declaration: package: org.bukkit, interface: World
you forgot the java part
whats even the problem lol
no its fine
how to get the nearest player of a location element?
how can I get a player head by its value or url? I tried with meta.setOwner(); but didn't work
dont know, try debugging the lore
get the first near entity and check if its a player. if not continue
god im finished with that code from yesterday lmao
within a certain distance?
and what does it print?
just the nearest
they could be miles apart
via the GameProfile
what does it look like
uhh
https://paste.md-5.net/yehefewogo.java thats kinda what i want but i can still expand it
setOwningPlayer works fine, so long as you put the meta back on the head
this is cool
me idiot
I tried using a value from minecraft-heads and it didn't work
so not setting an owner
What do you mean
the premium edition spigot
?paste
Three ways to create a textured skull https://paste.md-5.net/igukizudur.java
does it sound good to not save the user data when they quit the server, but instead save the data of all users periodically like every 10 minutes and when the server stops?
i wish java had destructors smh
finalize
finalize is deprecated and will be removed in the future
π€
you mean Object#finalize
π
damnit get it right
Hey, yesterday someone helped me include VanishNoPacket's classes in my plugin. It all worked fine until I tried to compile the plugin, in the game the plugin gives a java.lang.ClassCastException: class org.kitteh.vanish.VanishPlugin cannot be cast to class org.kitteh.vanish.VanishPlugin so I tried to shade it in the jar but that just gives me a package org.kitteh.vanish does not exist error. Would anyone be able to help me with that? I have no idea what could be causing this issue nor why would it be generated, and im able to access the org.kitteh.vanish package in intellij
added the plugin to your plugins folder?
Yep
you dont need to shade it as its a plugin
idk what would i do then
it gives me java.lang.ClassCastException: class org.kitteh.vanish.VanishPlugin cannot be cast to class org.kitteh.vanish.VanishPlugin when its not shaded
you didn;t set it scope provided. it included it in your jar
o/ I has question about how to do something if someone could help? I wanna work out how much someone has earnt in the past x seconds / minutes. How to d oso?
depends on your economy lib
that's when it becomes more fun
i'd just add a runnable
it's custom π₯²
Collection<Entity> entities = location.getWorld().getNearbyEntities(location, 10, 10, 10);
how to loop through this? or if this isn't possible, how to cast to an array?
for loop lol
what if i do it like
tokens = getTokensNow();
schedule delayed task for 60s or so
tokensNow = getTokensNow();
tokensNow - tokens?
learnjava moment
if you only want players use a Predicate
actually mye
private Collection<Entity> getPlayersAround(Location loc, int i) {
return loc.getWorld().getNearbyEntities(loc, i, i, i, entity -> {
return entity.getType() == EntityType.PLAYER;
});
}```
im starting to use mye as conclure does π
Player.class::isAssignableFrom if you want to be fancy
yep
kk, i'll try again
but we are not in a fancy mood today π
mye 
how would I detect what player was right clicked with an item, for example if I were to right click a player with a stone block something would happen
yeah but how do i get the player on my crosshair
Whoa, that was incredible, thanks
alright thank you
Its possible to create a custom multi Consumer for multiple things?
what "things"?
Something like Consumer<Player, Menu, Action>
No reason you can;t pass a class with those references
Because i want to recreate something like this on my menu:
setButton(slot, new MenuButton(itemstack, (event) -> event.getPlayer() or event.getMenu()))
Do i explaine?
I have been told that i need an interface
I'm not clear on what you want
to ahive this:
MenuButton button = new MenuButton(slot, (event) -> );
And them with event be able to get the player, menu, etc
Its better explained now?
No
I have seen that they use a consumer for doing that
how to create clickable text, define an action and react? (if possible not command reaction, but that i can react directly in the script somehow)
Oh lmao i feeling like a noob trying to get help
You can use TextComponent
TextComponent component = new TextComponent("Text here");
component.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ComponentBuilder("Hover message").create()));
component.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/my anwsome command"));
do you have the javadocs?
cause it doesn't finds the class, it's from bukkit, right?
TextComponent its the same for spigot and bungeecord
?jd-b
?jd-bungeer
lmfao
?jd
the struggle is real
struggle?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Who didn't add jd-b as they did jd-s?
ping imagine
Yeah good question
@quaint mantle sorry for ping but can you add the next command to the bot. so its easier to get bungeecord docs
?jd-b
net.md5 one
thy
?jd-bc
π
lol
Is this a way to fill all empty slots in a gui?
?jd-bc
check if the item is null or the type is air
Yeah, what you're doing in that snippet is fine. I'd just check for air as well
I can never remember whether or not some inventory method is nullable
theres no way to react in the script without running a command, right?
so this right?
oh
π
that's right
.isAir
oh there is such a thing
Yep does cave and normal air
Hey, I have following event:
@EventHandler
public void onBlockInteract(PlayerInteractEvent event) {
if (!Main.getChallenge().isRunning() || event.getClickedBlock() == null)
return;
boolean canSeeItem = ((RandomTextureChallenge) Main.getChallenge())
.getTexturePackHandler()
.canSeeItem(event.getPlayer().getUniqueId(), event.getPlayer().getLevel(), event.getClickedBlock().getType().name());
if (!canSeeItem)
event.setCancelled(true);
}
I am trying to intercept any block interactions (open door/trapdoor) that cannot be seen, however this event also intercepts the block placements. Is there an event that does not intercept the placements or another method?
not that you are going to find cave air in an inventory
never used it altho im on the 1.17 api
Sometimes I ignore his messages
Wow
You mean Material#isAir don't you ?
Mojang works in mysterious ways
yes
true
MaterialBlock when
check if the event.getAction is RIGHT_CLICK_BLOCK
Well the enum -> registry PR still has not made it π
smh choco sniped me
My method is a bit better ;p
looks like im outdated
Can throw in that action check if you want though for good measure
thanks
== or .equals for itemstack enums?
primitives π€
String not
its not recommended to use == on enums that implement Keyed
Why?
Spigot's fault cry about it
byte, int, short, long, double, float etc
idc i keep using ==
π
if its an enum threat is as an enum
yea
Threat it
For enums i just use Enum.valueOf()
How is that relevant
thats for different use case
if you want to convert a String to enum I think
"ENUM_VARIANT"
just use Material.matchMaterial(str)
best way of making a int into a string String a = 1973 + ββ;
Enum.valueOf() is for general enums
ik
char to string:
'a' + ""
Bad
itβs 100% best practice wym
π¦
xD
String.valueOf
ew
I can
byte code when
new String(new String(new String(new char[]{'a'})))
primitive generics when
yeah
use void
no shit
but for that they need to remember the types passed in
and they dont want to do that or smth
why?
i always use Integer.toString
thatβs actually the best yk
"" + Integer.toString(197)
Oh shit i always use String.valueOf() to parse int into strings
cool bitwise hack
Is it wrong?
var % 3
is the same as
var & 3
that's a variable name
ahh ok
i was going to say your ip
second version is micro optimised
127.0.0.1
is there a way to get the string name of an world object? (such as minecraft:overworld)
guys, how can i ddos 127.0.0.1?
Oh noo i just remember a friend want to ddos someone and i give his own ip just to troll
And get auto ddos himself
π€ π€ π€
Imagine getting auto ddos
Hahaha
Also we shouldnt be talking about this because is baneable i think
that looks like md5
woah bro
BAN
@mod get
i wanted to say ransom
randomware
lets focus on my question instead of banable stuff xD
Patient
WorldType enums right?
I think its
jap
what
wanna send it with a command
.valueOf()?
?paste
i mean
Send your full code please
if it is a namespace
you can get it by using NamespacedKey#getKey()
aaa
location.getWorld().getName()
also
do you want an itemfram break confirmation?
then why are you using getNearbyEntities?
easier*
Why the heck shity Location doesnt use primitives lmao. Cuz of that shit mongo codec doesnt allow me to save/delete/update a location π
cause of sending msg to ne nearest player..
int var = 4;
int operation = var % 3;
operation would be set to 0
int var = 4;
int operation = var & 3;
operation would be still set to 0 due to how AND bitmasking operation works. But its faster to compute since it computes in binary form
?jd-s
sorry 0
pretty sure it just stores a vector inside
yea
but that's the main point
that it works the same as the modulus operator, my bad.
yeah, what i can do?
Store it yourself lol
Yeah
4 % 3 would not be 0
My own vector object right?
ObjectOutputStream or something
I will use my own vector object
4 % 3 is 1
3 % 3 will be 0
% is for modulo, not normal integer division
not division
1 * 1 is also 1
Never heard about it
yeah
but it works almost the same as modulo operator
what means modulo?
remainder of the division
Oh ok
but like, "almost the same" is useless
yeah
It should be used specfici things
Like if it there its because it has a specific use
not to even talk about negative numbers here π
0^0 is 1
is there a method to get all blocks of one type from an inventory or am I just going to hvae to loop through
loooop
or like .stream
Nothing like an amazing lamda + stream can do!
i am calling this bitwise hack for myself as "exclusive modulo operator"
lmfaoo
Oh yeah im fascinated with Streams and also mixing it with lambda
π
List<UUID> members = Lists.of(uuid-1, uuid-2, uuid-3);
members.stream().filter(Bukkit::getOfflinePlayer).map(OfflinePlayer::getName).collect(Collectors.joining(", "));
Imagine seeing that
filter(Bukkit::getOfflinePlayer) 
Because if uuid is null?
filter takes a predicate
lmao
just use map
someone didnt learn their lesson
how the fuck does that compile
i mean if it works you could
Atleast compiles
uuid-1 mmy yes
there is 0 way that compiled
just as an example!!
Yea no, that shit does not compile
can you use streams to compare with ItemStack#isSimilar? I'm assuming you can but I'm new to this shit doesn't make sense to me
whats wrong with a stringbuiler
unless you have a different bukkit api
that returns a boolean for Bukkit.getOfflinePlayer
this will not compile
claim.getMembers().stream().map(Bukkit::getOfflinePlayer).map(OfflinePlayer::getName).collect(Collectors.toList())
Sorry i writed wrong
does this look about right for what I wanted to do
List<ItemStack> items = Stream.of(this.inventory.getContents())
.filter(e -> e.isSimilar(item))
.collect(Collectors.toList());```
fOr LoOP
tbh when do streams actually make sense isn't there massive overhead
mate you literally sent the wrong code
Yes my bad
Well, gg you wrote compiling java code xD
when you dont give a shit bout performance i guess
The second code i sent was suggested by copilot imagine (full code)
Streams are not that bad
not that
unless you use them in application critical places, they are fine
i cant use them in the nasa launch code or the rocket crashes π
Well
uhm
you can still write pretty application critical code in your plugin
Unless you are working for a global network there yes care
imagine i used to use a static geterr for main class instance instead of DI
I think i have improveed a 20% only because of your recommendations
i used to used
ugh
wait no that will break
also async in async is probably not a good idea
more ugh
what could be the reason of this error? java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "com.schwerthecht.postermaker.Main.getCommand(String)" is null
Didnt registered on pluign.yml (the command)
how fast can you type lmao
ohhh, you have to do this? kk
Yes
Check the plugin.yml docs on spigot
They explain all about registering commands
Good luck man
ik how to do, but i didn't know that i always HAVE TO
If need help we are here
Yes
Or you can either register them from CommandMap which doesnt need to register them via plugin.yml
if you dont want to use a command framework
You have 3 options:
- Registering via plugin.yml and getCommand()
- Using your own system which register them via CommandMap
- Use a command framework (as Fourteen suggested)
Can i ask something?
yes if yu pay for it
i was serius
Oh allright
a promise that that user will be loaded at some time in the future
π³
Yeah i know a bit how works async
there is so much outdated code there smh, lets do a push now
Async wait until the task is done while i can process other tasks*
uh its just off the main thread
mainly what i said?
its just the future impl which makes it wait
how to check if an entity out of getnerbyentitys is an itemframe?
instanceOf
jee, but instanceof what? xD
ItemFrame
doesn't work
That looks hot

instanceof
instanceOf should certainly work
i'll thry this
Bruh
^?
but instanceof what? instanceof ItemFrame doesn't work
Yes it does lol
something else in your code is failing then
?paste
^
^
^
ah found it xD i catch the event and cancel it :/ but thy, i have a solution
Is there a way to disable the movement ai of an entity but keep it so it can still move? Im trying to make like a bat swarm kind of thing as an item you can use to like blind another player but when I try to disable ai the bats spawn, curl up, and are unable to be moved via velocity, heres my code (1.8.8)
public class SwarmEffect extends BukkitRunnable {
public static String MATCHER = "swarm wand";
private static HashMap<Player, List<Entity>> bats = new HashMap<>();
public static void shoot(Player shooter) {
if (!bats.containsKey(shooter)) {
bats.put(shooter, new ArrayList<>());
}
Entity bat = shooter.getWorld().spawnEntity(shooter.getEyeLocation(), EntityType.BAT);
net.minecraft.server.v1_8_R3.Entity nms = ((CraftEntity) bat).getHandle();
NBTTagCompound nbt = new NBTTagCompound();
nms.e(nbt);
nbt.setInt("NoAI", 1);
nms.f(nbt);
bat.setVelocity(Util.calcVelocity(bat, shooter.getEyeLocation().getDirection().multiply(75).toLocation(shooter.getWorld())));
bats.get(shooter).add(bat);
}
@Override
public void run() {
for (Map.Entry entry : bats.entrySet()) {
Player shooter = (Player) entry.getKey();
for (Entity bat : (List<Entity>) entry.getValue()) {
bat.setVelocity(Util.calcVelocity(bat, shooter.getEyeLocation().getDirection().multiply(75).toLocation(shooter.getWorld())));
}
}
}
}
(planning to apply blindness to the entity it hits but the bats dont move lol)
1.8.8 nms. Funny guy.
"Half a decade ago" called. It wants it ancient version back.
how can i get the host of a server by its name in the bungee config.yml?
and the port
what god forbidden dialect of English grammar is that
plus that doesnt help me at all
π
It wasnt supposed to...
Hes telling you to update
A recommendation dont use if + else its better if + return
i mean you couldve just told me that lmfao
Could you elaborate?
he knows java better than you
its just one statement, its fine
Lmao dont bullshit me it was just a recommendation
how to get the host and port with the name "lobby"
But it didnt really have an application here. There is no logical way to implement a safeguard statement anywhere in his code
whats the shortcut to comment code in ij?
ctrl /
/*
for paragraph
*/
// for string
or for blocks ctrl shift /
Just type /* and then press tab
one line -> ctrl /
big pieces -> ctrl shift /
or highlight the code to comment and press ctrl shift /
lemme do it manually lol this shit aint doing anything
RIP lol
does anyone know? π
Give one second
sure
You mean through the configuration api?
Programmatically you would use
ProxyServer#getServers() : Map<String,βServerInfo>
Using bungeecord channel i think you can do it
You would need to send messages through the plugin messaging channel. Probably with a second plugin running on the proxy that
answers a custom message.
it needs to login in any case
Oh ok, so yeah you dont need it
noob
Lmao why people i agressive today
Hes joking
Also why are you blocking the thread?
Why not
cuz the asyncpreloginEvent
it runs already off the main thread
unlike smth like playerloginevent
Blocking the thread doesnt freeze the server?
and i dont want players to be able to join before their data is loaded
It doesnβt block the server thread
Oh ok
It blocks another thread
only blocking the main thread freeezes the server
Is there any way to set a block that doesn't update? I tried to cancel the BlockPhysicsEvent but I can see the update during a tick.
But for you it really sometimes feels like the knowledge version of the wave-particle duality.
(The outcome changes as soon as we look at it)
The "dont update" flag simply means that the block does not trigger physics updates while it is being placed.
Afterwards it can be updated.
so apart from canceling the event there is no other solution ig
Cant answer that because we dont know what you are trying to achieve.
i'm creating custom blocks using noteblock. I'm trying to stop the update of these note blocks
like Origin Realms did
I know the pain...
ahah
there are plugins for that
Use Bungeeguard and/or a firewall to prevent outside connections to your server without the Bungee
Try using either a custom BlockState implementation or use the BlockPhysicsEvent.
Uploads?
- There are plugins to prevent the crash
- Its possible to forbid direct connections with your hosts. (force proxy connection)
hmm, custom blockstate implementation could be a way to achieve that. I'll try to find out more about it, ty ^^
Just dug through nms. Noteblock are not TileBlocks so this might be really hard to do.
if its all on the same machine, all the servers connect via localhost. You can not connect to them except via bungee
I always route my players through south africa and then norway.
This gives everyone aprox. the same ping so nobody can blame it if they lose 
I had a question, I created a test plugin to modify the life of the players, except that instead of modifying their life Max I modified the scale of their life, how can I reset it? So 20 hearts as originally ?
get the attribute max health and set the base value to 20 iirc
wait 20 hearts i guess you mean 10 hearts so 20
ok im outdated for everything i said today
lol
No why doing getType to string?
I would most definitely create a dedicated class for this task.
Then create a Set<Material>
Thats much much faster than using Strings
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
Your problem is that this runnable does one full cycle up to 127 in the first tick and then never enters the while condition because 'i' is 127
exactly
What i was saying
good we figured this out π
Its important you understand the answers
Thats already the answer: Your logic is flawed
π΅βπ«
your logic is flawed. Find the highest block at the very start of the code. then loop until you either find the block or you reach the lowest height of the world.
After your while loop simply reset 'i'
You cant use a lambda here
requires an external value
He has a field
sucks
First of all: Remove the i = 0; before your return.
It does exactly nothing besides decreasing the efficiency of your code.
Remove the "return" as well
Well now that i look at it, it doesnt really matter
a few things you could do, use a Location variable. Currently you clone the player Location 24 times each loop for each player
Show us your timings
This is pretty much all you can do performance wise.
public static int destory() {
return new BukkitRunnable() {
public void run() {
int i = 0;
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
Block block = onlinePlayer.getLocation().getBlock();
while (i < 12) {
Block relative = block.getRelative(0, i, 0);
if (!destories.contains(relative.getType())) {
++i;
continue;
}
BlockData blockData = relative.getBlockData();
relative.setType(Material.AIR);
onlinePlayer.getWorld().spawnFallingBlock(relative.getLocation().add(0.5, 0, 0.5), blockData);
}
}
}
}.runTaskTimer(MovingChannel.getInstance(), 0, 20).getTaskId();
}
How often is this runnable being executed?
I hope destroy is only being run exactly once and then never again?
Because this does not look too heavy.
once every 10 ticks means you could do evenly distributed scheduling.
With 50 players instead of having one fat load every 10 ticks, you could
run schedule 5 players per tick for 10 lighter ticks.
?dis
?dist
@quaint mantle What was the command that links to my workload distribution thread again?
?workload
F
?workloads
?distribution
?workloaddistribution
?workdistro
thx
Bit weird that name
?workdistribution so we dont forget
There is also a github project that contains most of the patterns
Is there a way to open a max level enchanting table without using nms?
Looks like you can listen to the PrepareItemEnchantEvent, get the EnchantmentOffer[] getOffers()
and modify each offer by setting its cost and Enchantment.
But i'm trying to open an enchanting table
Ok, then open an enchanting table
Like. Player#openInventory(Inventory)
hehe
Oh yeah. Just like the ArrayBackedArrayList or UniqueElementHashSet
ok
im not thinking when i say smth
I just was pointing out that the name of ValueSortedTreeSet is a bit redundant because they are already sorted by values.
Ah ok. Makes a bit more sense then
Can you cancel a bukkittask that has ended already?
i guess i could just write the whole treemap again ππ
Like if i runTaskLater 10 sec and then try to cancel it after like 20 sec.
I've been watching this chat the past few days and you all make me want to start developing because of how helpful/friendly you all are π
Nope. I believe that this will throw an exception.
Gotchu.
how would i like push a mob towards the player? i know how i would do this in 2d but idk about 3d
That's alot of uwu
like, idk how to get directions in 3d
vector math ;D
i guess you would get the entity vector, subtract the player's location vector and normalize it. then apply the result to the entity
though im not too well versed in vectors either
i think so yeah
cus that would get the distance between the 2 positions and when normalised
yeah
wait normalise isnt a built in function for vectors?
does anyone know how to use splines?
What is a good way to check if inventories are the same. My issue is with the current way I run events is that It checks if the inventories are equal like so
/**
* checks if two inventories are equal
*
* @param view the inventory view
* @return true if the inventories are equal
*/
public final boolean isEqual(final InventoryView view) {
return view.getTopInventory().equals(this.getInventory());
}``` this works fine for the most part, but when working on my shop I realized I have a template for the confirmation menu and not every player can be fed the same inventory or it will cause issues I was curious what else I could do to check for the inventories in these events.
or a session id
is there an event for when an entity is killed by another entity
Your system is insane 7smile7 wtf
thats the entity that died
thats not a thing
or wait
thats only for a player
does java have something similar to env on node?
can i just use EntityDamageByEntityEvent and check the if entity has 0 health
System#getProperty()?
U can use the entitydeathevent and get the last entitydamagevent
Check if it's entitydamagbyentityevent
U can also just use entitydamagbyentityevent
Oh, sorry, environment variable, not property. https://docs.oracle.com/en/java/javase/12/docs/api/java.base/java/lang/System.html#getenv(java.lang.String)
i feel like this is easier
for (Entity entity : player.getWorld().getNearbyEntities(player.getLocation(), 15, 15, 15)) {
entity.setVelocity(
entity.getLocation().subtract(player.getLocation()).toVector().normalize().multiply(5)
);
}```
what am i doing wrong? it says "x is not finite"
but does the hp represent the amount of health after or before the event?
Which line?
Before
but does it get it from .env file or from system?
Since events that are cqncellable are called before they take place on the server
idk. It gets environment variables
setvelocity
This does include the player itself. And the distance vector to yourself is of lenght 0. Normalizing this vector results in
a mathematical error.
andd how would i go abt fixing it
can't i just check to see if event.getEntity().getHealth() - event.getDamage() is <= 0?
The player is one of the entities in that area maybe so the distance is 0 when doing normalize
Check if the entity is player and skip
alr
Like if it's the player
if (player.equals(entity)) {
continue;
}
Just exclude the player. getNearbyEntities takes a Predicate<Entity> with which you can exclude certain entities.
Or that...
okay, i guess https://github.com/cdimascio/dotenv-java will do the job π
thanks
@lost matrix have you optimized the block finding script btw
if not it's completely fine
Nope. One moment.
alright thanks, i appreciate it a lot π
YOO THIS GOT A TAG
What is the packet for player name tag???
declaration: package: org.bukkit.metadata, interface: Metadatable
What's MetadataValue and how do I set it?
So how do I know that mob is my custom mob?
Oh didn't know that
It looks useful, tysm
are there any good and fast particle apis anyone knows?
like preferably with its own algorithm for circular particles
That's not a hard thing to do yourself
computing circles π
what do you need to compute with a circle
and theres probably someone who did it much faster than m e
pir^2
2pir
uhm thinking of other formulas
You can literally just play around with some plotting app and write it up in code.
