#help-development
1 messages Β· Page 1431 of 1
look here
There is nothing you can do. The main world can not be unloaded
Use a InventoryOpenEvent?
but system is npc joining arena, so i cant
Can i make a new temperary world?
yes
Can it be a random seed?
yes
lookup createWorld in teh javadocs
How do i move all players to that world?
player.teleport
player.teleport()
what should i put in my gamemanger?
i tought also about a playermanager but idk how that would work
Do i use bukkit.server.createWorld
bukkit.WorldCreator.createWorld
or bukkit.Bukkit.createWorld
How would I go about adding a furnace cook time to an item that doesn't have one
Logic regarding the state of the game, in something like bedwars it would be bed breaking and generator updating etc, you get my point
(Bed breaking logic not the actual event listener)
No
why?
world files are locked by the server
Your level of knowledge seems far too low to be dealing with world generation, file locks and unloading
Even if i put it onDisable?
yes
damn
So there is no way to delete world files when you restart the server other than manually?
jesus christ
you cannot delete the main world file
how many times do we have to tell you
it's impossible
You would need to understand Threads, Futures and a whole lot more to handle dynamic world generation and replacement
or that
So what do you suggest i learn while im still new to spigot and java?
I'd learn how to make basic plugins
literally get a working plugin that loads and runs one command is quite a job for any beginner
Do what ElgarL the boss says, i'm trying to make a kit gui, leveling up the ladder
using multiverese plugin. how can i make it so that the invitory they have is only for that world and they have a seprat chat only rto that aworld
i have error for minigame arena teleporting part, but i cant see any misstake. Can anybody help me?
Config:
You need multiverse inventories, and your question should be in #help-server
Show Arena.java line 89
and config.getarenaspawn
hm
since when is an id a location
I just changed the coordinates and worlds of the arena and lobby worlds and this problem occurred
do you have multiverse?
I didn't even touch the codes there, I just changed places from config
yeap
.
arena world = lobi
lobby world = lobby
then you want to use Bukkit.getWorlds() and look thru them to find the world.
since for some reason, multiverse conflicts with bukkit
mmh
worlds have to be loaded before you can access them
in where?
Anyone know how to set a "variable" for a player, like if they press the green team button they're assigned to green team?
np, already loaded
like
uhhh
1s
like this:
you can make it what way you want.
you just have to well... include the "for" loop to find the world etc etc.
didn't even know you could do it like that.
epic and awesome
I have this, doesn't work... anyone have ideas ?
oh and don't say the player is not connected.. pretty sure he is..
even the docs say it
Anyone know how to set a "variable" for a player, like if they press the green team button they're assigned to green team?
InventoryClickEvent btw
i know that
Hashmap best?
Scoreboard Teams is a hard one
every time you change scoreboard it will stop working correctly and you will have to redefine it
unless you use packets..
Let's say im kinda new, which one would be good to learn
HashMap is the easiest..
I followed https://bukkit.org/threads/tutorial-extreme-beyond-reflection-asm-replacing-loaded-classes.99376/ this old tutorial, and I got everything running how it should..
Except, when I try to retransform the MinecraftServer class is keeps giving me ClassDefNotFoundErrors for all imported libraries and so on...
And I don't know what I can do to import the rest
what no
if not, it would be a valid way
generally just a personal "variable"
No i meant teams
nbttags yeah but seems boring
PDC or Hashmap depends what you want
.
what is pdc
Persistent Data Container
this is literally #help-server stuff?
lower version support btw
like config?
no
"NBT version Bukkit"
its usable for 1.8.8 spigot?
nope
ok well rip
use 1.16.5
hashmap it is
yeah no
?
@vestal dome i fixed the error
congratulations Furkann
I did a little research on the location.world error and came to the conclusion xD
declaration: package: org.bukkit.persistence, interface: PersistentDataContainer
ima go get some buns
well i cant use it if its only 1.16.5
Ok well you should say 1.8
1.8.8 is old enough
Because then ill know that i shouldnt help you
I never used PDC and don't intend on using tbh
Im not talking to you
men i cant go 1.16
basing on 1.8.8 is not the worst choice, but it comes with it's negatives.
im tired of explaining why
and postivies.
use a HashMap
1.8.8 is the worst
i will
nah
whatever you said
ty
cant change the truth that 1.8 is the worst
Some servers still use 1.8.8, don't blame them because I'm still there aswell
1.8.8 pvp
IDC why you use the version
only 8.7% really?
Im just saying
yes
that's paper bud
that's bukkit
could've expected like 40%
I wont support yiu
paper is less than that
If you ise 1.8
im just tired of the diva coders who cant stop saying "outdated" every time i say it
ye
who you are becoming martoph
then you're not legacy
i wont support 1.8 too
and you shouldn't argue
or anything under 1.13
boomers
You dont seem to understand
fair, done deal
nobody gonna use the old api
Finally, I have only 1 error left, actually bug idk.
I added the code to join the arena with the NPC, the code below works fine, but after joining the arena, clicking the npc again opens the villager trade screen. I want to prevent this
line 11 and 15. else's
https://paste.turingarch.com/paste.php?id=94
Paste can store text, source code or sensitive data for a set period of time.
some people use it
I still don't blame it, and done ez
hypixel?
*8
Tell me you use 1.8 whne you want help
Im fine with using 1.8
"best performance version"?
π π π π
I just dont support 1.8
hilarious
didn't ask
Was there a spigot 8 years ago? lol
Great! So dont expect help from me lmfao
it is not optimized
5 years
wait
i thought it was 8
disagreed but wtf ever.
they use custom spigot
again, who gives a shit about hypixel
The guy that refused help optomizing his 100s of hashmap lookups is schooling me on minecraft performance
do not use Hypixel as an example
it's some shitty minigame server that nobody cares about
you're mistaken
"even"?
(can't type)
99% of the people who help here only support the current build but some will go the extra mile back as far as 1.14
literally every single time the 1.8 discussion is brought up some tard will start screeching but moh hypicle muh hypickle
what the fuck made hypixel the golden standard of minecraft servers
why is everything being compared to a minigame server
hYpIxEl
it's just beacuse its successful so people assume if they copy it exactly they will also be succesful
basically people r stoopid
ask skype
Yea they pay their devs like 6 figs
They literally probably have very little code remaining that actually was part of bukkit lmfao
at least use a server of the same category as an example
Heck they use their own world formats
1.8 sucks
ye .slime
1.6 is the best version end of
alpha
Hypixel isnt comparable idk why ppl keep bringing it up
Also copying a server will not be successful. They are successful because they innovate.
New ideas all the time
now explain this here.
please*
we're not the customer support
can't see shit
what?
no lol
it's probably some dumb question anyway
You should say the problem you have
thx
Before you ask for help
the message is not received by the spigot server simple as that.
βIt doesnt workβ doesnt cut it
You can NOT send data to a server with no online players. I already told you this. A player IN the Join event is not online
he blind
imagine reading
You post crappy little screenshots I'm not going to waste time blowing up constantly
damn bot
bad elgar
Yes, IF there is a player already on teh server
a server with NO players will NOT receive messages
throw some sockets at it
want me to paste the docs here?
doc all you like, I'm stating facts
I still don't get you... the guy is online k?
NO he's not
Change my mind
Have you checked the BukkitgetOnlinePlayers()?
if you knew what was wrong you wouldn't be here asking for help
we don't need to change your mind
I don;t need to change your mind. You are the one asking for help. I'm telling you the answer
Lmfao its the second time hes done this
typical 1.8 retard
typical legacy version retard
I would look at myself if I was retarded
'Change my mind' wtf why is it a debate
you should ask your mother for respect
& attention
don't feel like doing it
then go away
you're somehow managing to lower the average iq of this channel
Taken from teh tutorial page Keep in mind that you can't send plugin messages directly after a player joins(Eg. in PlayerJoinEvent). You have to include a slight delay. https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
which is already shockingly fucking low to begin with
and just like last time, you were blatantly wrong but refused to believe it
keep in mind that you are the guy who doesn't know the things, and that is why you have to come to this cancerous shitfest of a help channel to be pointed in the right direction
coming here and telling that everyone else is wrong when it's your project that is shitting bricks is retarded
?xy
Asking about your attempted solution rather than your actual problem
are you even suprised?
i'm not surprised, no, because you are a 1.8 player
which is a very poor breed of player
often with mental and attitude defects
you are a prime exemplar
ooo nice
log a player in fully, then send a message. If it doesn't work come back.
well I delayed the sendData by 15 seconds
this would run like a 1 line if right?
uhh positive....... uhh
probably want to use equalsIgnoreCase
π
oh nice
yes, I hope you checked args length too
I'm a lil bit confused, what do you mean by sending a msg?
yea yea, i was just wondering if i could run a single line if in 2 lines
do you mean like on the ServerConnectedEvent?
the compiler doesn't care about lines
you can write your entire class in one line if you want
yes, each one (without braces) controls access to the next.
if you don't use brackets, only the immediately following statement will be controlled by the if condition
that immediately following statement may be another if clause
if (x) if (y) if (z) { // stuff }
is functionally equivalent to
if (x && y && z) { // stuff }
huhum
Does anyone here know about Items Adder? If so, please read this then ping me.
||I recently bought ItemsAdder, and I loaded it into my server. Most of the textures were switched around, like a bat was a Waterskin and a dagger was the AK-47. Its angering because I bought this for 20$. And its not working correctly. Is there any assistance to help me fix this?||
go to itemsadder discord?
even a 5 year old can do that...
even me
ur good
Can anyone give me the discord for it?
thats why you are having such a hard time? cuz of the close age to 5?
hahah im joking
if I was a 5 year old, I would be here, I would have more to do of my actual life
I love getting ignored for 5 minutes straight
well if you text a new question every 2 minutes, its hard for people to keep up with the other questions
haha im jokingg
sysout in your messaging code so you can see it is actually attempting to send and when.
well.....
spigot has no souts... on console so..
yes it does
sout definitely prints stuff to console
and thats receiving not sending
exactly?
It does
uhhh
But you'd be better off just using the thing in bukkit
it should print but that code is never called..
Great so youve identified your problem
use getLogger();
Doesnt matter for debugging
that code will only run IF the channel is registered for receiving AND you did actually send a message to it, AND a player is online
No
I delayed it by 15 seconds, by that time the player should be online..
Its gonna be deleted
sysout in your Sending to see that it is sending and when
in the bungeecord I registered the channel...
So let me understand this
same in spigot.
Nothing is printing?
nop
sysout In your sending to show it is actually being sent
tf 'spawnEntity(org.bukkit.Location, org.bukkit.entity.EntityType)' in 'org.bukkit.World' cannot be applied to '(int, int, int, org.bukkit.entity.EntityType)'
` public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if(sender instanceof Player){
Player player = (Player) sender;
player.sendMessage(ChatColor.LIGHT_PURPLE + "Hey sexy....");
int x = player.getLocation().getBlockX();
int z = player.getLocation().getBlockZ();
int y = player.getLocation().getBlockY();
World w = Bukkit.getWorld("world");
w.spawnEntity(x, y, z, EntityType.VILLAGER);`
spawnEntity(org.bukkit.Location, org.bukkit.entity.EntityType)' in 'org.bukkit.World' cannot be applied to '(int, int, int, org.bukkit.entity.EntityType)'
the declared method is spawnEntity(Location, EntityType)
this means that you must give it 2 parameters
a Location object, and an EntityType object
however you are giving it this (int, int, int, org.bukkit.entity.EntityType)
you are giving it 4 parameters; 3 ints and an EntityType object
So do i put player as location?
a Player is not a Location
it wants a Location
you can retrieve the player's current Location by calling getLocation() on the player
or you can create a new Location by calling one of its constructors
ye....
Elgar, what about this?
is there a 15 second delay?
yes
in that case does any of your receiving code do anything? not even the sysout 1?
nop
then thats impossible
so long as a player IS logged in
You do actually have a player online and in a world when this message is sent?
it apparently IS POSSIBLE.
answer the question instead of arguing
it's "e.getPlayer()"
should the player that logged in 15 seconds ago... be the one to send it?
yes
you towny people are awful at spelling the
llamadeal does it too
Too much masturbation, curls the pinky.
Lmfao what?
[16:04:15 INFO]: [VentureChat] - Initializing...
[16:04:15 INFO]: [VentureChat] - Config found! Loading file.
[16:04:15 INFO]: [VentureChat] - Checking for Vault...
[16:04:15 INFO]: [VentureChat] - Could not find Vault dependency, disabling.
[16:04:15 INFO]: [VentureChat] Disabling VentureChat v2.22.8
[16:04:15 INFO]: [VentureChat] - Disabling...
[16:04:15 INFO]: [VentureChat] - Disabled Successfully
[16:04:15 INFO]: [VentureChat] - Loading player data
i can turn on venture chat... this is what im supposed to use with discordsrv
Only one arm is like a tree trunk
basically, I connected 2 clients, 1 after the other.. it still didn't work....
LMFAO
then your channel registrations much be bad
if you actually sent a paste man...
too small, can;t read
use a pasting site
How do i reopen the maven tab it auto closes
by clicking the button that opens it
it probably reads "maven" on top of the button
that button goes away
do you use intellij
me?
that isn't a maven project
?paste your ReceivePluginMessenger class
Yes it is...
pom.xml is under target for some reason.
spigot \ bungee?
bungee
not used at all but ok
https://paste.helpch.at/afufujojul.java
make it not be under target
that project has not been imported as a maven project
take it from target and move it to the root
ok
then rightclick the pom file
epic works
and there should be an option somewhere that reads import as maven project
it all looks fine to me
want on spigot now? laughs
ok, there is no reason your plugin shoudl not be receiving the message
I just don't.......
unless somehow yoru onEnable is bombing, but that would stop all your events being registered
not a thing....
the thing is that it works when I use <ServerInfo>.sendData();
but that's bad.
what command are you using right now?
yes
e.getPlayer()
no from teh proxy
this: e.getPlayer().sendData("bungeecord:main", output.toByteArray()); ?
e.getPlayer().getInfo().sendData
sorry e.getPlayer().getServer().getInfo().sendData
wait.....
I was looking at Bungeecord's source..
and it overwrites the tags.
o_o
sending from ServerInfo is correct as its queue backed
Yes, those old tags are not longer supported
well but one of my tags is that one.
alright... I'll see.
How do i do a wait?
try {
wait(0x1);
} catch (InterruptedException e) {
e.printStackTrace();
}
you don't wait
you schedule something to happen later
waiting stops the thread you call wait on
which usually is the server main thread
and stopping that freezes the server
What is the alternitive?
you schedule something to happen later
using the bukkit scheduler
which will execute the task you pass it at a time of your choosing
define loop
for, while, if
Like make something happen over and over again.
every like 30 milisecconds
if you tell it to run your task once every x ticks, it will run it every x ticks
Look for βBukkit runnableβ
look up a guide on the bukkit scheduler
Iβm assuming you donβt use the discord client?
Cause i never see that u are typing
what us the discord client?
The downloaded one?
I was talking to @wraith rapids hence I replied to him
i can't see replies
Oh, yeah, what client do you use?
ripcord
Why lmao
it's lightweight
I mean, I guess but discord isnβt exactly heavy
I mean, you do you
it's based on electron so it basically has the same resource footprint as opening and running another browser
even on idle it sporadically uses 40-50% of my available cpu time
it is slow, it is laggy, and it takes enermous amounts of resources of a text chat application
i literally can not use an IDE and discord at the same time
it's not weird
it's a browser in a box
it's a chromium bundled with a set of webpages in it
it can be expected to be heavy
yeah, ok
ripcord uses only 1/50 the cpu time on idle and less than 1/10 in active use
the memory footprint is only around 1/6 as well, at 50MB private working set in comparison to around 300
it only takes 10 seconds to start up for me in comparison to discord's 4+ minutes
i can run several instances of it concurrently
i can switch between alts with just two clicks
how can i make where i fireball lands exploded?
i don't need to fill in captchas or verify my email or click links in my email inbox every time I log in from another IP
i cant find the answer in google, but is it possible to have childrens inside childrens?
it is everything I want
like in example 1
discord, on the other hand, is everything I do not want
Hwe to make compass point to portal if tracked player is in nether
pretty difficult
Is there some kind of on player crouch
there is the toggle sneak event or whatever it's called
yeah
PlayerToggleSneakEvent
then you can check if the player is sneaking to check if it is the way down or up
either way, ripcord is the only client I've found that does what I want
find me a better one and i'll gladly switch because ripcord is fucking trash
Discord
heavy, laggy, doesn't have good alt support, can't run multiple instances of it, requires shitty captchas to log in and requires you to check your email inbox to verify a login from each new device
that's because you have a better machine and don't use tons of alts
Thats a fair point
i've lost access to like 5 accounts because my IP changed or something and it wants me to click some link in my email inbox to verify that it's me
i've contacted their support about it and they say it can't be turned off
i just recently installed ripcord and discord in parallel on my other machine
the other machine has only 3gb of ram and a slow HDD
switching back to discord after using another application for a while has me waiting for around 2 minutes before it unfreezes because of the higher memory footprint
ripcord responds instantaneously
PotionEffectβ(PotionEffectType type, int duration, int amplifier)
Can somebody give me an example of how this would work?
PotionEffectType is an enum
int is an int
new PotionEffect(PotionEffectType.THE_TYPE_GOES_HERE, 4, 10)
Awesome! thanks
just use discord in the browser
you can use mini opera or firefox to improve it
modern firefox is very resource hungry as well, so I can't run it on this machine either
i'm using a low overhead single threaded browser and since it's single threaded, having discord sitting in one of the tabs would slow it down quite a bit
it'd be overall better than running the electron shitshow, but I still need a workable browser
How do you apply the potion effect to an entity
or use eclipse as the ide π
entity.addPotionEffect or something, idr
like, i guess that is an option
but intellij has more stuff
eclipse is pretty good as well imo
sure you don't have as good of a completion coverage
but it does work well
i suppose
though that won't completely negate the resource footprint of using an ide
and won't help with the other issues I have with discord
intellij right now uses 1.8 gb of ram
and eclipse 450 mb
firefox uses about 1.2gb
with a lot more projects in the work place
low overhead browser uses around 200mb
Hi ! I've a question ? What is the easiest way to set secific "mining level" on block ? For exemple I want allow player to destroy block x only with iron pickaxe or better, how I can simply do that ? Feel free to mention me if you have question/anwser ^^
that's not usually the memory you want to be looking at
you'll want to look at the working set, the private working set in particular
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerQuit(CreatureSpawnEvent e){
LivingEntity entity = e.getEntity();
AttributeInstance attribute = Entity.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED);
double baseValue = attribute.getBaseValue();
if(baseValue != 0.7)
{ //If basevalue is not 0.7 default, set it back
attribute.setBaseValue(14);
}
}
i'm not sure what the windows task manager displays by default
where do i look that up?
Eclipse running with a bunch of projects, CodeTogether and a skin plugin 574mb
and add it to the shown columns
I want to spawn mobs with speed 14
looks like the old gen task manager does have a column for it
not sure about the win8+ task manager
any help ?
processhacker doesn't add up the numbers for collapsed subprocesses for some reason
you need to expand it and add them up in your brain
not sure why that is
are you sure that's the right column
looks like discord uses a bit more than that
the memory usage for discord looks a bit high
Is there a way to make a command enable or disable events
it is the root
that said I am in only like 2 guilds on my discord installation
and then register or
this is my discord installation on idle
HandlerList.unregister(event);
yeah that's not the one
or something else
private WS
the left hand memory column is the private working set, right hand column is total memory
private bytes includes memory that is not in active use and just lying around in the pagefile and shit, it's pretty irrelevant
private ws?
yeah
package me.barry.Scoreboard;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("LOGGER HASH: p2ca");
getServer().getPluginManager().registerEvents(new OnJoin(), this);
}
}
It ain't logging anything, i checked logs, no errors on load.
Nevermind i found out im an idiot
for command executer do you make a inner class or class?
i have only total cpu
the right hand one is private bytes
package me.barry.Scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scoreboard.*;
public class OnJoin implements Listener {
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
ScoreboardManager m = Bukkit.getScoreboardManager();
Scoreboard b = m.getNewScoreboard();
Objective o = b.registerNewObjective("gold", "");
o.setDisplaySlot(DisplaySlot.SIDEBAR);
o.setDisplayName(ChatColor.DARK_AQUA + "Tutorial Server");
Score gold = o.getScore(ChatColor.WHITE + "GOLD: " + ChatColor.GOLD + "10.000");
gold.setScore(1);
player.setScoreboard(b);
}
}
Nothing happens on join ):
register the event listener and make sure it's not throwing an exception on join
yeah that looks more accurate
right is private ws
protip: if you're running out of physical memory, suspend a memory hungry process and force it to reduce its working set
the application will be slow for a while when you unsuspend it and try using it next, because it has to load all of its memory back into physical memory from the disk
suspending it halts it until you resume it
pretty much
that's what I do with intellij when I need the extra memory
it responds to it surprisingly well
doesn't even really lag or jitter when I resume it later
thing is I can't fucking do that with discord, since I'm almost always using it
the whole stack is copied on the disc i assume
Can someone check to see what is wrong with my code... It is trying to give a player a potion effect based on the food they eat. In this section it is a poisonous potato if (event.getItem().equals(poisonousPotato)) { Player player = event.getPlayer(); PotionEffect absorptionEffect = new PotionEffect(PotionEffectType.ABSORPTION, 120 ,4); PotionEffect regenerationEffect = new PotionEffect(PotionEffectType.REGENERATION, 30, 2); PotionEffect fireResistEffect = new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 300, 1); PotionEffect resistanceEffect = new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 300, 1); player.addPotionEffect(regenerationEffect); player.addPotionEffect(absorptionEffect); player.addPotionEffect(fireResistEffect); player.addPotionEffect(resistanceEffect);
the threads get suspended, meaning they retain their state in memory but are no longer getting executed
you can also suspend individual threads
so the stack remains in ram
in memory
or nvm
Where it gives you the error, if it gives some error?
the memory may be on the disk or in physical memory
i have to suspend one thread from explorer.exe on startup every time because it fucks with the sound system and lags like hell
when i run the plugin in minecraft I do not get a potion effect
i s'pose discord can't do that is that it works with an interpreted language that expires and such
you can suspend it
but the thing is that you can't use it while it's suspended
cause it isn't running
that's what I used to do when I had to compile something; I suspended discord
because otherwise compiling would take like 5x as long
now with ripcord i don't need to give a shit
in comparison to the discord screenshot I sent, here is ripcord
in contrast to discord which was idle, ripcord is currently in active use and in like 30 different guilds
they've already made discord forks?
issue with most discord forks is that just like discord, they run on electron
so it's the same shit with a different skin and more features
i know someone who used vlc and some other software to watch twitch streams
ripcord is a from-scratch implementation in like C or something
wow
the developer is a fucking kike so it's closed source and lacks features
must've taken a while
but at least it's lightweight
it can't play video, animate gifs, or enlarge images
well, considering with the kids nowdays breaking gifs and videos to crash your discord server you can't complain
myeah
it's rough around the edges and has its issues but in comparison to vanilla discord it's total bliss
because it like responds instantly when I tell it to do something and not 2 minutes later
.
your choice of design
but usually it should be exposed
so it's easier to manage for changes
package me.barry.Scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scoreboard.*;
public class OnJoin extends JavaPlugin implements Listener {
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
getLogger().info(player.toString() + "has joined!");
player.sendMessage("Hi mate");
ScoreboardManager m = Bukkit.getScoreboardManager();
Scoreboard b = m.getNewScoreboard();
b.registerNewObjective("gold", "dummy");
b.registerNewObjective("gold", "dummy").setDisplaySlot(DisplaySlot.SIDEBAR);
b.registerNewObjective("gold", "dummy").setDisplayName(ChatColor.DARK_AQUA + "Tutorial Server") ;
Score gold = b.registerNewObjective("gold", "dummy").getScore(ChatColor.WHITE + "GOLD: " + ChatColor.GOLD + "10.000");
gold.setScore(10);
getLogger().info("Hash log 222222");
player.setScoreboard(b);
}
}
Well when i join, it logs the first one, but it doesnt log the last one and no scoreboard pops up /:
sounds like it's throwing an exception
look into your console and see if it prints anything
that's the join event
playername logged in with entity id ....
well i mean it can't just stop executing the method arbitrarily
it either returns or explodes
and you don't have a return in there
so it either explodes or reaches the end
Anything wrong here?
package me.barry.Scoreboard;
import org.bukkit.plugin.java.JavaPlugin;
public class Main extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("LOGGER HASH: p2ca");
getServer().getPluginManager().registerEvents(new OnJoin(), this);
}
}
looks fine
hold up
it doesnt even log that LOGGER Hash thing now
dafuq
plugin.yml:
main: me.barry.Scoreboard.Main
name: scoreboardFeatures
version: 1.0
description: Testing phase
author: barry
how do you send a message thorough chat
Bukkit.broadcastMessage("");
```?
thx
well it aint even saying it didnt load
oh it does
ahh finally found the errors 2sec
java.lang.IllegalArgumentException: Plugin already initialized!
at org.bukkit.plugin.java.PluginClassLoader.initialize(PluginClassLoader.java:123) ~[patched.jar:git-PaperSpigot-"4c7641d"]
at org.bukkit.plugin.java.JavaPlugin.<init>(JavaPlugin.java:66) ~[patched.jar:git-PaperSpigot-"4c7641d"]
at me.barry.Scoreboard.OnJoin.<init>(OnJoin.java:12) ~[?:?]
at me.barry.Scoreboard.Main.onEnable(Main.java:9) ~[?:?]
could also be an issue with using reload
having 2 jars would give a message about "ambiguous plugin name x" at least on modern versions
isk how it works in this shit ancient version
How do I turn on and off a event with a command?
you don't
are you reloading
nop
main: main.java
name: Minebot
version: 1.0
description: Beta
author: dragonblade316
does this look right
Main.java?
how about no
Main is always uppercase
And it's the way to get to it from ur source folder
not just the name
- put your classes in a package that is unique to your plugin
- name your class names in uppercase
- don't call your main class main
my.domain.myplugin.MyPlugin
and drop the .java
noted thx
when comparing itemMeta should u use .equals or ==
if you want to see if the item meta objects are equal, that is, they represent the same thing, use equals
if you want to see that the item meta objects are the same object, use ==
99% of the time, you want to use equals
ty
because every getItemMeta call returns a new itemmeta object
so it will never be == to anything other than itself
Hmmmm, new error
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml
&&
Caused by: java.io.FileNotFoundException: Jar does not contain plugin.yml
IntelliJ
But my plugin.yml is in the ressources folder?
main: me.barry.Scoreboard.Main
name: scoreboardFeatures
version: 1.0
description: Testing phase
author: barry
Method invocation 'equals' may produce 'NullPointerException' It said this when i use .equals
Is it possible to make a player inventory and Overwrite a players inventory with that inventory?
ok
points at no object
a null-pointer
make sure it isn't null
or use Objects.equals(a, b) instead of a.equals(b)
hey, do you know why it would return Jar does not contain plugin.yml even if its in the ressources folder /:
are you using maven and building your project with maven
well that would be why
the files go in target
take them from there
if you use maven, you should use maven
Creating a custom crafting GUI, how should I check the recipe that has been entered?
I find this in an repeating task very ineffective and i think there is a better way, isn't it?player.getOpenInventory().getTitle().contains("Custom Crafting GUI")
haram
don't compare title names
compare the inventory instance
if a player renames and places down a chest, they can change the title of an inventory to whatever they want
``if (player.getOpenInventory() == myCustomGui)**
dont u love my errors xd
construct the gui and store it in a field or a map, and use the instance itself to compare
right that's an inventory view
you'll want to get the topmost inventory from the view and do the == on that
Why isnt this working?
@EventHandler
public void onPlayerMove(PlayerBucketFillEvent event) {
Player player = event.getPlayer();
player.sendMessage(ChatColor.DARK_RED + "Your bucket is full.");
player.setHealth(0);
}
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.
Errors i get now
Now notice it recognized plugin.yml this time xd
you're instantiating your main class in your OnJoin class
there may only ever be one instance of your main class and it must be instantiated by bukkit
you can not use the constructor of your main class
If you hold right click, what is the number of milliseconds between each time PlayerInteractEvent is fired?
so i cant extend Javaplugin in OnJoin class?
absolutely not
only the main class should extend JavaPlugin
extending JavaPlugin means that this is a plugin
by passing your plugin instance to the class
get instance of the main class
mhh i completely understand xd
either retrieve it with a static getter method, or pass it through dependency injection
create a constructor for OnJoin that takes a parameter of type Main
create a field in OnJoin of type Main
in the constructor, assign the given parameter into this field
then call myPlugin.getLogger(), or whatever you call the field
welp what i really meant is , is there a better way instead of checking every tick? like checking every inventory click event for example?
i know comparing title names is ineffective
yeah, listen to inventory clicks and inventory drags
if the target inventory is a physical container you might need to listen for hoppers' inventory move events as well
its like
on right click if the right clicked block is a crafting table it cancels the event and opens a custom inventory to the player
yeah that's not a physical container then
Main.getPlugin().getLogger().info("Hash log 222222");
```?
so i should only listen to inventory clicks and drags?
I know its not right, but whatever else i put in doesnt work
do what i said
create a constructor for the OnJoin class
do you know how to create a constructor
like this ?
public ExampleA(MainC c) {
this.c = c;
}
myes
if not i dont no
public OnJoin(Main main) {
this.main = main;
}
then when you need to log, call main.getLogger()
if i instantiate a custom inventory and then show it to player and the player modifies some stuff inside it, will calling equals on those two inventories return True?
if you only instantiate one custom inventory, then there is only one inventory
the inventory the player is looking at is the custom inventory
so == will return true
two references, one object
are you responding to me?
Inventory myInventory = Bukkit.constructInventory(...);
Inventory playerInventory = myInventory;
if (myInventory == playerInventory) { ... }
when you call player.openInventory(myInventory), that inventory object you pass to the method is recorded on the player somewhere
when you get the player's inventory later with player.getOpenInventory or whatever, that same inventory object is returned
ty
should i instantiate one every event or just keep one in memory all the time?
.
So i tried, and it doesn't seem to work. Was gone for a few for dinner aswell, my bad.
java: constructor OnJoin in class me.barry.Scoreboard.OnJoin cannot be applied to given types;
required: me.barry.Scoreboard.Main
found: no arguments
reason: actual and formal argument lists differ in length
is this the correct use of PacketPlayOutRespawn? ```java
Packet<?> respawn =
new PacketPlayOutRespawn
(nmsWorld.getDimensionManager(), //dimanager
nmsWorld.getDimensionKey(), //dikey
BiomeManager //biomeData
.a(nmsWorld.getSeed()), //seed
player.getHandle().playerInteractManager.getGameMode(), //gm
player.getHandle().playerInteractManager.c(), //previous gm
nmsWorld.isDebugWorld(), //debugornot?
nmsWorld.isFlatWorld(), //flatornot?
true); //copyMetaData?
Your plugin is disabled
How do i enable it?
Make it not throw an error onEnable
Here are logs, i cant read this
Bruh you sent the same thing again
hi, how can i modify a nbt at an entity ?
nms, but why?
you speak at me ? I am bad in english, what would say "nms" ?
nbt is only accessible from net minecraft server aka n m s
so modify nbt of an entity its impossible ? @lilac dagger
Main
package me.barry.Scoreboard;
import org.bukkit.plugin.java.JavaPlugin;
public class Register extends JavaPlugin {
@Override
public void onEnable() {
getLogger().info("LOGGER HASH: p2ca");
getServer().getPluginManager().registerEvents(new OnJoin(this), this);
}
}
Listener
package me.barry.Scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.scoreboard.*;
public class OnJoin implements Listener {
private final Register main;
public OnJoin(Register main) {
this.main = main;
}
@EventHandler
public void join(PlayerJoinEvent event) {
Player player = event.getPlayer();
main.getLogger().info(player.toString() + "has joined!");
player.sendMessage("Hi mate");
ScoreboardManager m = Bukkit.getScoreboardManager();
Scoreboard b = m.getNewScoreboard();
b.registerNewObjective("gold", "dummy");
b.registerNewObjective("gold", "dummy").setDisplaySlot(DisplaySlot.SIDEBAR);
b.registerNewObjective("gold", "dummy").setDisplayName(ChatColor.DARK_AQUA + "Tutorial Server") ;
Score gold = b.registerNewObjective("gold", "dummy").getScore(ChatColor.WHITE + "GOLD: " + ChatColor.GOLD + "10.000");
gold.setScore(10);
main.getLogger().info("lol");
main.getLogger().info("Hash log 222222");
player.setScoreboard(b);
return;
}
}
Well it logs the onEnable stuff, but not anything in the listener
I run the method clear(), but the code stops executing after the first call to print(). Any ideas why?```private void clear() {
System.out.println("clear");
print("1");
System.out.println("test 4");
print("2");
}
private void print(String a) {
System.out.println("--------- PRINT ----------" + a);
for(Command command : simpleCommandMap.getCommands()) System.out.println("1 " + command.getName() + " " + command.getLabel() + " " + command.getAliases());
commandMap.forEach((key, value) -> System.out.println("2 " + value.getName() + " " + value.getLabel() + " " + value.getAliases()));
System.out.println("test 1");
}```
"test 4" never shows up
Is it allowed to post a public plugins that has same idea and concept like other premium plugin?
yes
you can copy feature by feature
and post it as free
as long as no code was used from the aforementioned plugin, you're free to do as you please
π
What is print()?
as you can see it just prints out some values
sorry !
println?
there are no errors in console
it prins a line in the console
it basically just stops executing for some reason
Could not pass event PlayerLoginEvent to scoreboardFeatures v1.0
Caused by: java.lang.IllegalArgumentException: An objective of name 'gold' already exists
at me.barry.Scoreboard.OnJoin.onJoin(OnJoin.java:31) ~[?:?]
anyone know how to log everything the chat says?
Log to what?
Like a file?
yeh just to get the messages as strings
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/AsyncPlayerChatEvent.html
call the #getMessage() on it
declaration: package: org.bukkit.event.player, class: AsyncPlayerChatEvent
then save it to a file or whatever
but thank you
I want to save my objects on redis, but should I store it as byte array or hashsets
I will update some fields tho
what kind of object is this
just a simple wrapper class for players
yeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeet
you would probably store it as hashsets if you plan on updating fields
right? that's what I thought
is there a method to find the first similar item in an inventory? first(ItemStack) finds equal amounts, and first(Material) obviously only matches material, so i'm not sure if i'd have to clone each item, set amount to 1, and compare? or is there a better solution?
you might want to look into GSON to use it with redis
i know gson
you can parse your maps with that
so to update the map, I get the string from redis deserialize it to a map add/remove fields and serialize it back then set to database?
yes that's an option
i don't think this is a good option if the map is big
what exactly does this wrapper contain that makes it big?
I am actually trying to learn more and more
like trying to better
I don't even have a server tbh
You might already know this, but redis stores everything in memory, meaning that you should look for options if your data is huge
a cache for online players or similar?
why do you want to store it on redis?
bungee for example
easy scaling
but have you normalized/optimized the wrapper? is the data you're storing really needed there?
I mean I actually could use mongo too
hey does anybody know how to always spawn on the spawnpoint when you join the server?
since when i rejoin it spawns me at my last location
yeah but to STORE DATA shouldnt you use a database?
use my always spawn plugin
any way to do it without a plugin?
it is temporary data, I don't want to save it to disk
nope
aight, send it
are you storing chat messages or something?
thx
/setspawn
"any way to do it without a plugin?" (in #help-development)
nope, stuff like player's rank, preferences, settings etc.