#help-development
1 messages · Page 1364 of 1
if you just read the error for a second, or even googled it, the issue would be obvious
ok md_5 🙏
Caused by: java.lang.UnsupportedClassVersionError: me/zoibox/core/core/Core has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
OMG
not this again
I was having version issues before
I'm running java 11
but
idk
oh yeah
when I tried java 8
it didnt work
Yeah, and apparently your server is running Java 8
it is
or other
lol
Same way you would use your own classes / methods
Either tools like Gradle or Maven, or adding the .jar file to your projects build path
Depends on your IDE too
If the project you're trying to use uses Maven, then you can use that
Hey, how can i set player's uuid when settiing the pendingConnection to onlien mode
is there any nether portal entry event?
PlayerChangedWorldEvent and then check for the world name
public void portal(PlayerPortalEvent e) {
if (e.getTo().getWorld().getEnvironment() == World.Environment.NETHER && !nether) {
e.setCancelled(true);
}
else if (e.getTo().getWorld().getEnvironment() == World.Environment.THE_END && !end) {
e.setCancelled(true);
}
}``` i did something like this
do want to disable the nether and end portals?
yeah
i think there were options in the server properties
Hey Guys can anyone tell me how i can Check if an Inventory is a org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryCustom and not a org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryCustom. I get my Inventory from the InventoryClickEvent with the function event.getClickedInventory()
Omg its 1 ` not 2 of them
those two examples are the same?
Sorry the Second must be a org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryPlayer
How can I remove the cape in an NPC packet because I gave the NPC a name and it then gets a random cape, the skin is created with value and a signature
If I just make a class and implement CommandSender and simply store the result of sendMessage in an ArrayList and then simply do ```java
StringBuilder result = new StringBuilder();
CommandResult cmdResult = new CommandResult();
cmdResult.setOp(true);
Bukkit.dispatchCommand(cmdResult, "say yes hello");
result.append(cmdResult.getResult().get(0));
Why does it say that command sender has no perm?
I know the StringBuilder is useless in this case, feel free to ignore it
why do you want to implement CommandSender?
To get a result of a command.
I don't believe there are any other easy ways
yeah not that i can think of
I'd try set actual perms instead of op
because im not sure if it would be handled as a player or not
I don't think it can have perms by default, it's not a player
oh hm and cmdResult.isOp() return false even after setting it to true o.o
i believe since it's not an instance of a player it can't be opped
I would say go as far as maybe extending Player?
since you're technically just making a spoof player
i have problem with this
there are only 2 methods xD
getPlayer and getFrom
there's no 'getTo'
Hm yeah, it still seems like it has no perm
my only idea is maybe you have to register the commandSender somewhere?
well its gonna totally depend on your implementation of CommandResult
like did you actually make setOp store the boolean

Oh.
do you mean faster way to render them?
you can get the player's world.
no I mean a way where I don't have to set every pixel my self
getPlayer().getLocation() will return player's location after they changed world.
yeah I know but inside the renderer you need to do
canvas.setPixel(1, 1, MapPalette.BLUE);
``` for every pixel
use a for loop...?
nvm
what's about location before player world change?
i need it
getFrom
No because I'm not particularly smart it seems, thank you
it's world.....
ahh, you can't ig.
i thought all you need is the world.
l o c a t i o n
if you're doing it in the nether you can calculate it to a degree
location != world xD
?jd
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerTeleportEvent.html#getCause()
declaration: package: org.bukkit.event.player, class: PlayerTeleportEvent
i've already done checking
now i want to teleport player
on a place where he stood on before teleportation
anyone got a clue how I'd be able to get a generic instance of Class<? extends Enum<?>>
like I need a new Class<? extends Enum<?>() basically
what's default player portal cooldown?
How can i get the block a player is looking at?
Ideally an event, like OnBlockTarget...
Just use a BlockIterator
thanks
Im not sure? In discord or mc?
discord
Hello I got a problem
I try to host a server on my machine
And I did a very basic plugin with spigot in eclipse
But it says something weird in my server
Ok
i can give you the error code
Send the stacktrace
the what
The whole error
[11:50:33] [Server thread/ERROR]: Could not load 'plugins\Tutorial.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: java.lang.UnsupportedClassVersionError: me/geoffrey/Tutorial/Tutorial has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I guess it is because i compiled the wrong version
I used java 13
What Jdk are you using?
and i should have used 8?
i think it is 13
Hmmm
can someone plz help me
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
thx i m going to look into it
ok i found it
I need java SDK 8
public void onlinePlayersGUI(Player player) {
int slot = 1;
InventoryBuilder builder = Inventories.create();
builder.title(CC.GREEN + "Online Players");
builder.rows((int) Math.min(Math.ceil(Bukkit.getOnlinePlayers().size()/9) + 1,6));
for (Player p : Bukkit.getOnlinePlayers()) {
builder.setItem(getSkull(p), slot++);
System.out.println(getSkull(p).getType());
printConsole(CC.RED + p.getName() + slot);
}
Anyone has a link where to download it?
just google it
it opens the inv but no items are in it
i need an oracle account i thinkl
ye
is it free?
Yes
You just gotta sign up
and address
Its a one time thing
they aren't gonna identity fraud yo ass
ikr\
dont use oracle
public void onlinePlayersGUI(Player player) {
int slot = 1;
InventoryBuilder builder = Inventories.create();
builder.title(CC.GREEN + "Online Players");
builder.rows((int) Math.min(Math.ceil(Bukkit.getOnlinePlayers().size()/9) + 1,6));
for (Player p : Bukkit.getOnlinePlayers()) {
builder.setItem(getSkull(p), slot++);
System.out.println(getSkull(p).getType());
printConsole(CC.RED + p.getName() + slot);
}
it opens the inv but no items are in it
and it asks a company name
Im not familiar
with java?
With Inventories
...?
what
thx i found another website to download
how do u not know how to use inventories
im having a look but i am just saying that i have never had to use them, especially not InventoryBuilder
Adopt is dead, use adoptium
Inventory builder is custom coded
Yes
i found a free website to download jdk 8
hence i don't know it
without account
as long as it is not sketch then fine
its very self explanatory
😄
it isn t
Did you download the vanilla OpenJDK by chance?
do i have to install the jdk 8 or do i only need to add it in eclipse?
Does it sysout information?
geo is the adoptopenjdk site down for you
both?
half the websites im trying to use wont work
No, adoptopenjdk will be phased out by adoptium in the near future
odd
will it replace my newest version of java?
bing is down too
its azure
no, it will just be added
ok thx 🙂
then you change it in eclipse
wtf
thought im more of an intellij guy myself
change dns ip to 1.1.1.1?
sure
yes
Then it is probs this line builder.setItem(getSkull(p), slot++);
it is
one mo
but it shouldn't b e
what is the getSkull() Method
private ItemStack getSkull(Player player){
return new ItemBuilder(Material.SKULL_ITEM)
.skull(player.getName())
.amount(2)
.name(CC.GREEN + player.getName())
.lore(CC.GRAY + "Click to teleport to " + player.getName())
.build();
}
for (Player online : Bukkit.getOnlinePlayers()) {
Bukkit.getScheduler().cancelTask(taskID);
online.setPortalCooldown(1);
}
return true;
}
if (args[1].equalsIgnoreCase("off")) {
taskID = Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
@Override
public void run() {
for (Player online : Bukkit.getOnlinePlayers()) {
online.setPortalCooldown(999999);
}
}
}, 1, 20).getTaskId();
Bukkit.getScheduler().runTaskTimer(plugin, new Runnable() {
@Override
public void run() {
for (Player online : Bukkit.getOnlinePlayers()) {
online.setPortalCooldown(999999);
}
}
}, 1, 20);
return true;
}
break;``` any ideas?
i got it done to select java 8
but now i got an error
Syntax error on token "module", interface expected
Does that work?
public void onInvOpen(InventoryOpenEvent event) {
if (event.getInventory() instanceof Container) {
Container container = (Container) event.getInventory();
StringBuilder inventoryString = new StringBuilder();
for (ItemStack item : container.getInventory().getContents()) {
if (isLargeItem(item) || isCrashItem(item)) {
item.setItemMeta(null);
}
inventoryString.append(itemToString(item));
}
if (inventoryString.length() >= 150000) {
event.setCancelled(true);
container.getInventory().clear();
}
}
}```
How do i send message to all bungee players? [By a Spigot Plugin not Bungee]
You need a bungee plugin
We'll not really but please just use a bungee plugin for that
nvm my container thing won't work, does anyone have an idea?
how can I set an armorstand to be vulnerable? I mean, that the armorstand CAN be destroyed? I tried armorstand.setInvulnerable(false); but I get an error in console so idk 🤷♂️
help plz
are u using like api/utils or something?
Why don't you zero-index?
Pretty sure they’re vulnerable by default, what’s the error?
it was to test
Soooo, im trying to get the block that a player is looking at, and at the moment i am doing this:
@EventHandler
public void onMove(PlayerMoveEvent event){
Player player = event.getPlayer();
Block target = null;
Location location = player.getEyeLocation();
BlockIterator blocksToAdd = new BlockIterator(location,0.0,20);
while(blocksToAdd.hasNext()){
Block block = blocksToAdd.next();
if(block.getType() != Material.AIR){
target = block;
break;
}
}}
However there is a bit of a difference between where my crosshair is and where the block will be placed, as well as some lag. Is there a better way to do this?
Player.getTargetBlockExact or something
Just use that
It’ll probably be closer, but yes it may never be 100% accurate
Ok, thanks
How can i get the item name with nms?
Is there an event listener for just the camera move, i realise now that this code
#help-development message
was largely impacted by how much the event was called
and at larger ranges it was due to the event listener not being called enough
hello
hello
I am looking for a tutorial on the spigotAPI
I know java
It is... however it would need to be called a lot more for how i am using it... as i am using the changes to set blocks at maybe ~200 m
yeah, but as an example
quite a few players don't even have it up that high
an extreme example
but uh, decimals
wdym?
Yes, however the event listener is not called every time it changes by 0.1 if yk what i mean, lemme show you
as for making the player look at something, I don't think there's a method for that
then set a timer
your FOV is ass
at long distances the error interval is several blocks compared to close the player
set a timer
quake pro gang 😎
normal gang 😎
wdym by set a timer tho
bukkitrunnable
You won’t get accurate over distance
The event listener isn't called enough to get accurate i think
Floating point isn’t that precise and not everything gets sent to the server
Possibly even the client rounds things to 1/255 of a block or so, I forget
fair enough
hmm, this is kinda a pain
alternatively
if you really wanna be accurate ig you could try to predict where they're gonna look?
uhhhhh
the thing it is accurate, it is just that it doesn't get called enough to update it, if i move around while looking really far it works great
there's a reason it's not called that much
Yes, and i understand why, its just a pain that it is not now 🤣
it's already calling hundreds of events a second (I think?) per player (if they're moving ig)
yeah, its a shame you can't change how much it gets triggered
Do you know of any other event listener that could be used
@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Bukkit.getScheduler().blablabla(() -> {
Bukkit.getPluginManager().callEvent(new PlayerMoveEvent(player));
}, 1); // I think? one tick later
}
@sullen marlin are you happy dad
that is gonna turn bad fast 🤣
Yes. The classic recursive scheduler bomb.
shit go boom
:D
Btw what are you trying to do?
^ it looks cool
I am trying to make a gun for blocks, but atm just working on getting the aiming
o.o
the player move event doesn't get called enough over large distances to be effective
as the rotation delta isn't great enough
however if you move it works fine 😫
cause it calls the event more
Does anyone know a good clean tag api that does not mess with the scoreboard? Spigot version: 1.8.8
Looks expensive... schedule it ^^
Update to 1.16 + use PersistentDataContainer
1.8 is half a decade old and is unsupported for years now.
Or use nms and tinker with the NBTTags of the Player...
my server is a pvp server and these 1.8 pvp combat plugin don't work to revert the comabt
Anyone know how to make a Solid Line with MessageAnnouncer in JSON?
Then your only option is searching in old forum posts...
Use the plugins to allow 1.8 clients on 1.16 servers then?
r u stupid?
a bit
don't be so rude </3
but i try to hide it
ok
m8, please don't come in here asking for help on a 1.8 plugin and then call me stupid
lul ^^
i said i didn't want to use 1.16 cuz #help-development message
I think ViaVersion works by allowing clients which have a newer or equally old version to join.
You can have 1.8 clients on 1.16
yeah but it has a addon
Yeah, there is Viabackwards and ViaRewind for even older clients iirc
1.16 support for 1.8 is ass ngl
👍
thats why i use 1.8.8 server version
1.8 is not supported here
spigot does not give support for legacy versions
Then again: Live with its issues and search in old forum posts for answers. Support for 1.8 was dropped years ago for good reasons.
i would have used 1.16 if it had 1.7 pvp
5-6
Most people who play 1.8 werent even allowed to play minecraft when it came out...
@burnt totem its possible to make a 1.16 server and use viarewind to support 1* clients
1.8.8 was July 2015
😳
no
what do you mean no
pvp will be fucked up
??????????????
Im just assuming that the average 1.8 user is around 11 or 12 or so.
haha
OldCombatMechanics configured correctly makes this not happen?
its ok....
@burnt totem you use a 1.8 client, server is 1.16, pvp wont be fucked up
plugins can't revert combat completely
pretty damn close
fair
that don't work
@lost matrix, so if i make a run task timer every, lets say tick, and it will run whilst they have a stick in their hand that should work then?
im talking bout pvp
what about it doesn’t work
the PVP
what about the pvp isnt working
if it doesn't work then you haven't set it up right
Probably
ok, thanks
it works if i make a custom jar
what?
but that's just dumb
why do you think that people use 1.8 on hypixel, they use that same type of pugin @burnt totem
almost 7
Hypixel runs on 1.8
hypixel is server version 1.8.8 ????????
1.7.10
I thought they ran 1.7 or some shit
i take that back
@young knoll hypixel maintains the server themselves
excactly
your server is not hypixel. your server will never BE hypixel.
do you have a professional team developing your custom server jar?
hypixel is an extreme exception to most statements.
The difference is that they have engineers that are completely fluent with 1.8. you are not
then don't compare to hypixel lol
my minecwaft server wont be as big as hypixel? :c
yes
lmao
i forgot why we even are arguing
1.8 bad
u an idiot
They have a heavily modified version that has nothing to do with what you are using. Also they need to support thousands of concurrent users. Which is not the case for your.
my users want 1.7 pvp
then why don't they allow 1.7 clients?
1.7 pvp?
they dont support the 1.7 profocol anymoe
1.7 pvp is 1.8 pvp
no its not
no it's not
use 1.8 spigot and allow 1.7 clients
who plays on 1.7 lmao wtf
or use 1.16 spigot and add viaversion, viarewind and viabackwards
everyone in the pvp com
i do that on my server cuz 1.8 server version 100x better then 1.7
then
spigotmc just doesn’t give support for 1.8 users, on your own sirson
there is a reason that the 7 and 8 year old versions aren't supported here
doesent mean people still dont use them
sadly
you can't even get a spigot version lower than 1.8.8 legally
with a 5-6 year old spigot build
dmca
yea
how do you cancel a bukkit runnable? is it cancel()
yes
whut
there's a reason we have buildtools
distributing mojangs code isnt allowed
^
do buildtools dowbloads mojangs jar, and applies patches(modifies it)
and tada, spigot
its all done on your machine
no mojang code was distributed
every1 happy
the illegal site you provided distributes mojangs code and allegedly includes rats
except the lazy asses who don't want to run an entire command
yes.
and wait a few minutes
yes it is.
I have to censor it so I don't get automodded
I'm hungry
im eating
does java 11 work for 1.8 spigot?
i got automodded 10 sec ago
nothing
yes
tons of chocolate next to my pc 😍
@crude charm no support for spigot 1.8
sorry we can't tell u 😔
subborb
suburb
:((((((((((((((((((((((((((((((
no
i have always gotten my spigot from an illegal website.... i didn't know before
ok
😿
actually?
they allegedly include rats
FBI OPEN UP
you shame
I doubt that, I know the people who maintain it I think
i think i know them 🙉
a ytber had the link in his description
you think?
lol
yes
so i downloaded from there
I think I know them
anyone know a good packet nametag api?
🤭
you mean this dog shit https://www.spigotmc.org/resources/nametagapi-v-1-0-for-developer-by-crafterjuli.10196/ ?
it's not packet
whats a packetnnametag api
a nametag api thats not using scoreboard
and using packets instead
?
I do not know of any api doing that, and I wonder why you would want that.
ikr
this is the code `package de.nametagapi;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
public class NameTagAPI {
public static void setTag(Player player, String tag, Player toSetFor) {
Scoreboard board = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = board.getTeam(player.getName());
if (team == null)
team = board.registerNewTeam(player.getName());
team.setPrefix(tag);
team.addPlayer((OfflinePlayer)player);
for (Player players : Bukkit.getOnlinePlayers())
players.setScoreboard(board);
}
}
`
which uses bukkit behind the scenes
why hate bukkit? without bukkit spigot wouldn't exist?
what?
huh
LOL
in fact, bukkit is severely outdated
^
yeah
what do you mean it is serverly outdated
Usually when people say Bukkit, they mean the Bukkit API and not CraftBukkit.
how are any of them outdated
bukkit.jar
what
Why does this still block //pos
they both were made in like 2012
and updated
if (!event.getMessage().toLowerCase().contains("//pos") || !event.getMessage().toLowerCase().contains("/worldedit:/pos")) { ```
well actually it isn't outdated, but it's more of a like "don't use it lol"
like spigot exists for a reason
^
send link
i wouldn't say it is outdated -- you still get a jar
for the updated version
but you should still use the spigot jar
i like spigot forks more
that's a different story
*taco fork
then you meamncraftbukkit
Bukkit is included in Spigot.
i use a taco spigot
pls @crude charm
@EventHandler
public void onItemHeld(PlayerItemHeldEvent event){
Player player = event.getPlayer();
int slot = event.getNewSlot();
if(player.getInventory().getItem(slot).getType() == Material.STICK){
this.holdingGun.put(player,true);
new BukkitRunnable() {
@Override
public void run() {
if (holdingGun.get(player) == false) {
cancel();
}else {
Block target = null;
target = player.getTargetBlockExact(200);
if(target == null){return;}
target.setType(Material.GLASS);
}
}
}.runTaskTimer(plugin, 0,1);
}else{
this.holdingGun.put(player,false);
}
}
This is producing a null pointer exception, i am being dumb and cant work out why. it is due to the runnable i reckon
A Map<Player, Boolean> is kind of useless here. You can just use a Set<Player> for this.
There is also no reason to start a new task for each player.
Create a task that runs each tick and only iterates over each user in the Set
oh yeah, true
Whats on line 42 btw
line 42 is if(player.getInventory().getItem(slot).getType() == Material.STICK){
Does that slot contain an item
This may return null player.getInventory().getItem(slot) if no ItemStack is in there
ahhhh, makes sense. thanks
i added this:
if(player.getInventory().getItem(slot).getType() == null){return;}
but i still get the same error?
This would be my take in it:
public class PlayerTask implements Runnable {
private final Consumer<Player> playerConsumer;
private final Set<UUID> targetPlayers;
public PlayerTask(final Consumer<Player> playerConsumer) {
this.playerConsumer = playerConsumer;
this.targetPlayers = new HashSet<>();
}
public void add(final UUID playerID) {
this.targetPlayers.add(playerID);
}
public void remove(final UUID playerID) {
this.targetPlayers.remove(playerID);
}
@Override
public void run() {
final Set<UUID> removalCandidates = new HashSet<>();
for (final UUID playerID : this.targetPlayers) {
final Player player = Bukkit.getPlayer(playerID);
if (player == null) {
removalCandidates.add(playerID);
} else {
this.playerConsumer.accept(player);
}
}
this.targetPlayers.removeAll(removalCandidates);
}
}
With a usage like this:
Bukkit.getScheduler().runTaskTimer(this, new PlayerTask(player -> {
player.sendMessage("Hi");
}), 0L, 20L);
Which sends "Hi" once a second to each user in the runnable.
Yes because you are still calling null.getType()
And calling anything with a null Object results in a NPE
ohhhhh, im stupid....
what is the most useful feature in essentialsX?
/kittycannon
yes best feature everrrrrrr
my staff is griefing my server with /kittycannon
Jitterclick
server will crash lol
Kittycannon dont greif ??
it shoots a cat that is a tnt
I think your staff is just griefing your server normally
no
i mean yes
without damage or explosion
Only sound and particle
Atleast dats what it do for me
for me it griefs
maybe its in the config
or maybe i was thinking about /antioch
I have an issue, i'm trying to block all worldedit commands but not //pos with this:
if(event.getMessage().toLowerCase().startsWith("//") || event.getMessage().toLowerCase().startsWith("/worldedit:/") && !event.getMessage().toLowerCase().startsWith("//pos") && !event.getMessage().toLowerCase().startsWith("/worldedit:/pos")) {
But //pos still doesn't work
wierd
What can i do?
[ERROR]: Could not load 'plugins\BasicCMDs.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `me.zeprix.BasicCMDs.Main'
I don't get what's wrong..
@quaint mantle could you paste the complete class so we can see the rest
Also, you should follow basic package naming conventions
it would be better if you just paste it on m5d paste thing with the event and everything
public void onCommand(PlayerCommandPreprocessEvent event) {```
...
sometimes it doesnt export right try decompile it if is the right plugin .yml
im not 100% sure but i think you dont need the 1. slash at the beginning
so like else if (event.getMessage().toLowerCase().startsWith("//") to else if (event.getMessage().toLowerCase().startsWith("/")
decompiled plugin.yml is good
try with PlayerPickupItemEvent to cancel it
that doesn't even makes sense
it kinda makes sense
excactly
so cancel the event?
If you cancel the click event then the block should not appear in your Inventory. What version are you on.
(And the PlayerPickupItemEvent makes zero sense here)
lies
You need to also listen to the InventoryMoveItemEvent. That is the one that fires when an item is moved between inventories https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/inventory/InventoryMoveItemEvent.html
This code gets the first non-air block in a ray:
Location eyeLocation = player.getEyeLocation();
BlockIterator blocks = new BlockIterator(eyeLocation,0,200);
Block CurrentBlock;
while(blocks.hasNext()){
CurrentBlock = blocks.next();
if(CurrentBlock.getType() != Material.AIR){
target = CurrentBlock;
break;
}
}
I want to get the block b4 it in the BlockIterator, is this possible?
getBlockAt... target.getLocation.clone().add(eyeLocation.getDirection().multiply(-1))
That would get the block from the world
This event is only fired when a Hopper transfers items i believe.
Called when some entity or block (e.g. hopper)
Did it change?
No clue, I've never used it
I was almost certain that only hoppers and hopper minecards fired this ;D
I would assume it would fire for the shift click
You could just use getTargetBlock from Player
it looks like he wants upto a range of 200
not sure target would go that far (5 I think)
it would
public Block getFirstNonAirBlock(Player player) {
return player.getTargetBlockExact(200);
}
however i decided to use a ray cause then i could get the block b4 it in the ray without having to deal with the block sides
oh ok....
one sec then
Bukkit.getOnlinePlayers().forEach(p -> p.hidePlayer(player));
Bukkit.getOnlinePlayers().forEach(p -> p.showPlayer(player));``` what else is required to change their skin? this doesn't seem to update it
getSkin returns a property with value and signature
hide/show will not cause the skin packet to be resent
she was gonna break my heart regardless
which packet is it?
so i too kher out and dumped her in the garbage
teh player has to move away (out of range) then back to trigger its sending
and I believe you have to use packets to have the player themselves see their new skin
it's kind of weird that it doesn't show when reentering the render distance though
there's something else going wrong
I've not done it but it does come up in here from time to time. Most google results are out of date for it.
Would this work?
public Block getBlock(Player player, Block target) {
Location location = target.getLocation().clone().add(player.getEyeLocation().getDirection().multiply(-1));
return player.getWorld().getBlockAt(location.getBlockX(),location.getBlockY(), location.getBlockZ());
}
I actually dont know what this method is supposed to do...
welllllll the idea was building on this
#help-development message
so one block b4 the targeted block
in a ray
Use player.spigot().respawn();
Block block = player.getTargetBlockExact(200);
location loc = block.getLocation().clone().subtract(player.getEyeLocation().getDirection())
return loc.getWorld().getBlockAt(loc);```
that doesn't seem to change it either 🤔
i genuinely don't understand this
Doesn't work....
Also, it doesn't matter if the block is air
public void applySkinTo(final Player player) {
final PlayerProfile profile = player.getPlayerProfile();
profile.removeProperty("textures");
profile.setProperty(new ProfileProperty("textures", this.skin.data.texture.value, this.skin.data.texture.signature));
player.setPlayerProfile(profile);
player.spigot().respawn();
}
You need the base64 value and the signature for that skin.
What doesn;t work? Not very descriptive
Nothing happens 🤣
one sec
lemme print out the coords
there, modified it to always return one block back.
The AIR test would just mean if no block was found in the 200 range
ok
Note that you will need some error checking. The return from getTargetBlockExact is nullable
Yep, i have a null check
Hey how do i stop server by code? Spigot
package index
@lost matrix which library to handle base64?
Oh thank you
ok, so i am looking at:
x:-242,y:71,z:811
i am at
x:-245,y:74,z:811
and it returns
x:-243,y:71,z:810
looks one block back to me
I have used the raw strings from mojang in the property and had it work before
the x & y seems fine just idk what happened to the z
place a block at teh returned location
ok, and thats wrong somehow?
Just get the texture String. Its in base64
Well, it is possible that it is right.... just not really what i wanted. Let me show you
If i am the glass and i am looking at the green wool i would like it to return the red concrete
the only thing im thinking now is that it will then target the red concrete and get closer and closer
it will if it constantly runs
it will always use teh targeted block
not the returned block. so its alwasy dependant upon where teh player is lookiung
yeah..... ugh this is harder than i thought it would be
turns out I forgot to remove the textures property before setting the new one, all is good now
oh you can also simplify this to java location loc = block.getLocation().clone().subtract(player.getEyeLocation().getDirection())
i rlly don't think this is working
I've no idea what I'm looking at
so, i am looking at the leaves
and it has filled the glass based on what
#help-development message
returned
do you mean the glass thats on the tree?
if you look at that glass block and do it again what happens?
looks shifted to teh left
difference between 'discrete' blockpos and 'continuous' location?
should we go back to the BlockIterator?
#help-development message
I feel like if you can just get an index or whatever of the targetted block then you can just -1 and hey presto
You could. Thsi code is my math is wrong subtracting the vector
discrete means certain values (integers), continuous is any number in a range
e.g, you can't have a block at Y=0.5 for example, it's Y=0 or Y=1
I mean, his weird shift to the left could be because of it
ah
because the coordinate of a block are at the bottom left corner, while an entity is at the bottom center
things like that
I would try adding / substracting a 0.5 offset to x & z, and see if it does the trick
ill give it a shot
sec I think I have it
it works better
oke
location loc = block.getLocation().clone().subtract(block.getLocation().toVector().subtract(player.getEyeLocation().toVector()))```Try that. You may have to change the first subtract to an add if it goes forwards instead of backwards.
Hey guys, can someone help me to get that item in hand and circled around the player?
it is worse, the subtract makes it 3 blocks away and add spawns it at my location
add:
check teh code again. I had a mistake
Maybe
Location loc = block.getLocation().clone().subtract(block.getLocation().toVector().subtract(player.getEyeLocation().toVector()))
^ is correct
Yes
then try with the first as add if subtract is wrong
The getLocation was missing
Yep, I updated it after
I'm not speak english lol
Hey guys, can someone help me to get that item in hand and circled around the player?
That should calculate the vector between the player and the target.
public Block getBlock(Player player) {
Block block = player.getTargetBlockExact(200);
if (block == null){return block;}
Location loc = block.getLocation().clone().add(block.getLocation().toVector().subtract(player.getEyeLocation().toVector()));
return loc.getWorld().getBlockAt(loc);
}
so i have this
this good?
looks good
the first will either be add or subtract to move forwards or backwards
Note sure if you need to normalize the vector is all
ok, let me compile
@eternal oxide What does @opal juniper need?
he's trying to get a target block and then return the block in front of it, 1 block towards the player
it also looks like you will have to normalize
subtract still does this ^^
Location loc = block.getLocation().clone().add(block.getLocation().toVector().subtract(player.getEyeLocation().toVector()).normalize());
so do you needs get a block in front of you?
i cant understand sorry
i'm not speak english
i want to help
The block between him and the block he's looking at
Ohh
kinda works
And then?
only kinda?
how would i go abt making the window on the right of the dudes screen here that says "BED WARS"?
much closer
yeah
ok, instead of add or subtract use multiply (now that its normalized)
ok
im assuming im boutta get sent more code?
wait i think i'm understanding
nope
Provided : Vector
Expected : Double
ignore that terrible code
haha
For your guys information:
https://pastebin.com/Amn76UZJ
@quaint mantle @eternal oxide
But.. how would you see the green wool?
because it is not actually there, the glass i send is using packets, more specifically the sendBlockChange
Yes you said it, should.
Anyone here ever made a plugin that can change your skin?
[15:47:40 INFO]: Swift3 issued server command: /skin skeppy
[15:47:40 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'skin' in plugin SkinChanger v1.0-SNAPSHOT
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:146) ~[patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.craftbukkit.v1_8_R3.CraftServer.dispatchCommand(CraftServer.java:666) ~[patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerConnection.handleCommand(PlayerConnection.java:1189) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerConnection.a(PlayerConnection.java:1001) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:45) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PacketPlayInChat.a(PacketPlayInChat.java:1) [patched.jar:git-PaperSpigot-"4c7641d"]
at net.minecraft.server.v1_8_R3.PlayerConnectionUtils$1.run(SourceFile:13) [patched.jar:git-PaperSpigot-"4c7641d"]
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_281]
at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_281]```
this is quite difficult iirc
^
Scoreboards
its just the title
I kinda did make it and it works just the command is returning null for some odd reason
thats with command blocks, can i do it via spigot?
ok
spigot scoreboard api
I think i find the problem
can you show me your fake block code and I'll fire up my IDE to test here
damm
@Override
public void onEnable() {
Bukkit.getPluginManager().registerEvents(this, this);
final Consumer<Player> playerConsumer = pl -> {
final Block block = this.getFirstHitBlock(pl);
if (this.lastHit != block && this.lastHit != null) {
this.sendChange(pl, this.lastHit, Blocks.AIR.getBlockData());
}
if (block != null) {
this.sendChange(pl, block, Blocks.GLASS.getBlockData());
this.lastHit = block;
}
};
this.playerTask = new PlayerTask(playerConsumer);
Bukkit.getScheduler().runTaskTimer(this, () -> Bukkit.getOnlinePlayers().forEach(playerConsumer), 0L, 1L);
}
private void sendChange(final Player player, final Block block, final IBlockData data) {
final BlockPosition position = new BlockPosition(block.getX(), block.getY(), block.getZ());
final PacketPlayOutBlockChange change = new PacketPlayOutBlockChange(position, data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(change);
}
public Block getFirstHitBlock(final Player player) {
final World world = player.getWorld();
final Location start = player.getEyeLocation();
final Vector direction = start.getDirection();
final RayTraceResult result = world.rayTraceBlocks(start, direction, 200);
if (result == null) {
return null;
}
final Block hitBlock = result.getHitBlock();
if (hitBlock == null) {
return null;
}
final BlockFace hitFace = result.getHitBlockFace();
return hitBlock.getRelative(hitFace);
}
@opal juniper I did something similar a few weeks ago:
Player p = event.getPlayer();
// We start by doing a raytrace to find the block the player is looking at
RayTraceResult r = p.rayTraceBlocks(distance);
if (r == null)
return; // no hit
Location l = r.getHitBlock().getLocation();```
And this code is supposed to work. or at least it worked in my plugin
wait @opal juniper uhm
you can just get the player's direction and go from there
oh wait someone else helped already
yes, and i really dont think it is that simple 🤣
ok
And if you want to select the block that is 'in front' of the block you look, just like when you place a block manually ingame, you can do:
Player p = event.getPlayer();
// We start by doing a raytrace to find the block the player is looking at
RayTraceResult r = p.rayTraceBlocks(distance);
if (r == null)
return; // no hit
Location l = r.getHitBlock().getLocation().add(r.getHitBlockFace().getDirection());```
wait there's a built-in api now?
For that? Yeah?
thought that was a lib
But the blocks/entity you want to raycast must exist server side x) You still have do the maths manually if you want to do a raycast on a 'fake, client-side' block, wall or screen.
@lost matrix what is the lastHit thing
And this rayTraceResult can even give you the exact coordinate of the intersection, not only the hitted block. Well, it's neat.
For removing the block from before... idk
is there a way to use " in the send message?
yes
@opal juniper I pasted the 2 previous codes with Player::rayTraceBlocks for you x) I think it should do the trick.
how lol
idk just do it
\" @sharp bough
thanks
wow that is super simple
https://paste.md-5.net/zamahakeyo.js
Just making an Inventory serializer/deserializer but theres issues with ItemStack.deserialize(map) - double being casted to an int
Could anyone help please?
ItemStacks are already serializable
???
player.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION, 30, 255));
This isnt working
Why?
Please help
255 is the amplifier parameter not the duration
I know.
Cant I do it like that?
I want it 30 seconds and the maximum amplifier
World world = Bukkit.getWorld("world");
Location center = new Location(world, 0, 0, 0);
int radius = 16;
int y = world.getHighestBlockYAt(center);
for (double i = 0.0; i < 360.0; i += 0.1) {
double angle = i * Math.PI / 180;
Block block = new Location(center.getWorld(),
(center.getBlockX() + radius * Math.cos(angle)),
y,
(center.getBlockZ() + radius * Math.sin(angle))
).getBlock();
block.setType(Material.WOOL);
block.setData((byte) 14);
}
Ähm
If someone is good in Maths, how can I fill this circle ?
Do you ignore me?
@rigid hazel check if the line is executed
Scanline filling should suffice there, alternatively you could do some BFS filling.
Either way, both algorithms are overkill


That didnt fix it
what did you try
I don't know this : (
Basically you just remember the two furthest blocks from the center (the nearest probably also works) you have placed on a given axis and fill in between, repeat for every point
Try 6 for the amplifier
Yeah you could just start at x, z = radius
Then iterate over all blocks and check if the vector to that block is longer than the radius and simply dont place it in that case.
I did 5. It worked
Also read the bottom line in that picture they sent. “Amplifiers are modulo 32”
A lot of performance can be gained by using the squared length of the radius and just checking it against x + z
So an amplifier of 33 would give you 1
33%32 = 1
If you know what modulo is
If not it just gets the remainder
Modulo is a bit more complicated that that if you work with negative numbers iirc
Can anyone help me why this lane fails?
Title:
- '&cToday's Votes %page%/%maxpage%'
- '&cPlayerName : VoteSite : Time'
Line: '&6%player% : %VoteSite% : %Time%'```
``` in 'string', line 249, column 9:
Title: 'Votes'
^
expected <block end>, but found '-'
in 'string', line 250, column 9:
- '&cToday's Votes %page%/%maxpage%'```
is there a way to edit a vanilla command only when a condition is met? so lets say you use /gamemode creative wich is a vanilla command, but i want to to /gamemode super, but i dont want to remake the gamemode creative, survival, spectator etc
like if it meets the condition then do something otherwise just use the vanilla
you could just do minecract:gamemode
some1 recommend a good command framework other than redlib/ccf/acf
or just provide me some good acf docs
You have ' in your string. Escape it with another '.
Today:
Title:
- "&cToday's Votes %page%/%maxpage%"
- "&cPlayerName : VoteSite : Time"
Line: "&6%player% : %VoteSite% : %Time%"
- The list needs to be indented.
- If you are using
'in your Strings then you cant use the same character as bounds. So in your case"would be more useful because your String escapes right in the middle:Today's
thanks
- The list needs to be indented.
Actually doesn't, was surprised too. As long as there's a -, it'll continue thinking it's a list
Interesting
Lol this is valid yml
Mark McGwire: {hr: 65, avg: 0.278}
Sammy Sosa: {
hr: 63,
avg: 0.288
}
Didnt know you could do that either.
why does intellij recommends to change
getCommand("test").setExecutor(new LocateCommand());
with
Objects.requireNonNull(getCommand("test")).setExecutor(new LocateCommand());
whats the difference?
isint the command already not null?
like if theres a command then its not null
oh because i used
@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args
right?
getCommand is nullable
Test command may not exist in plugin.yml
The second one is fail fast. So it throws an exception before the method is called using a null object. This way your plugin does not crash if you get a NPE in the onEnable.
The getCommand method can return null if there is no command defined in your plugin.yml that matches the given String.
An anvil that falls for 3 blocks and longer destroys any item entity it lands on.
what is the best way to check for this?
those three are the most known? lmao
if u want annotations redlib is out of the question, if you want good builders then cloud
Cloud everyday
cloud is underdocumented
EntityDamageByEntityEvent 👍
ew
Well they’re more or less similar
So yeah I guess that’s a good alternative
Though cloud has some good framework classes for spigot related stuff which brig does not
cloud is fat
no u
If i gotta be honest here, I don't really like the builders cloud provides sometimes because they can get messy if it's too big
They are great tho still
@opal juniper I just noticed your PlayerItemHeldEvent code has a memory leak. Every time a player equips a stick is starts a new repeating task
ah nm, I see you cancel it later
@paper viper iirc they’re immutable which is the only thing I don’t like lol
Ye, if not yea, that would be pretty bad
I was just playing with it to see if it performed better with a single runnable.
ahhh, i see
I mean it shouldn't be to hard to do that, i used hashmaps where i could
?paste
with like for loops
thats what I came up with https://paste.md-5.net/ejubunavof.cs
whats the difference between isBlockPowered vs isBlockIndirectlyPowered?
javadocs are most definitely unhelpful
sooooo, minecraft redstone is weird
if it has a lever/button or something ON it, it is directly powered or BlockPowered
oo ok
so if you wanted to check if a block has some kind of power at all
youd need
isBlockPowered || isBlockIndirectlyPowered
cheers
yep, np
damm this is cool, thanks
how do i change the color of a title?
from what i see it only has parameters for title, subtitle, fadein, stay and fadeout
1::{"slot":1,"itemStack":{"type":280,"amount":1,"durability":0,"meta":{"enchantments":{"Enchantment[19, KNOCKBACK]":1},"repairCost":0,"hideFlag":0,"unhandledTags":{}}}}##2::{"slot":2,"itemStack":{"type":24,"amount":64,"durability":2}}##3::{"slot":3,"itemStack":{"type":270,"amount":1,"durability":0,"meta":{"enchantments":{"Enchantment[32, DIG_SPEED]":1},"repairCost":0,"hideFlag":0,"unhandledTags":{}}}}
I wrote this code to deserialize that ^, but it's giving me a null pointer on line 15 in https://paste.md-5.net/inipozafix.js
Could anyone explain why please, I'm confused haha
Yeah
How do i change the color of the name obove the head
How i put de head of the players on the tab
List<String> players = null; if(Bukkit.getOnlinePlayers().size() > 1) { for (Player p : Bukkit.getOnlinePlayers()) { players.add(p.getName()); } } else { players.add(sender.getName()); } return players;
whats wrong with this?
To de player’s head?
How do I get all the server names from a BungeeCord?
no i am making tabcomplete but its getting nullpointer so
Spanish XD
i dont know spanish bro 😄
Okey thx
if you want to teach me spanish dm is open XD
how do i change the color of a title?
from what i see it only has parameters for title, subtitle, fadein, stay and fadeout
You can;t .add to an uninitialized List.
oh okey thanks
can i use ChatColor in a title?
player.sendTitle(ChatColor.DARK_RED + "~ Title ~", ChatColor.YELLOW + "sub title", -1, -1, -1);
Thanks
just to look pretty
👌


