I would be too embarrassed to do that. I will fight away, thanks of your really good help and pointers.
I will look at the suggestion you have pointed too and try to adjust it. I tend to helter skelter attack and move or duplicate the lines instead of proper access modifiers and the like. As such there are allot of commented out lines that are their examples of other plugins where I got similar methods that worked in other packages I got to work for switching on and off or examples to help clear problems. I think it is the updating the data part that got me in trouble as I replaced the three live data labels on the panel when the command was invoked. But I had a serious issue in updating my database for new and existing players that I fixed last night mostly. It worked fine when there was only one player (me) Then it kept sending new people to 0.0.0 bottom of the ocean where they promptly drowned. Ooops
. I do have that fixed at least now and some people came on and informed me ghosting was still present. However, the movement routine that accessed the several databases and displayed information are working fine now so some progress.
. This is something that is really simple likely for you but to find a out of place bracket or extra parenthesis could take me hours to correct. I think an AI program could write this is a few milliseconds but where is the puzzle fun in that?
everyone makes mistakes, there is no harm in posting your code or parts of the code for users to understand what you are doing, this can be a huge help in helping you, but from what ive read it seems you may not be loading all your ui elements in onPlayerConnect load everything in there and add only the parent to the player, for ones you want showing you need to have the parent element set to setVisible(true); any data for those elements should already be loaded other ui elements should be set setVisible(false); also you only need to add the parent elements to the player all the child elements will automatically be attached to the player, when you want to view an element with all its lables etc you can use the PlayerUIElementClickEvent then set the setVisible(true); like this
public void onPlayerConnect(PlayerConnectEvent event){
Player player = event.getPlayer();
// load the UIElement and lables in the player connect event
UIElement MarketUI = new UIElement();
player.addUIElement(MarketUI);
MarketUI.setSize(1200, 800, false);
MarketUI.setClickable(false);
MarketUI.setPosition(1, 5, true);
MarketUI.setBorderEdgeRadius(5.0f, false);
MarketUI.setBorderColor(888);
MarketUI.setBackgroundColor(0.1f, 0.1f, 0.1f, 0.95f);
MarketUI.setVisible(false);
// set the UIElement to a players Attribute i always do this you don't need both but this is needed -> player.setAttribute("MarketUI", MarketUI);
player.setAttribute("MarketUI", MarketUI);
player.setAttribute("MarketUIID", MarketUI.getID());
UILabel exitMarketUI = new UILabel();
exitMarketUI.setClickable(true);
exitMarketUI.setFontColor(50,999,999,50);
exitMarketUI.setRichTextEnabled(true);
exitMarketUI.setFontSize(18);
exitMarketUI.setText("<b> X </b>");
exitMarketUI.hoverStyle.color.set(1.0f, 0.0f, 0.0f, 1.0f);
exitMarketUI.setPosition(1170, 2, false);
MarketUI.addChild(exitMarketUI);
// set the UILabel to a players Attribute again you don't need both you could get the id from -> player.setAttribute("exitMarketUI", exitMarketUI);
player.setAttribute("exitMarketUI", exitMarketUI);
player.setAttribute("exitMarketUIID", exitMarketUI.getID());
Display More
// open the market label in the PlayerUIElementClickEvent or close it
public void onPlayerUIEClick(PlayerUIElementClickEvent event){
Player player = event.getPlayer();
// get the UIElement id the player clicked on
int eventID = event.getUIElement().getID();
// get the MarketUI you want to display/open without this you cannot do MarketUI.setVisible(true);
UIElement MarketUI = (UIElement) player.getAttribute("MarketUI");
int OpenOnLineMarketID = (int)player.getAttribute("OpenOnLineMarketID");
if(eventID == OpenOnLineMarketID){
player.setMouseCursorVisible(true);
MarketUI.setVisible(true);
int exitMarketUIID = (int)player.getAttribute("exitMarketUIID");
if (eventID == exitMarketUIID){
player.setMouseCursorVisible(false);
MarketUI.setVisible(false);
//<---------------------------------------------------------------------------------------------------------------------------------------------------------------->
// Alternatively you could get the id from the Elements, because we already retrieved the UIElement from player.getAttribute("MarketUI");
if(eventID == MarketUI.getID()){
player.setMouseCursorVisible(true);
MarketUI.setVisible(true);
Display More
This above code is at its simplest, you may not want to only open UIElements under the PlayerUIElementClickEvent you may want to do it when say a player right clicks a NPC if that NPC == Dummy
then you just use MarketUI.setVisible(true); as long as you have also included UIElement MarketUI = (UIElement) player.getAttribute("MarketUI"); in your event the UIElement will open