Merge branch 'scoreboard' of SteamWar/SpigotCore into master
Dieser Commit ist enthalten in:
Commit
98d5be1e07
@ -4,6 +4,8 @@ import net.minecraft.server.v1_10_R1.*;
|
|||||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard_10 {
|
public class SWScoreboard_10 {
|
||||||
@ -11,32 +13,42 @@ public class SWScoreboard_10 {
|
|||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
private Scoreboard scoreboard;
|
private Scoreboard scoreboard;
|
||||||
private ScoreboardObjective obj;
|
private ScoreboardObjective obj;
|
||||||
|
private int switcher;
|
||||||
|
|
||||||
public SWScoreboard_10(ScoreboardCallback callback) {
|
public SWScoreboard_10(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.scoreboard = new Scoreboard();
|
this.switcher = 0;
|
||||||
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
|
|
||||||
obj.setDisplayName(this.callback.getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
public void sendScoreboard(Player player) {
|
||||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
//Komplett neues Scoreboard
|
||||||
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
|
this.scoreboard = new Scoreboard();
|
||||||
|
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||||
|
obj.setDisplayName(this.callback.getTitle());
|
||||||
|
switcher();
|
||||||
|
|
||||||
sendPacket(player, removePacket);
|
//Packets senden
|
||||||
sendPacket(player, createpacket);
|
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
||||||
|
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
||||||
|
|
||||||
|
List<ScoreboardScore> scores = new ArrayList<>();
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
||||||
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
||||||
score.setScore(currentEntry.getValue());
|
score.setScore(currentEntry.getValue());
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(player, removePacket);
|
||||||
|
sendPacket(player, createpacket);
|
||||||
|
|
||||||
|
for(ScoreboardScore score : scores) {
|
||||||
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
||||||
sendPacket(player, scorePacket);
|
sendPacket(player, scorePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
public void display(Player player) {
|
||||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||||
sendPacket(player, displayPacket);
|
sendPacket(player, displayPacket);
|
||||||
}
|
}
|
||||||
@ -50,5 +62,11 @@ public class SWScoreboard_10 {
|
|||||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void switcher() {
|
||||||
|
switcher++;
|
||||||
|
if(switcher > 1)
|
||||||
|
switcher = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import net.minecraft.server.v1_12_R1.*;
|
|||||||
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard_12 {
|
public class SWScoreboard_12 {
|
||||||
@ -11,32 +13,42 @@ public class SWScoreboard_12 {
|
|||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
private Scoreboard scoreboard;
|
private Scoreboard scoreboard;
|
||||||
private ScoreboardObjective obj;
|
private ScoreboardObjective obj;
|
||||||
|
private int switcher;
|
||||||
|
|
||||||
public SWScoreboard_12(ScoreboardCallback callback) {
|
public SWScoreboard_12(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.scoreboard = new Scoreboard();
|
this.switcher = 0;
|
||||||
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
|
|
||||||
obj.setDisplayName(this.callback.getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
public void sendScoreboard(Player player) {
|
||||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
//Komplett neues Scoreboard
|
||||||
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
|
this.scoreboard = new Scoreboard();
|
||||||
|
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||||
|
obj.setDisplayName(this.callback.getTitle());
|
||||||
|
switcher();
|
||||||
|
|
||||||
sendPacket(player, removePacket);
|
//Packets senden
|
||||||
sendPacket(player, createpacket);
|
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
||||||
|
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
||||||
|
|
||||||
|
List<ScoreboardScore> scores = new ArrayList<>();
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
||||||
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
||||||
score.setScore(currentEntry.getValue());
|
score.setScore(currentEntry.getValue());
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(player, removePacket);
|
||||||
|
sendPacket(player, createpacket);
|
||||||
|
|
||||||
|
for(ScoreboardScore score : scores) {
|
||||||
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
||||||
sendPacket(player, scorePacket);
|
sendPacket(player, scorePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
public void display(Player player) {
|
||||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||||
sendPacket(player, displayPacket);
|
sendPacket(player, displayPacket);
|
||||||
}
|
}
|
||||||
@ -50,4 +62,10 @@ public class SWScoreboard_12 {
|
|||||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void switcher() {
|
||||||
|
switcher++;
|
||||||
|
if(switcher > 1)
|
||||||
|
switcher = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import net.minecraft.server.v1_14_R1.*;
|
|||||||
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard_14 {
|
public class SWScoreboard_14 {
|
||||||
@ -11,32 +13,42 @@ public class SWScoreboard_14 {
|
|||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
private Scoreboard scoreboard;
|
private Scoreboard scoreboard;
|
||||||
private ScoreboardObjective obj;
|
private ScoreboardObjective obj;
|
||||||
|
private int switcher;
|
||||||
|
|
||||||
public SWScoreboard_14(ScoreboardCallback callback) {
|
public SWScoreboard_14(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.scoreboard = new Scoreboard();
|
this.switcher = 0;
|
||||||
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.DUMMY, new ChatMessage("USELESS"), IScoreboardCriteria.EnumScoreboardHealthDisplay.HEARTS);
|
|
||||||
obj.setDisplayName(new ChatMessage(this.callback.getTitle()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
public void sendScoreboard(Player player) {
|
||||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
//Komplett neues Scoreboard
|
||||||
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
|
this.scoreboard = new Scoreboard();
|
||||||
|
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.DUMMY, new ChatMessage("USELESS"), IScoreboardCriteria.EnumScoreboardHealthDisplay.HEARTS);
|
||||||
|
obj.setDisplayName(new ChatMessage(this.callback.getTitle()));
|
||||||
|
switcher();
|
||||||
|
|
||||||
sendPacket(player, removePacket);
|
//Packets senden
|
||||||
sendPacket(player, createpacket);
|
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
||||||
|
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
||||||
|
|
||||||
|
List<ScoreboardScore> scores = new ArrayList<>();
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
||||||
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
||||||
score.setScore(currentEntry.getValue());
|
score.setScore(currentEntry.getValue());
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(player, removePacket);
|
||||||
|
sendPacket(player, createpacket);
|
||||||
|
|
||||||
|
for(ScoreboardScore score : scores) {
|
||||||
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, this.obj.getName(), score.getPlayerName(), score.getScore());
|
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, this.obj.getName(), score.getPlayerName(), score.getScore());
|
||||||
sendPacket(player, scorePacket);
|
sendPacket(player, scorePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
public void display(Player player) {
|
||||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||||
sendPacket(player, displayPacket);
|
sendPacket(player, displayPacket);
|
||||||
}
|
}
|
||||||
@ -50,4 +62,10 @@ public class SWScoreboard_14 {
|
|||||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void switcher() {
|
||||||
|
switcher++;
|
||||||
|
if(switcher > 1)
|
||||||
|
switcher = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import net.minecraft.server.v1_15_R1.*;
|
|||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard_15 {
|
public class SWScoreboard_15 {
|
||||||
@ -11,32 +13,42 @@ public class SWScoreboard_15 {
|
|||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
private Scoreboard scoreboard;
|
private Scoreboard scoreboard;
|
||||||
private ScoreboardObjective obj;
|
private ScoreboardObjective obj;
|
||||||
|
private int switcher;
|
||||||
|
|
||||||
public SWScoreboard_15(ScoreboardCallback callback) {
|
public SWScoreboard_15(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.scoreboard = new Scoreboard();
|
this.switcher = 0;
|
||||||
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.DUMMY, new ChatMessage("USELESS"), IScoreboardCriteria.EnumScoreboardHealthDisplay.HEARTS);
|
|
||||||
obj.setDisplayName(new ChatMessage(this.callback.getTitle()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
public void sendScoreboard(Player player) {
|
||||||
|
//Komplett neues Scoreboard
|
||||||
|
this.scoreboard = new Scoreboard();
|
||||||
|
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.DUMMY, new ChatMessage("USELESS"), IScoreboardCriteria.EnumScoreboardHealthDisplay.HEARTS);
|
||||||
|
obj.setDisplayName(new ChatMessage(this.callback.getTitle()));
|
||||||
|
switcher();
|
||||||
|
|
||||||
|
//Packets senden
|
||||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
||||||
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
||||||
|
|
||||||
sendPacket(player, removePacket);
|
List<ScoreboardScore> scores = new ArrayList<>();
|
||||||
sendPacket(player, createpacket);
|
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
||||||
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
||||||
score.setScore(currentEntry.getValue());
|
score.setScore(currentEntry.getValue());
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(player, removePacket);
|
||||||
|
sendPacket(player, createpacket);
|
||||||
|
|
||||||
|
for(ScoreboardScore score : scores) {
|
||||||
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, this.obj.getName(), score.getPlayerName(), score.getScore());
|
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, this.obj.getName(), score.getPlayerName(), score.getScore());
|
||||||
sendPacket(player, scorePacket);
|
sendPacket(player, scorePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
public void display(Player player) {
|
||||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||||
sendPacket(player, displayPacket);
|
sendPacket(player, displayPacket);
|
||||||
}
|
}
|
||||||
@ -50,4 +62,10 @@ public class SWScoreboard_15 {
|
|||||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void switcher() {
|
||||||
|
switcher++;
|
||||||
|
if(switcher > 1)
|
||||||
|
switcher = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import net.minecraft.server.v1_8_R3.*;
|
|||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard_8 {
|
public class SWScoreboard_8 {
|
||||||
@ -11,32 +13,42 @@ public class SWScoreboard_8 {
|
|||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
private Scoreboard scoreboard;
|
private Scoreboard scoreboard;
|
||||||
private ScoreboardObjective obj;
|
private ScoreboardObjective obj;
|
||||||
|
private int switcher;
|
||||||
|
|
||||||
public SWScoreboard_8(ScoreboardCallback callback) {
|
public SWScoreboard_8(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.scoreboard = new Scoreboard();
|
this.switcher = 0;
|
||||||
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
|
|
||||||
obj.setDisplayName(this.callback.getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
public void sendScoreboard(Player player) {
|
||||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
//Komplett neues Scoreboard
|
||||||
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
|
this.scoreboard = new Scoreboard();
|
||||||
|
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||||
|
obj.setDisplayName(this.callback.getTitle());
|
||||||
|
switcher();
|
||||||
|
|
||||||
sendPacket(player, removePacket);
|
//Packets senden
|
||||||
sendPacket(player, createpacket);
|
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
||||||
|
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
||||||
|
|
||||||
|
List<ScoreboardScore> scores = new ArrayList<>();
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
||||||
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
||||||
score.setScore(currentEntry.getValue());
|
score.setScore(currentEntry.getValue());
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(player, removePacket);
|
||||||
|
sendPacket(player, createpacket);
|
||||||
|
|
||||||
|
for(ScoreboardScore score : scores) {
|
||||||
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
||||||
sendPacket(player, scorePacket);
|
sendPacket(player, scorePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
public void display(Player player) {
|
||||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||||
sendPacket(player, displayPacket);
|
sendPacket(player, displayPacket);
|
||||||
}
|
}
|
||||||
@ -50,4 +62,10 @@ public class SWScoreboard_8 {
|
|||||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void switcher() {
|
||||||
|
switcher++;
|
||||||
|
if(switcher > 1)
|
||||||
|
switcher = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import net.minecraft.server.v1_9_R2.*;
|
|||||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class SWScoreboard_9 {
|
public class SWScoreboard_9 {
|
||||||
@ -11,32 +13,42 @@ public class SWScoreboard_9 {
|
|||||||
ScoreboardCallback callback;
|
ScoreboardCallback callback;
|
||||||
private Scoreboard scoreboard;
|
private Scoreboard scoreboard;
|
||||||
private ScoreboardObjective obj;
|
private ScoreboardObjective obj;
|
||||||
|
private int switcher;
|
||||||
|
|
||||||
public SWScoreboard_9(ScoreboardCallback callback) {
|
public SWScoreboard_9(ScoreboardCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
this.scoreboard = new Scoreboard();
|
this.switcher = 0;
|
||||||
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
|
|
||||||
obj.setDisplayName(this.callback.getTitle());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendScoreboard(Player player) {
|
public void sendScoreboard(Player player) {
|
||||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
//Komplett neues Scoreboard
|
||||||
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
|
this.scoreboard = new Scoreboard();
|
||||||
|
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||||
|
obj.setDisplayName(this.callback.getTitle());
|
||||||
|
switcher();
|
||||||
|
|
||||||
sendPacket(player, removePacket);
|
//Packets senden
|
||||||
sendPacket(player, createpacket);
|
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(obj, 1);
|
||||||
|
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
|
||||||
|
|
||||||
|
List<ScoreboardScore> scores = new ArrayList<>();
|
||||||
|
|
||||||
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
|
||||||
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
|
||||||
score.setScore(currentEntry.getValue());
|
score.setScore(currentEntry.getValue());
|
||||||
|
scores.add(score);
|
||||||
|
}
|
||||||
|
|
||||||
|
sendPacket(player, removePacket);
|
||||||
|
sendPacket(player, createpacket);
|
||||||
|
|
||||||
|
for(ScoreboardScore score : scores) {
|
||||||
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
|
||||||
sendPacket(player, scorePacket);
|
sendPacket(player, scorePacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
display(player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Player player) {
|
public void display(Player player) {
|
||||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||||
sendPacket(player, displayPacket);
|
sendPacket(player, displayPacket);
|
||||||
}
|
}
|
||||||
@ -50,4 +62,10 @@ public class SWScoreboard_9 {
|
|||||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void switcher() {
|
||||||
|
switcher++;
|
||||||
|
if(switcher > 1)
|
||||||
|
switcher = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,10 @@ public class SWScoreboard {
|
|||||||
if(!playerBoards.containsKey(player))
|
if(!playerBoards.containsKey(player))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
playerBoards.remove(player);
|
||||||
|
if(player == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
switch (Core.getVersion()) {
|
switch (Core.getVersion()) {
|
||||||
case 8:
|
case 8:
|
||||||
((SWScoreboard_8) playerBoards.get(player)).deleteScoreboard(player);
|
((SWScoreboard_8) playerBoards.get(player)).deleteScoreboard(player);
|
||||||
@ -67,7 +71,6 @@ public class SWScoreboard {
|
|||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
playerBoards.remove(player);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,22 +81,34 @@ public class SWScoreboard {
|
|||||||
for(Map.Entry<Player, Object> entry : playerBoards.entrySet()) {
|
for(Map.Entry<Player, Object> entry : playerBoards.entrySet()) {
|
||||||
switch (Core.getVersion()) {
|
switch (Core.getVersion()) {
|
||||||
case 8:
|
case 8:
|
||||||
((SWScoreboard_8) entry.getValue()).sendScoreboard(entry.getKey());
|
SWScoreboard_8 swScoreboard_8 = (SWScoreboard_8) entry.getValue();
|
||||||
|
swScoreboard_8.sendScoreboard(entry.getKey());
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_8.display(entry.getKey()), 2);
|
||||||
break;
|
break;
|
||||||
case 9:
|
case 9:
|
||||||
((SWScoreboard_9) entry.getValue()).sendScoreboard(entry.getKey());
|
SWScoreboard_9 swScoreboard_9 = (SWScoreboard_9) entry.getValue();
|
||||||
|
swScoreboard_9.sendScoreboard(entry.getKey());
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_9.display(entry.getKey()), 2);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
((SWScoreboard_10) entry.getValue()).sendScoreboard(entry.getKey());
|
SWScoreboard_10 swScoreboard_10 = (SWScoreboard_10) entry.getValue();
|
||||||
|
swScoreboard_10.sendScoreboard(entry.getKey());
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_10.display(entry.getKey()), 2);
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
((SWScoreboard_12) entry.getValue()).sendScoreboard(entry.getKey());
|
SWScoreboard_12 swScoreboard_12 = (SWScoreboard_12) entry.getValue();
|
||||||
|
swScoreboard_12.sendScoreboard(entry.getKey());
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_12.display(entry.getKey()), 2);
|
||||||
break;
|
break;
|
||||||
case 14:
|
case 14:
|
||||||
((SWScoreboard_14) entry.getValue()).sendScoreboard(entry.getKey());
|
SWScoreboard_14 swScoreboard_14 = (SWScoreboard_14) entry.getValue();
|
||||||
|
swScoreboard_14.sendScoreboard(entry.getKey());
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_14.display(entry.getKey()), 2);
|
||||||
break;
|
break;
|
||||||
case 15:
|
case 15:
|
||||||
((SWScoreboard_15) entry.getValue()).sendScoreboard(entry.getKey());
|
SWScoreboard_15 swScoreboard_15 = (SWScoreboard_15) entry.getValue();
|
||||||
|
swScoreboard_15.sendScoreboard(entry.getKey());
|
||||||
|
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_15.display(entry.getKey()), 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren