SteamWar/SpigotCore
Archiviert
13
0

complete rework

Dieser Commit ist enthalten in:
Yaruma3341 2020-01-11 17:31:38 +01:00
Ursprung 13d6ebbe67
Commit fce272f366
7 geänderte Dateien mit 188 neuen und 65 gelöschten Zeilen

Datei anzeigen

@ -4,6 +4,8 @@ import net.minecraft.server.v1_10_R1.*;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SWScoreboard_10 {
@ -11,32 +13,42 @@ public class SWScoreboard_10 {
ScoreboardCallback callback;
private Scoreboard scoreboard;
private ScoreboardObjective obj;
private int switcher;
public SWScoreboard_10(ScoreboardCallback callback) {
this.callback = callback;
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
this.switcher = 0;
}
public void sendScoreboard(Player player) {
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
//Komplett neues Scoreboard
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
switcher();
sendPacket(player, removePacket);
sendPacket(player, createpacket);
//Packets senden
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()) {
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
score.setScore(currentEntry.getValue());
scores.add(score);
}
sendPacket(player, removePacket);
sendPacket(player, createpacket);
for(ScoreboardScore score : scores) {
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
sendPacket(player, scorePacket);
}
display(player);
}
private void display(Player player) {
public void display(Player player) {
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
sendPacket(player, displayPacket);
}
@ -50,5 +62,11 @@ public class SWScoreboard_10 {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}
private void switcher() {
switcher++;
if(switcher > 1)
switcher = 0;
}
}

Datei anzeigen

@ -4,6 +4,8 @@ import net.minecraft.server.v1_12_R1.*;
import org.bukkit.craftbukkit.v1_12_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SWScoreboard_12 {
@ -11,32 +13,42 @@ public class SWScoreboard_12 {
ScoreboardCallback callback;
private Scoreboard scoreboard;
private ScoreboardObjective obj;
private int switcher;
public SWScoreboard_12(ScoreboardCallback callback) {
this.callback = callback;
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
this.switcher = 0;
}
public void sendScoreboard(Player player) {
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
//Komplett neues Scoreboard
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
switcher();
sendPacket(player, removePacket);
sendPacket(player, createpacket);
//Packets senden
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()) {
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
score.setScore(currentEntry.getValue());
scores.add(score);
}
sendPacket(player, removePacket);
sendPacket(player, createpacket);
for(ScoreboardScore score : scores) {
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
sendPacket(player, scorePacket);
}
display(player);
}
private void display(Player player) {
public void display(Player player) {
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
sendPacket(player, displayPacket);
}
@ -50,4 +62,10 @@ public class SWScoreboard_12 {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}
private void switcher() {
switcher++;
if(switcher > 1)
switcher = 0;
}
}

Datei anzeigen

@ -4,6 +4,8 @@ import net.minecraft.server.v1_14_R1.*;
import org.bukkit.craftbukkit.v1_14_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SWScoreboard_14 {
@ -11,32 +13,42 @@ public class SWScoreboard_14 {
ScoreboardCallback callback;
private Scoreboard scoreboard;
private ScoreboardObjective obj;
private int switcher;
public SWScoreboard_14(ScoreboardCallback callback) {
this.callback = callback;
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.DUMMY, new ChatMessage("USELESS"), IScoreboardCriteria.EnumScoreboardHealthDisplay.HEARTS);
obj.setDisplayName(new ChatMessage(this.callback.getTitle()));
this.switcher = 0;
}
public void sendScoreboard(Player player) {
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
//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();
sendPacket(player, removePacket);
sendPacket(player, createpacket);
//Packets senden
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()) {
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
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());
sendPacket(player, scorePacket);
}
display(player);
}
private void display(Player player) {
public void display(Player player) {
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
sendPacket(player, displayPacket);
}
@ -50,4 +62,10 @@ public class SWScoreboard_14 {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}
private void switcher() {
switcher++;
if(switcher > 1)
switcher = 0;
}
}

Datei anzeigen

@ -4,6 +4,8 @@ import net.minecraft.server.v1_15_R1.*;
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SWScoreboard_15 {
@ -11,32 +13,42 @@ public class SWScoreboard_15 {
ScoreboardCallback callback;
private Scoreboard scoreboard;
private ScoreboardObjective obj;
private int switcher;
public SWScoreboard_15(ScoreboardCallback callback) {
this.callback = callback;
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.DUMMY, new ChatMessage("USELESS"), IScoreboardCriteria.EnumScoreboardHealthDisplay.HEARTS);
obj.setDisplayName(new ChatMessage(this.callback.getTitle()));
this.switcher = 0;
}
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 createpacket = new PacketPlayOutScoreboardObjective(obj, 0);
sendPacket(player, removePacket);
sendPacket(player, createpacket);
List<ScoreboardScore> scores = new ArrayList<>();
for(Map.Entry<String, Integer> currentEntry : this.callback.getData().entrySet()) {
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
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());
sendPacket(player, scorePacket);
}
display(player);
}
private void display(Player player) {
public void display(Player player) {
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
sendPacket(player, displayPacket);
}
@ -50,4 +62,10 @@ public class SWScoreboard_15 {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}
private void switcher() {
switcher++;
if(switcher > 1)
switcher = 0;
}
}

Datei anzeigen

@ -4,6 +4,8 @@ import net.minecraft.server.v1_8_R3.*;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SWScoreboard_8 {
@ -11,32 +13,42 @@ public class SWScoreboard_8 {
ScoreboardCallback callback;
private Scoreboard scoreboard;
private ScoreboardObjective obj;
private int switcher;
public SWScoreboard_8(ScoreboardCallback callback) {
this.callback = callback;
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
this.switcher = 0;
}
public void sendScoreboard(Player player) {
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
//Komplett neues Scoreboard
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
switcher();
sendPacket(player, removePacket);
sendPacket(player, createpacket);
//Packets senden
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()) {
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
score.setScore(currentEntry.getValue());
scores.add(score);
}
sendPacket(player, removePacket);
sendPacket(player, createpacket);
for(ScoreboardScore score : scores) {
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
sendPacket(player, scorePacket);
}
display(player);
}
private void display(Player player) {
public void display(Player player) {
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
sendPacket(player, displayPacket);
}
@ -50,4 +62,10 @@ public class SWScoreboard_8 {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}
private void switcher() {
switcher++;
if(switcher > 1)
switcher = 0;
}
}

Datei anzeigen

@ -4,6 +4,8 @@ import net.minecraft.server.v1_9_R2.*;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SWScoreboard_9 {
@ -11,32 +13,42 @@ public class SWScoreboard_9 {
ScoreboardCallback callback;
private Scoreboard scoreboard;
private ScoreboardObjective obj;
private int switcher;
public SWScoreboard_9(ScoreboardCallback callback) {
this.callback = callback;
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord", IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
this.switcher = 0;
}
public void sendScoreboard(Player player) {
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
PacketPlayOutScoreboardObjective createpacket = new PacketPlayOutScoreboardObjective(this.obj, 0);
//Komplett neues Scoreboard
this.scoreboard = new Scoreboard();
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
obj.setDisplayName(this.callback.getTitle());
switcher();
sendPacket(player, removePacket);
sendPacket(player, createpacket);
//Packets senden
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()) {
ScoreboardScore score = new ScoreboardScore(this.scoreboard, this.obj, currentEntry.getKey());
score.setScore(currentEntry.getValue());
scores.add(score);
}
sendPacket(player, removePacket);
sendPacket(player, createpacket);
for(ScoreboardScore score : scores) {
PacketPlayOutScoreboardScore scorePacket = new PacketPlayOutScoreboardScore(score);
sendPacket(player, scorePacket);
}
display(player);
}
private void display(Player player) {
public void display(Player player) {
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
sendPacket(player, displayPacket);
}
@ -50,4 +62,10 @@ public class SWScoreboard_9 {
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
}
private void switcher() {
switcher++;
if(switcher > 1)
switcher = 0;
}
}

Datei anzeigen

@ -45,6 +45,10 @@ public class SWScoreboard {
if(!playerBoards.containsKey(player))
return false;
playerBoards.remove(player);
if(player == null)
return true;
switch (Core.getVersion()) {
case 8:
((SWScoreboard_8) playerBoards.get(player)).deleteScoreboard(player);
@ -67,7 +71,6 @@ public class SWScoreboard {
default:
return false;
}
playerBoards.remove(player);
return true;
}
@ -78,22 +81,34 @@ public class SWScoreboard {
for(Map.Entry<Player, Object> entry : playerBoards.entrySet()) {
switch (Core.getVersion()) {
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;
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;
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;
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;
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;
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;
}
}