Jump to content

Recommended Posts

Posted

Hi!

 

I am just writing the last part of a minigame-server project and need a way to access the Scoreboard.

I know that I can use world.getScoreboard() to get the scoreboard, but now i am a little bit stuck.

 

I tried to use

.func_96516_a("adsasdasd");

to add a title to my scoreboard, but when i tested it nothing happened.

(Player joined after scoreboard was created)

 

So how would I set the title correctly? Or do I have to send my scoreboard to the player/add my player to the scoreboard?

 

Jacky

Here could be your advertisement!

Posted

There is some method called "addScoreObjective", you might want that.

 

In case it is not deobfed in 1.8 (I found it on 1.7.10),

  it has two parameters : String, IScoreObjectiveCriteria, and it returns ScoreObjective.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

The problem is that the player doesn't even display stuff such as the teams color.

 

To create the teams I use:

	for(int i=0; i<teamNumber;i++){
		//scoreboard.createTeam(i+"");
		ScorePlayerTeam team = new ScorePlayerTeam(scoreboard,i+"");
		team.setTeamName(EnumTeam.values()[i].toString());
		team.func_178774_a(EnumTeam.values()[i].getChatColor());
		team.setNamePrefix("TEST");
		scoreboard.sendTeamUpdate(team);
	}

once the dim is generated.

 

And then I want to use:

		    		player.worldObj.getScoreboard().addPlayerToTeam(player.getName(), (i+""));

 

To add my player to the team. Problem is: nothing happens. No name suffix, no color, ...

 

According to a bukkit tut here I have to set the players scoreboard somehow, but I have no idea how I should do this.

 

I found

	player.setScore(int x);

 

But this requires an int for the data watcher, and I don't know how I can get the scoreboards id.

 

 

I will try to find some more information in the scoreboard command, but it would be awesome if someone could help me here.

Here could be your advertisement!

Posted

Where do you add your ScoreObjective to the ScoreBoard? Relevant code would be needed.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

In my main class:

 

  Reveal hidden contents

 

 

RegisterDimensionClass:

 

 

  Reveal hidden contents

 

 

my Skybattle class:

 

  Reveal hidden contents

 

 

 

Btw, for everyone who is creating something similar, I wrote a class to display a title. Its not perfect but it works:

 

 

  Reveal hidden contents

 

Here could be your advertisement!

Posted

You should get team from Scoreboard class, via Scoreboard#createTeam(String).

  (In case it wasn't deobfuscated in 1.8, the method returns ScorePlayerTeam)

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

oh, looks like my player actually joined my team, but the nametag color was never changed....

I am using

team.func_178774_a(EnumChatFormatting.RED);

But nothing really changes. Any ideas why?

 

Here is my latest SkyBattle class.

 

  Reveal hidden contents

 

Here could be your advertisement!

Posted

Ok, fixed it by using:

 

            team.func_178774_a(EnumTeam.values()[i].getChatColor());
            team.setNamePrefix(EnumTeam.values()[i].getChatColor().toString());
            team.setNameSuffix(EnumChatFormatting.RESET.toString());			

 

Thats great. However, all my players are automatically added to the scoreboard. Not so great. Also it seems like the same scoreboard is used in all dimensions. How can i avoid this?

Here could be your advertisement!

Posted

1. Scoreboard instance should be per world, so it is strange..

2. Where the joinPlayer method get called?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

Ok, not sure why, but after I added some empty lines the player isn't in the first team by default.

However, he still keeps his in team in another dim...

 

 

@SubscribeEvent
public void onEntityJoinWorldEvent(EntityJoinWorldEvent event){
	if(event.entity instanceof EntityPlayer){
                
                 ...

		if(BlackGeckoServer.gameServer.containsKey(event.world.provider.getDimensionId())){
			System.out.println("JOINED !!!!!!");
			BlackGeckoServer.gameServer.get(event.world.provider.getDimensionId()).joinPlayer(player);
		}	
	}
}

Here could be your advertisement!

Posted

Oh. I just found out that Scoreboard is saved in mapStorage, which is for per map, not per world.

  Then, you should have to add/remove player in the Team when the player joins/leaves the world.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

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.