Jump to content

Method is not visible when trying to build mod, but in IDE it's fine.


naturaGodhead

Recommended Posts

So I'm working on a feature for my mod. I reference another mod that I'm dependent on in an event handler. I use a method shown below, and while in my IDE the method shows no errors. When I try to build my mod through command prompt with gradlew build, I get an error saying that the the method is not visible.  I've tried cleaning my workspace, deleting and replacing the dependant mod jar, and restarting my computer.

The error:

error: getPlayerList() is not public in Session; cannot be accessed from outside package.

 

Where I reference the method:

Spoiler

@SubscribeEvent
	public void onConnectionCreated(ConnectionCreatedEvent e) {
		if(MinestuckArsenalConfig.connectionGrist) {
			int grist = 2 * 10^(e.getSession().getPlayerList().size());
			
			if(grist >= 2000000000) {
				grist = 2000000000;
			}
			
			grist = grist - 20;
			
			GristHelper.increase(e.getConnection().getClientIdentifier(), new GristSet(GristType.Build, grist));
			MinestuckPlayerTracker.updateGristCache(e.getConnection().getClientIdentifier());
		}
	}

 

 

Method in question: 

Spoiler

/**
	 * Creates a list with all players in the session.
	 * @return Returns a list with the players identifiers.
	 */
	public Set<PlayerIdentifier> getPlayerList()
	{
		Set<PlayerIdentifier> list = new HashSet<PlayerIdentifier>();
		for(SburbConnection c : this.connections)
		{
			list.add(c.getClientIdentifier());
			if(!c.getServerIdentifier().equals(IdentifierHandler.nullIdentifier))
				list.add(c.getServerIdentifier());
		}
		list.addAll(predefinedPlayers.keySet());
		return list;
	}

 

 

Link to comment
Share on other sites

What about the Session class? Is it public? 

 

You haven't really given enough code to fully understand what you're trying to do. I'm not familiar with that event, is that a custom event? You said you have dependency to the other mod, are you sure you have that set up properly in your build.gradle and otherwise classpath? And is the other mod properly present for the build purpose?

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.