#help-development
1 messages · Page 1351 of 1
try <ClassName>.class.getClassLoader().getResourceAsStream("file")), that works for me
Ok then
I know when I tried it your way it didn’t work
Ok thanks
I can’t quite tell you why though
Yup, same for me. <ClassName>.class.getResourceAsStream("file") does not work for me though. Still don't understand why.
If you just do .class.getResourceAsStream("thing") it'll try get your/package/location/of/that/class/thing afaik
Not working
I can try
nono that's the reason that won't work
That indeed makes a lot of sense.
From a config
But the config won't be copied to the folder, the folder will be created
root folder/src/java/resources/config.cfg is accessible using this.getClass().getClassLoader().getResourceAsStream("config.cfg");
Or does that not work?
Java IO is shit very true
So you are trying to copy a file?
Yes
Take a look at https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/Files.html. Files#copy might be of use to you. I looked at this Baeldung article: https://www.baeldung.com/java-copy-file
Ok thanks
Is there a problem with sending network data to each individual node like this
plugin.getProxy().getServers().values().forEach(server -> {
server.sendData(CHANNEL, out.toByteArray());
});
The messages arent sent with player
So it directly throws the packets at the server I think
I have a Written Book item stack, how can I hide that thing that says the book is made by etc etc
item.setItemMeta
@ivory sleet fix?? it work?? pls help meh
Oh yeah I’m cloning
You probably need to edit the NBT tag then
at holidays house so takes a bit longer due to slow network
clone dat pu$$y
Im on 1.12.2
$$
what is the overworld world name within spigot, world? overworld? surface? can't remember which one
"world"
Depends
those existed in 1.12
in a string
I dont think so, lemme check
yeah I needed it in string so thx
world
world_the_Nether
world_the_End
You're welcome
NBT was def around in 1.12
java.nio.file.NoSuchFileException: src\test\resources\database.yml
Path copied = Paths.get("src/test/resources/" + configFile.getName());
Files.copy(copied, configFile.toPath());
Here
modifying nbt directly is an option but id recommend just shading this in
Nevermind I'll just put a regular book instead
So, when a player loads into my server they previously had a resource pack on it will load it even though i did not tell the client to load it. is there a way to stop this?
hello, I wanted help, I want to verify my spigot account but I am not receiving the email on my gmail account please help.
Its not in your email
check your messages on spigot.org
^^
no, I verified in discord, I am talking about this
Your email bro
@gmail.con ?
but now I realise I entered my gmail wrong
Yea
how do I change it
In the account settings or something like that
command /mapdone playername should take players name and save in the config and put value 1 in it, it indicates when a builder completes a map, if the player doesnt exist in the config it creates him in there, and puts 1 next to him like this "player:1", however it doesnt seem to work and I do not know why, here is my code
So I'm sending many particles in the world asynchronous and then the server starts lagging extremely with only a few players online
?paste
Does anyone have an idea what can i do agains that?
Increase specs, or optimize your plugins
Apparently not
the problem is not that the server gets slower
the problem is more that the players starts lagging
the tps is well
Yea what I told you, increase specs/optimize plugins
I told you I am trying to optimize my plugin
Go for it then, I cant help you on that one
command /mapdone playername should take players name and save in the config and put value 1 in it, it indicates when a builder completes a map, if the player doesnt exist in the config it creates him in there, and puts 1 next to him like this "player:1", however it doesnt seem to work and I do not know why, here is my code
if the command repeat it adds 1 next to playername like this "player:2"
I want to get 2 informations from all files in one folder. Right now I can specify one file and read the data but how can I do this with all files in the folder (files can be addet or changed by the time so I cant specify them in the code)
thanks, my problem is solved!
How can I get the distance a player has traveled in a tick
Do you mean the distance relative to a certain point or the absolute one?
The distance relative to the position at the start of a tick
Do you want to call that often?
Either distance per tick or distance per second...
For what do you want to track the distance like that?
I just want to get the distance...
if u have a good reason to want the player's exact movement speed every tick, ur better off writing a mod into spigot itself
a plugin would b slow af
Ok this would be one example for stepping through the distance...:
public class DistanceStepper {
private Location lastLocation;
public DistanceStepper(final Location currentLocation) {
this.lastLocation = currentLocation;
}
public double step(final Location nextLocation) {
double distance = this.lastLocation.getWorld() == nextLocation.getWorld() ? this.lastLocation.distance(nextLocation) : 0;
this.lastLocation = nextLocation;
return distance;
}
}
But the performance will be quite bad.
Why do you need the distance? If you give us more insight then we can give you proper alternatives or different approaches.
I am trying to get blocks per second without doing any hard a$$ math
For what reason do you want to get the blocks per second?
I just need to display it to the user on a scoreboard or something
public double getCurrentVelocity(final Player player) {
return player.getVelocity().length();
}
This returns the current "speed" a player is moving with. Its Blocks per tick. So just multiply it by 20 and you have Blocks per second.
Also pretty bad performance
But it should be fine.
Ok just one thing to add is I need to multipy it by the server tps and depending on what we are going to try and travel hundreds of blocks per second so that could go down some...
Do you need accurate measurements for an experiment? Because this might be done differently.
As long as it is within 50 blocks per second of error its fine
what the function for time set ?
World#setTime probably
Why does this give me an empty config?
public void saveDefaultConfig()
{
if(!EindjeMinecraftPlugin.getInstance().getDataFolder().exists())
EindjeMinecraftPlugin.getInstance().getDataFolder().mkdir();
if(!configFile.exists())
{
try
{
configFile.createNewFile();
try(InputStream is = EindjeMinecraftPlugin.getInstance().getResourceAsStream(configFile.getAbsolutePath());
OutputStream os = new FileOutputStream(configFile))
{
ByteStreams.copy(is, os);
}
}
catch(IOException e)
{
e.printStackTrace();
}
}
try
{
this.config = ConfigurationProvider.getProvider(YamlConfiguration.class).load(configFile);
}
catch(IOException e)
{
e.printStackTrace();
}
}```
If you want to save a file from within your plugin you can just call saveResource("someFile.yml", false); from your JavaPlugin instance.
I mean Bungee
Hi I have a problem
guys
do we have any plugin for fake player?
its show on online player like real
?
Probably. But ask in #help-server for that
ok
I'm making a plugin that have multiple commands but it doesn't work and it just show the /<command> in chat
Really struggling on trying to find out how to teleport players to different worlds like the multiverse plugin but without it. Idk if its possible or not
it is
ok]
You need to return true if your command succeeds.
Sure. Just use Player#teleport(Location)
And create a new location that points to the target world
Thanks a lot
Poggers
first do something like that
Location loc1 = new Location(<World name>, X coords, Y coords, Z Coords);
public void tpPlayerToWorld(Player player, String worldName) {
World world = Bukkit.getWorld(worldName);
if (world == null) {
return;
}
player.teleport(world.getSpawnLocation());
}
and then make the command to teleport them there
That helps even more
Does that only work with the nether and end or any world file i put in the server file
any world
All worlds that are currently loaded by the server
Do I have to do anything to load other world files to the server
What
still do nothing just removed the /<command> from chat
Show some code
if (args.length >= 3) {
if (args[1] == "+") {
double sum = Double.parseDouble(args[0]+args[2]);
player.sendMessage(ChatColor.GREEN + "The result is: " + sum);
}
}else {
player.sendMessage(ChatColor.RED + "Wrong Use. type /cal-help");
return true;
}
Dont show me an example pls. Show the command method.
Where is the rest
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args)
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)){ return true; }
Player player = (Player) sender;
// /sign
if (cmd.getName().equalsIgnoreCase("calculate")) {
if (args.length >= 3) {
if (args[1] == "+") {
double sum = Double.parseDouble(args[0]+args[2]);
player.sendMessage(ChatColor.GREEN + "The result is: " + sum);
}
}else {
player.sendMessage(ChatColor.RED + "Wrong Use. type /cal-help");
return true;
}
}
return true;
}
Example solution:
Put a ton of System.out.println() in there and check which one gets fired
Oh you posted the code...
Ok so first:
remove this check: cmd.getName().equalsIgnoreCase("calculate")
It does nothing
ok
It does if you don’t have 1 executor per command
Sure. But i figured by now that nobody does that anyways.
then
Done. if you properly registered your command then you will see at least some message.
still nothing
Show your plugin.yml and the code at which you register the command then
Perfect. Then it works.
So you see "Wrong Use. type /cal-help"
yes
but if i use 3 or more args it show nothing
commands:
calculate:
description: Help you calculate without leaving minecraft
usage: /<command>
aliases: cal
Any exceptions in console when you use 3 or more?
no
Oh i see. You are comparing a String with ==
Thats a no-go
Always use .equals() for Objects
ok
if args[1].equals("+")
Working
i doubt.
Because 9 + 5 is not 95
lmfao
double sum = Double.parseDouble(args[0]) + Double.parseDouble(args[2]);
thx
ik
I was just doing it fast to check if it's working
and then I will fix it
uh
@carmine ivy Less gooooo
Dababy 🥵
Thats not dababy thats my baby
sheesh 💯
does anyone have experience with using teams in scoreboards? apparently to fix that the Citizens NPCs don't have healthbars under their name, i'd need to use teams with the creation of the healthbar
Objective health = score.getObjective("showhealth") == null ? score.registerNewObjective("showhealth", "health") : score.getObjective("showhealth");
if (health.getDisplaySlot() != DisplaySlot.BELOW_NAME)
health.setDisplaySlot(DisplaySlot.BELOW_NAME);
health.setDisplayName(replaceChatColors("&c❤"));
p.setScoreboard(score);```
I managed to do the teleportation
new WorldCreator("testWorld").environment(World.Environment.NORMAL).createWorld();
p.teleport(Bukkit.getWorld("testWorld").getSpawnLocation());
Gonna use a gui to teleport instead of a tab command
is there something like event.getClickedInventory().getTitle()?
Yes. Get the title from the view.
It says Cannot resolve 'getTitle' in 'Inventory'
Yes. Because you need to get the title from the InventoryView and not the Inventory itself.
event.getView.getTitle
Ohh tysm
if anybody knows
Why do chat colours reset on a different line? For example:
p.sendMessage(new TextComponent("§eHey! /* New Line Here */ Goodbye!"))
``` Chat colours would reset after the Hey! so "Goodbye" would be plain.
does anyone know why this is happening?
The warn message is: Invalid plugin configuration: annotationProcessorPaths
don't mix base components and legacy colours
mac good, ugly eclipse theme bad
looks like darkest dark but bad
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@opal juniper
i dont like too
uhuhuh
i bought this mac yesterday and am still migrating my stuff. I haven't installed the theme I like yet
how do you create a new instance of the location class???
new Location(...)?
package index
declaration: package: org.bukkit, class: Location
fixed, just removed it
Can someone help me? My / lobby command doesn't work. There is also no error in the console. The only thing that work is the message
https://paste.gg/p/anonymous/8d1f1fc503344ad6808c8fc3d03d96d5
First you should write both times in one single try catch block.
Then: What is the target server named like?
You also never close the stream
god no
yes
ima de lombok right away
@jade perch
okay creeper
you
I can always add lombok back later
ok thanks
lmao
lol
Here:
public void sendPlayerToBungeeServer(final JavaPlugin source, final Player player, final String servername) {
final ByteArrayDataOutput byteOutput = ByteStreams.newDataOutput();
byteOutput.writeUTF("Connect");
byteOutput.writeUTF(servername);
player.sendPluginMessage(source, "BungeeCord", byteOutput.toByteArray());
}
wdym
Sounds like a healthy decision...
^
can u push delombok
thanks
yeah
tfw you delombok the wrong project
good god oxide dies when I open it
opens every folder
@ivory sleet done
Spigot 1.7.10
[17:17:25] [Server thread/ERROR]: Could not load 'plugins\LZPlMaven.jar' in folder 'plugins'
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
at org.bukkit.plugin.java.JavaPluginLoader.getPluginDescription(JavaPluginLoader.java:188) ~[JavaPluginLoader.class:1.7.10-1614.58]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:133) [SimplePluginManager.class:1.7.10-1614.58]
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.loadPlugins(CraftServer.java:343) [CraftServer.class:1.7.10-1614.58]
at net.minecraft.world.storage.SaveHandler.initBukkitData(SaveHandler.java:462) [ayq.class:?]
at net.minecraft.world.storage.SaveHandler.func_75757_d(SaveHandler.java:138) [ayq.class:?]
at net.minecraft.world.World.<init>(World.java:374) [ahb.class:?]
at net.minecraft.world.WorldServer.<init>(WorldServer.java:162) [mt.class:?]
at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:375) [MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:337) [lt.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:643) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_281]
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
... 11 more
Are you joking?
when detecting if a bed is broken at a certain position, do i check for the upper or lower bed block
Does it matter? You could check for both positions.
update spigot
oh thats true
use a legal version
just was wondering @lost matrix ty
show plugin.yml
still not working ;(((
ooo
Whats your servers name (defined in the BungeeCord config)
does anyone have a list of listeners that spigot has?
i dont changet it byteOutput.writeUTF(servername); ....
Look at the BungeeCord config how you defined each server. And then make sure that the names match 100% with the ones you are using in your code.
okay it still again not working
Show me all the code you are using + the config entry
can i dm you? for the config?
Sure... I just need the small part with the names. You can post that safely here.
okay
https://paste.gg/p/anonymous/5e350615980c429980eef1c4354bd2f8
WurmiNetwork@WurmiLobby: motd: '&1Just another BungeeCord - Forced Host' address: 1** restricted: false
If you want to always round down then just cast to int. It just truncates the number.
So
15.4 -> 15
15.6 -> 15
15.99 -> 15
okay
Your LobbyCommand is just broken... You didnt even implement the CommandExecutor methods
if anybody knows
name: LZPlugin
version: 1.0
description: A Discord Plugin
main: me.zuveno.legendz.mainClass
@cinder thistle this theme is better
iq 100
there ya go
devstyle pog
hehehhee
the only good dark eclipse theme
yep
I liked those random facts on startup
but the gradle support was super ass in eclipse
???
Okay so I'm using generics in this class: DataProcessor<T>
I have this variable: private T value;
I want to check if the value is null/undefined
However, it could be a plethora of types, including a boxed boolean, which doesn't support null iirc
How would I go about this?
would Collections.shuffle(list); fail when some values between it are empty?
like for example if there's no 3. value, but a 4. etc?
matList.addAll(Arrays.asList(Material.values()));
for (int i = 0; i <= matList.size(); i++) {
if (!matList.get(i).isItem())
matList.remove(i);
}
Collections.shuffle(matList);
idk what it does in this case
i mean... it will remove specific entries... when shuffling, would it re-arrange the empty values?
i want it to get smaller in this case, because empty values wouldn't be good
remove them beforehand
yeah, i wonder why i do this crap xd
lol
for(Material mat : Material.values()){
if(mat.isItem())
matList.add(mat);
}
Collections.shuffle(matList);```
tho i can just do this lol
why so compilcated xd
javafor
yeah it was weird
I mean yeah if it's not an item it won't be added
well wait a sec
pretty sure empty values wouldn't be items so I think you're good
I would leave a comment as a reminder tho
package index
i wanna just exclude stuff like wall signs ahhh
i want all stuff in that list that is droppable
because wall signs drop me errors
or potted stuff
droppable as in affected by gravity?
idk, i just want to drop the items, so i can't have wall signs etc in that list
konfuzion
and for obvious reasons i dont want to go throu all materials manually
that's the only thing what it says... idk if it includes blocks
well, i guess i will print out the list values to see
just wondering does anyone here know about custom model data because I am trying to make a texture pack with models and textures and omg I can't do anything lol
It is my first time though
what are you having issues w/
use xmaterial
that page has just about everything that you need to know for custom model data
what is xmaterial
hello can anyone help me, i won't get this bug fixed
show the code
stick.json
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "minecraft:item/stick"
},
"overrides": [
{
"model": "minecraft:item/stick/1000",
"predicate": {
"custom_model_data": 1000
}
},
{
"model": "minecraft:item/stick/1001",
"predicate": {
"custom_model_data": 1001
}
},
... and so on
Then you just need to add the models in the target folder.
For my generated ones it starts with ../assets/minecraft/models/item/stick/1000.json
But there are probably a lot of tutorials for that.
something on line 48 is null
yeah
bruh I never thought to generate the pack
like everything where do I need to place each and every file the .json files for example I have a model but i also need a diamond_sword.json outseide
1 sec
that sounds sooo useful
imma send it
now I feel like an idiot
added it to plugin.yml?
did you register /timer in plugin.yml
yes
interesting
remember where this was added lol. wondered WHY DOES MY PLUGIN IS NULL?ß ßß?ß?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lmao yeah
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
we need your plugin.yml
name: challenge
author: Nickssoo
version: 1.0
main: de.nickssoo.test.main.Main
commands:
antiheal:
timer:
^
im so lost thx man thx
author: Nickssoo
version: 1.0
main: de.nickssoo.test.main.Main
commands:
antiheal:
timer:```
yeah sure
{ "parent": "minecraft:item/handheld", "textures": { "layer0": "minecraft:item/diamond_sword" }, "overrides": [ { "model": "minecraft:item/diamond_sword/1", "predicate": { "custom_model_data": 1 } }, { "model": "minecraft:item/diamond_sword/2", "predicate": { "custom_model_data": 2 } },
```json
stuff
```
lol
use it
well
System.out.println("" + Randomizer.matList.get(i));
}```
let's enjoy console lmao
lol
I can just access my custom items from my Model enum that looks like this:
then we'll see what it includes
ItemStack dwarfCanon = new ItemBuilder(Model.DWARF_CANON.getItem())
.name("§eDwarven Canon")
.lore("")
.lore("Some Infos")
.build();
oh my god.
I can also just upload skins to my resource pack and can use them ingame
that looks so useful
open source it or else
it's not hard to recreate but that's work
half the point of open source is to be less work for everybody
let me have a look 😄
Ill think about it 😛
But there are some dependencies on external websites (for example i get my base mc resources from InventiveTalents website)
if you have the code or a website on it, like I can have hh: mm: ss on my timer at the bottom of the scoreboard, hours: minutes: seconds
ah
huh
what ?
that sentence makes no sense
why i want to set the scoreboard so that it shows my hours, minutes and seconds
and I need help with that
what have you tried
java.lang.IndexOutOfBoundsException: Index 976 out of bounds for length 976
what?
where's the logic
public String shortInteger(int duration) {
String string = "";
int hours = 0;
int minutes = 0;
int seconds = 0;
if (duration / 60 / 60 / 24 >= 1) {
duration -= duration / 60 / 60 / 24 * 60 * 60 * 24;
}
if (duration / 60 / 60 >= 1) {
hours = duration / 60 / 60;
duration -= duration / 60 / 60 * 60 * 60;
}
if (duration / 60 >= 1) {
minutes = duration / 60;
duration -= duration / 60 * 60;
}
if (duration >= 1)
seconds = duration;
if (hours <= 9) {
string = String.valueOf(string) + "0" + hours + ":";
} else {
string = String.valueOf(string) + hours + ":";
}
if (minutes <= 9) {
string = String.valueOf(string) + "0" + minutes + ":";
} else {
string = String.valueOf(string) + minutes + ":";
}
if (seconds <= 9) {
string = String.valueOf(string) + "0" + seconds;
} else {
string = String.valueOf(string) + seconds;
}
return string;
}
Is that correct ? if so, where do I have to do this with me
can't read it like that lol
wait
or just use ```this
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
0-indexed pog
ah dude, hate that starts-with-0-thing
dude
you doesnt start counting with 0...
i want the timer to look like this rather than 23434 seconds but 01:44:22
lemme send you code lol
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
public static String convertedTime(int time) {
int hours = time / 3600;
int minutes = time % 3600 / 60;
int seconds = time % 60;
return String.format("§b%02d§7:§b%02d§7:§b%02d", hours, minutes, seconds);
}```
guess this is what you want?
where time is the current time in seconds
how does it look in the game?
hours:minutes:seconds
yes
in the actionbar
true
?paste
that's how I want it
ignore the static abuse, it's old...very old
https://paste.md-5.net/zowoxijeze.java
that's what i used in my old plugin, maybe it helps
can you edit my code and send it to me?
why tho? you just have to use my convertedTime() instead of your old
if it's a utility I'd think it to be fine
oh god you're talkin about that
yeah you see now
ok thx
its really really old
like about 1,5 years
where i made that, i didnt even know that constructors exist lol
I have to be completely honest I don't know where to put this in
pls look https://pastebin.com/6Jx3vw3V
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
kinda feel like you are making a challenge plugin lol
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, new TextComponent(ChatColor.GOLD.toString() + ChatColor.BOLD + getTime()));
replace getTime() with the one i sent
ok thx
sure
Kinda feel good, as i'm not the only german one here
only thing i hate is, i feel like everyone still speaks better english lol
finally made the texture pack using this
wtf du bist deutsch
`{
"parent": "item/generated",
"textures": {
"layer0": "item/diamond_sword"
},"display": { "thirdperson_righthand": { "rotation": [0, 90, 42], "translation": [0, 2.75, 0.75], "scale": [0.9, 0.9, 0.9] }, "thirdperson_lefthand": { "rotation": [90, -90, 42], "translation": [0, 2.75, 0.75], "scale": [0.9, 0.9, 0.9] }, "firstperson_righthand": { "rotation": [0, 90, 25], "translation": [1.13, 3.5, 1.13], "scale": [1, 1, 1] }, "firstperson_lefthand": { "rotation": [0, -90, -25], "translation": [1.13, 3.2, 1.13], "scale": [1, 1, 1] }, "ground": { "rotation": [180, 0, -90] } }, "overrides": [ {"predicate": {"custom_model_data":1}, "model": "item/custom/tpstaff"}, {"predicate": {"custom_model_data":2}, "model": "item/custom/frezestaff"} ]}`
in der tat
komm mal bitte in den talk
mom
i dont speak german
that much
lol
does anyone have like a force resource pack code or something
?paste or use ```json
<content>
```
I will use grammarly for that
how do i check if a player hits player who is holding shield
good god
hitsound
check if their hand or offhand is a shield
particles
whats the java statement for
in: 7
current: 6
max: 10
get the new current and leftovers
so new current would be 10, and the leftovers would be 3
that makes no sense
your logic is stupid
lol
Monkey A has 2 bananas
Monkey A can only hold 5 bananas
Monkey B wants to give Monkey A 10 bananas
Monkey A takes 3 bananas and gives back 7
wdym java statement
add it to how much B is going to give to A
you'd have to do that manually
explain the fucking modulo
you'd have to do subtraction and stuffz
babyfeed me i have no clue how it works
feed u dat pus
because i dont feel like writing clunk code when i dont have to
lol
not modulo actually, just subtraction
ma = 3
mb = 10
new, leftovers = (mb - ma + ma), (mb-ma)
fix
thats it i think
wait
fuck
Monkey a = new Monkey(2, 5);
Monkey b = new Monkey(69);
int leftovers = b.giveBananas(a, 10);
...
int giveBananas(Monkey monkey, int amount) {
if (amount + monkey.getBananas() > monkey.getMaxBananas()) {
monkey.setBananas(monkey.getMaxBananas());
return amount - monkey.getMaxBananas();
} else {
monkey.addBananas(amount);
return 0;
}
}
you have to take away from monkey b
oh shit that's recursion hold on
lmao
fixed
there is no "java statement" for that
you have to do it yourself
disculpe
anyways
freaking out rn https://prnt.sc/11030xj
this would look a lot nicer if ExampleDataHolder was in a seperate class
I don't want it to be in a separate class
but I also don't want an ugly ass import
class A extends B {
}
class B extends A {
}
nonono
what can I do about this?
How do i disable compass teleport minecraft
compass teleport?
its in the worldedit config
beep
please I don't want this https://prnt.sc/1103atg https://prnt.sc/1103ays https://prnt.sc/1103b6j
this is ugly
what
plural words in package names is ugly yea
but structured code?
especially when your project gets bigger its so nice
bruh I had 1 comma in the wrong place and it was enough to ruin my code
it took me 3 hours to realize
wouldnt ur compiler yell at you
I didn't run the command
in the editor
It was a texture json file
so yea
-_-
oh
also if you look at minecraft log while reloading resource pack it shows you what is wrong. with it 🙂
interesting
i never check logs
thx for the info though
ok it seems like problems are forever
so I have this
first two run mwa
the wooden sword though
the texture won't work
that indentation tho
Pog texture
im running tests
rn
so I don't have something good
bc I am not gonna spend 5 hours on blender rn
ok
?
anyways so what is the problem
maybe bc I have the name wooden_sword
and it is the minecraft name
or something
if anybody knows
try citizens discord or check the wiki for more info tbh
i'm pretty sure this is spigot related
and use it?
yes
this is #help-development not #help-server :)
I mean you asked here
I mean if you can't make just use some else's plugin
for the love of god please format your code
What
```java
code here
```
Do you have a method inside a constructor inside a method
also that
throw it into a json formatter
it'll tell u whats wrong with it**
you do
i cba to help you with basic java stuff, basic programming stuff for that matter
@faint snow Try this as it looks you don't even know the basics to java. https://www.codecademy.com/learn/learn-java
It's fun and interactive, I'm pretty sure.
I took it a couple weeks ago to see if it would be good for beginners and its perfect. Very interactive and will keep people wanting to learn java to stay for some beginning level java
ca is not great in my experience
How I can add ProtocolLib to Maven?
fixed it the name was wrong lol
is there a like a wiki for 3d textures and models bc im ok with the like 2d ones but 3d textures wont load anyone that is willing for me to dm him my texture pack and yea tell me what is wrong with it
how do i check if axe is fully loaded
wym
oh
just let it be
or calculate the time
hmm
ok
but
then
how do i check if an axe is like at its lowest point
on the screen
so i can check the time to see how long it takes to get loaded
maybe some kind of mod could help you with that
#general or #help-server
Does anyone know how I can modify the data of a jigsaw block in spigot without using raw data? Please ping me on response.
So I just tried to make an easy invsee command in 1.16.1 by opening a player inventory to another one.
And then this happened: https://imgur.com/a/mZV8RQ8
How do you launch a block into the air and make it fall back down?
Does anyone know what happened there?
How I can add ProtocolLib to Maven (I want version 3.6 it is important)
<repositories>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
<!-- And so on -->
</repositories>
<dependencies>
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.6.0</version>
</dependency>
<!-- And so on -->
</dependencies>
Just changed the version
how do i get a radius around a player, and loop through all the x-y-z locations in that radius and add them to a list?
@mortal cedar ;/
How?
@oak mica falling block
File -> Project Structure -> Libraries
but as Maven
it looks like 3.6.4 and 3.6.5 are both hosted
but i see no 3.6.0
if for some reason you really need specifically 3.6.0, you can download it manually and insert it into your .m2 dependencies
but i'd recommend just updating the protocol version, or programming with different versions in mind
can be 3.6.5 (version 3.x.x)
does anyone has an idea why that happens?
I try analize old version plugin
gotcha
you might have to set the URL to https://repo.comphenix.net/content/repositories/releases also
<repositories>
<repository>
<id>dmulloy2-repo</id>
<url>https://repo.dmulloy2.net/repository/public/</url>
</repository>
<!-- And so on -->
</repositories>
replace the url between <url></url> with the new url that i sent
#help-server for server related issues
this is #help-development, which is for development related issues
how do i get a radius around a player, and loop through all the x-y-z locations in that radius and add them to a list?
are you looking for entities, blocks, etc.?
there are infinite locations in that radius
@candid galleon what I make bad?
remove the -SNAPSHOT
see 2 screen
we're talking about ProtocolLib, not spigot
ah i see, forget about it lol
Should I cast an OfflinePlayer as a player? Or should I do something else.
OfflinePlayer#getPlayer
@main dew try changing the <id> to comphenix
you should also probbaly separate your dependencies / repositories more
someone effect
and again the URL for the repo should be https://repo.comphenix.net/content/repositories/public
you currently have it https://repo.comphenix.net/content/repositories/releases
i sent the wrong URL in the first one my bad
someone effect ;/
nononono I don't want to rely on the user to structure it properly
I want it to be built-in
although ig you could just move it to a seperate file anyways
I can't do that though
Since I am not summoning the block
why can't you?
I am using blocks around the player
yeah?
you can't break the blocks around the player and summon fallingblocks at the same time?
Enderman enderman = (Enderman) p.getWorld().spawnEntity(p.getLocation().add(randomX, randomY, randomZ), EntityType.ENDERMAN);
enderman.setMaxHealth(2000);
enderman.setHealth(2000);
enderman.setCarriedMaterial(new MaterialData(Material.ENDER_PORTAL_FRAME));
enderman.getEquipment().setItemInHandDropChance(0);```
shouldn't `setItemInHandDropChance` work for this instance? or i guess not because that qualifies the exact item drop chance, but any help?
no
I think enderman carried material is different from item in hand
iteminhand doesn't work for endermen
enderman.setCarriedMaterial and enderman.setCarriedBlock would then have the same achievement
since both work, i just need to set the drop rate to 0% though
ah
i'm pretty sure i can also,
e.getDrops().clear();
e.getDrops().add(new ItemStack(Material.LEATHER, 32));
on the enderman
lemme see
nope, just gotta listen for an enderman
thank u
if (e.getEntity() instanceof Enderman) {
for (int i = 0; i < e.getDrops().size(); i++) {
if (e.getDrops().get(i).getType() == Material.ENDER_PORTAL_FRAME) {
e.getDrops().remove(i);
}
}
}
look right?
🤔
how do i set a players gamemode once they respawn? i tried PlayerDeathEvent but it doesnt have any properties for that
should i try PlayerRespawnEvent
@young knoll help me out w thatt^
@lost matrix earlier you gave me this to measure blocks per second java public double getCurrentVelocity(final Player player) { return player.getVelocity().length(); } We are going faster then this is able to pick up.....
No
You have to cancel the damage event instead
You can't go faster than it can pick up, it returns your velocity
If you are moving you should have a velocity
@EventHandler
public void onPlayerDamage(EntityDamageEvent e) {
if (e.getEntity() instanceof Player) {
Player p = (Player) e.getEntity();
if (p.getHealth() - e.getDamage() <= 0) {
e.setCancelled(true);
die(p);
}
}
}
?
https://gist.github.com/Flo0/e85439d151ac8396a92857150539315f
This works better. But the performance is quite bad.
ok
If you are still going too fast then you need to do some really expensive maths.
The problem could be an overflowing double in the equation of calculating the distance between two points.
sqrt(dx^2 + dy^2 + dz^2)
You can imagine that the overflow might happen because of all the squaring.
Pretty unlikely that you hit that limit but if you do you need to wrap the values in a BigDecimal and calculate the distance by hand.
And that is really slow. @sacred phoenix
e.getFinalDamage
o okay
public void die(Player p) {
String cause;
String causeSelf;
EntityDamageEvent damageCause = p.getLastDamageCause();
if (p.getLocation().getY() <= 0)
p.setLastDamageCause(new EntityDamageEvent(p, EntityDamageEvent.DamageCause.VOID, 1));
switch (damageCause.getCause()) {
case VOID:
cause = "fell into the void.";
causeSelf = "fell into the void.";
break;
case FALL:
cause = "fell to their death.";
causeSelf = "fell to your death.";
break;
default:
cause = "died.";
causeSelf = "died.";
break;
}
this don't seem to b workin, it constantly calls a void death fr some reason
This looks like a job for a Map<DamageCause, String>
I imagine the setDamageCause may reflect in the variable you have
got rid of it, that didn't fix my issue
Where are you calling the code from
I kind of didnt follow through. Why dont you listen for the death event?
the two callers
@EventHandler
public void onPlayerMove(PlayerMoveEvent e) {
if (e.getTo().getY() <= 0) {
die(e.getPlayer());
}
}
@EventHandler
public void onPlayerDamage(EntityDamageEvent e) {
if (e.getEntity() instanceof Player) {
Player p = (Player) e.getEntity();
if (p.getHealth() - e.getFinalDamage() <= 0) {
e.setCancelled(true);
die(p);
}
}
}
Uhm... i still dont understand what you need the die method for...
I imagine it is for customizing the message
^
However the death event has event.setDeathMessage
This can be done in the death event.
it also checks for certain items inside the player's inventory
for effects blah blah
Cancel the last damage event and fire the PlayerDeathEvent yourself...
https://paste.helpch.at/ativicizor.cpp
spawncheck is called every 30 seconds
And it does nothing?
Nothing is printed in the console
And your current problem is what exactly?
_ _
calling the playerdeathevent rn and we'll see
Put a sysout at the first line to check if the method gets called at all.
It is, it was printing every 30 seconds when i had it set to less than rather then greater than
And you should keep everything away from your config. Load the values once the server starts and save them when the server stops again.
But i want it to check every 30 seconds not print every 30 seconds
Then your if statements dont go through
Technically you can use the config as a cache, but it's a somewhat slow cache
@lost matrix https://paste.md-5.net/ajutibujop.java did i do sumn wrong? just don't work no more
I mean under the hood its just a bunch of HashMaps. Its a bit slower. My main point is the readability and the problem with
mistyping errors (which he probably has)
Its this weird Memory something something where it tinkers with the String to path conversion. idk. But its not meant to be used as a replacement for proper data structures.
mhm
I basically wrapped it with a direct map lookup if the value has been read before
MemoryConfiguration. Thats what i meant.
Yep just saw it. So performance wise not bad but error prone as hell.
You tell me. I dont have any of your code...
well im telling you they are going through
The [<>]
idk why but < works, but > doesnt
< executes the SpawnBoss() method every thirty seconds
Ah i see. Think really hard about your check there.
When working with cooldowns its often a good idea to calculate the remainder and check if its smaller than 0. That often makes it more clear.
@lost matrix
I see
^^
?paste
did i set up a scheduler right? i want it to set the gamemode 1 tick after you respawn
^ code
Yep
I think you can technically use runTask as that has a fixed 1 tick delay
But I would say it's less readable
Player player = event.getPlayer();
if (blueTeam1v1.contains(player.getUniqueId()) && blueBedBroken) {
Bukkit.getScheduler().runTask(this, () -> player.setGameMode(GameMode.SPECTATOR));
}
p -> player
e -> event
You can just do runTask because it will be run in the next tick anyways.
oh
I would keep the runTaskLater so its more clear
If it's going to be seen by anyone else I guess
Other than looping all online players in a for loop, is there a better way to send everyone except one person a message?
Nope. Enforcing a condition on any arbitrary collection will lead to iteration. (Unless the condition is hash based)
Ok. I'll just do
for (Player online : Bukkit.getOnlinePlayers()) {
if (!online.getName().equals(playertoexclude)) {
online.sendMessage("Message")
}
}```
Sure. Either that or if you want to sqeeze a tiny bit of performance out then you can just put every player except the excluded one in a Set<Player> on login and then only send the message to every player in that set.
But thats implementation specific.
I basically want to make it so that when a new player joins, it sends a message to everyone except that person encouraging them to welcome the new player
how to check when a shield breaks by an axe
Then your approach is fine. Performance impact is minimal.
this kinda late mb, but getting a NPE on the switch (damageCause.getCause()) { line, https://paste.md-5.net/ajutibujop.java
o thank
ArmorStand as = (ArmorStand) p.getTargetBlock((HashSet<Byte>) null, 3).getWorld().spawnEntity(p.getTargetBlock((HashSet<Byte>) null, 3).getLocation(), EntityType.ARMOR_STAND);
Caused by: java.lang.IllegalStateException: Start block missed in BlockIterator
what's the solution 4 this
I am getting an error this is it: Caused by: java.lang.IllegalArgumentException: location.world
here is the code
?paste
https://paste.helpch.at/equwojukok.cpp
SpawnCheck() runs every 30 seconds
And the secondsuntilspawn = 60
for some reason. it just runs spawnboss() every 30 seconds instead of every 60
if (plugin.data.getConfig().getInt("nextbossspawn") > System.currentTimeMillis()) { i have messed around with the operator here and it doesnt work either way <, or >.
please mention me if your responding 😄
what line @deft sedge
in code
the error says that it's around location.world
idk what that means
is it supposed to give me a line?
make a PLAYER_SKULL and set them as the owner
SkullMeta
.setOwningPlayer(uuid) I think
how would i get the skull? I cant find the Material.PLAYER_SKULL in itemstack
Material.SKULL_ITEM with a (short) 3
startcommnd is the name of the class
you're using an older version Ukraine?
PLAYER_HEAD then
looks fine to me
ok ty
if anybody knows
how do i check if a player jumps
PlayerMoveEvent and make a check there
yeah but how do i check?
playermoveevent -> get the y value of the from, and compare it against the y value of the to
you'd have to make it yourself
do u have the link to my code?
unsure if that's the best method
if i do that, then ittl trigger if people go up ladders and swim
just say what line 74 is
!p.isSwimming and !p.isFlying gets rid of two checks
that's easier
@quaint mantle sorry for so many questions
what about ladders
just check if they're in a ladder then
try Player#getLocation#getBlock#getType != Material.LADDER
but how would I get skull meta? would it be playerhead.getItemMeta or smth?
ok
ItemStack#getItemMeta and cast it to (SkullMeta)
that is code link @quaint mantle https://paste.md-5.net/juxefabodu.js
ohhh ty
world = Bukkit.getWorld(content.replace("world= ", ""));
so I'm assuming this is the problem
and it's not consistent with this others
the others are x: y: z:
but this one is world=
Would i set owningplayer or setOwner?
So how would I fix that?
whats offline player var type?
@rugged topaz like this:
https://paste.helpch.at/equwojukok.cpp
SpawnCheck() runs every 30 seconds
And the secondsuntilspawn = 60
for some reason. it just runs spawnboss() every 30 seconds instead of every 60
if (plugin.data.getConfig().getInt("nextbossspawn") > System.currentTimeMillis()) { i have messed around with the operator here and it doesnt work either way <, or >.
please mention me if your responding 😄
OfflinePlayer?
sorry im a moron
f (e.getFrom().getY() < e.getTo().getY() && !entityWasDamaged.isSwimming() && entityWasDamaged.getLocation().getBlock().getType() != Material.LADDER) {
}```
if*
is this in an IDE?
or did you just type it up
ah
here
oops
ill send my whole event
@EventHandler
public void onJump(PlayerMoveEvent e) {
if (cantJump.contains(entityWasDamaged)) {
if (e.getFrom().getY() < e.getTo().getY() && !entityWasDamaged.isSwimming() && entityWasDamaged.getLocation().getBlock().getType() != Material.LADDER) {
e.setCancelled(true);
entityWasDamaged.sendMessage(ChatColor.GREEN + "You can't jump, since your 'bones are broken :)'");
}
}
}
ok
I would recommend giving them jump boost >128 instead
It will stop jumping but not ladders and such
@quaint mantle SHould i make it world:?
should I make it world: and not world=