yungnigga123 0 Share Posted September 29, 2018 The purpose of this script im trying to make is to see if a certain area has players in it and if it does it makes a beep notification sound. http://prntscr.com/l07khk This is the code and this is what it returns to me http://prntscr.com/l07kzz What did I do wrong Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted September 29, 2018 First off, you never want to set your variable names with a capital first letter, especially in this case. (Area) Second, getPlayers().all() returns a list of players, not a boolean. You have to check if the list is empty then beep if it isn't. Area area = new Area(1, 1, 1, 1); List<Player> playerList = getPlayers().all(player -> player != null && area.contains(player)); if(!playerList.isEmpty()) { Toolkit.getDefaultToolkit().beep(); } Link to comment Share on other sites More sharing options...
yungnigga123 0 Author Share Posted September 29, 2018 1 minute ago, Milasoft said: First off, you never want to set your variable names with a capital first letter, especially in this case. (Area) Second, getPlayers().all() returns a list of players, not a boolean. You have to check if the list is empty then beep if it isn't. Area area = new Area(1, 1, 1, 1); List<Player> playerList = getPlayers().all(player -> player != null && area.contains(player)); if(!playerList.isEmpty()) { Toolkit.getDefaultToolkit().beep(); } yes, ty im new to this shit tryna learn helped alot thx Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted September 29, 2018 No problem Link to comment Share on other sites More sharing options...
yungnigga123 0 Author Share Posted September 29, 2018 1 minute ago, Milasoft said: No problem Current situation is that im trying to build artifacts with this code and it says the \ufeff error in the box and ive been trying to google the solution but so far the changing of utf-8 to utf-16 etc isnt working or im doing it wrong. I will try to get an answer to this tho Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted September 29, 2018 Try creating a new class file and paste everything in it and delete the old class file. Link to comment Share on other sites More sharing options...
yungnigga123 0 Author Share Posted September 29, 2018 21 minutes ago, Milasoft said: Try creating a new class file and paste everything in it and delete the old class file. When running in utf-8 after making a new class file https://prnt.sc/l08qtu When running in utf-16 after making a new class file https://prnt.sc/l08r2f Link to comment Share on other sites More sharing options...
Milasoft 202 Share Posted September 29, 2018 49 minutes ago, yungnigga123 said: When running in utf-8 after making a new class file https://prnt.sc/l08qtu When running in utf-16 after making a new class file https://prnt.sc/l08r2f What was the default encoding set to in your preferences? And can you screenshot the class file the errors are in? And maybe try typing in the code instead of pasting it in, might be an issue with rich text or something. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.