mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 13:07:29 +00:00
IScoreboard & IScoreboardTeam:
-Added functions that use IPlayer objects instead of player names (strings).
This commit is contained in:
1 parent
ed0290217f
commit
7094ed28f1
2 files changed
+27
-1
No files matched your search
@@ -9,6 +9,7 @@ import net.minecraft.scoreboard.ScoreObjective;
|
||||
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.scoreboard.IScoreboard;
|
||||
import noppes.npcs.api.scoreboard.IScoreboardObjective;
|
||||
import noppes.npcs.api.scoreboard.IScoreboardTeam;
|
||||
@@ -99,7 +100,11 @@ public class ScriptScoreboard implements IScoreboard {
|
||||
|
||||
Score sco = board.func_96529_a(player, objec);
|
||||
sco.setScorePoints(score);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPlayerScore(IPlayer player, String objective, int score, String datatag){
|
||||
this.setPlayerScore(player.getName(),objective,score,datatag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.7.10c
|
||||
@@ -116,6 +121,10 @@ public class ScriptScoreboard implements IScoreboard {
|
||||
return board.func_96529_a(player, objec).getScorePoints();
|
||||
}
|
||||
|
||||
public int getPlayerScore(IPlayer player, String objective, String datatag){
|
||||
return this.getPlayerScore(player.getName(),objective,datatag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @version 1.8
|
||||
* @param player Name of a player or non existing thing
|
||||
@@ -130,6 +139,10 @@ public class ScriptScoreboard implements IScoreboard {
|
||||
|
||||
return board.func_96510_d(player).get(objec) != null;
|
||||
}
|
||||
|
||||
public boolean hasPlayerObjective(IPlayer player, String objective, String datatag){
|
||||
return this.hasPlayerObjective(player.getName(),objective,datatag);
|
||||
}
|
||||
|
||||
/**
|
||||
* @version 1.8
|
||||
@@ -145,6 +158,10 @@ public class ScriptScoreboard implements IScoreboard {
|
||||
if(board.func_96510_d(player).remove(objec) != null)
|
||||
board.func_96516_a(player);
|
||||
}
|
||||
|
||||
public void deletePlayerScore(IPlayer player, String objective, String datatag){
|
||||
this.deletePlayerScore(player.getName(),objective,datatag);
|
||||
}
|
||||
|
||||
public IScoreboardTeam[] getTeams(){
|
||||
List<ScorePlayerTeam> list = new ArrayList<ScorePlayerTeam>(board.getTeams());
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import noppes.npcs.api.entity.IPlayer;
|
||||
import noppes.npcs.api.scoreboard.IScoreboardTeam;
|
||||
|
||||
public class ScriptScoreboardTeam implements IScoreboardTeam {
|
||||
@@ -35,10 +36,18 @@ public class ScriptScoreboardTeam implements IScoreboardTeam {
|
||||
public void addPlayer(String player){
|
||||
board.func_151392_a(player, getName());
|
||||
}
|
||||
|
||||
public void addPlayer(IPlayer player) {
|
||||
this.addPlayer(player.getName());
|
||||
}
|
||||
|
||||
public void removePlayer(String player){
|
||||
board.removePlayerFromTeam(player, team);
|
||||
}
|
||||
|
||||
public void removePlayer(IPlayer player) {
|
||||
this.removePlayer(player.getName());
|
||||
}
|
||||
|
||||
public String[] getPlayers(){
|
||||
List<String> list = new ArrayList<String>(team.getMembershipCollection());
|
||||
|
||||
Reference in new issue
Block a user