Rework SWScoreboard to ProtocolLib and remove unneccassary VersionDependents #72
@ -1,39 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
class SWItem_10 {
|
||||
private SWItem_10(){}
|
||||
|
||||
static Material getMaterial(String material){
|
||||
return SWItem_8.getMaterial(material);
|
||||
}
|
||||
|
||||
static Material getDye(){
|
||||
return SWItem_8.getDye();
|
||||
}
|
||||
|
||||
static ItemStack setSkullOwner(String player){
|
||||
return SWItem_8.setSkullOwner(player);
|
||||
}
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
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 {
|
||||
|
||||
ScoreboardCallback callback;
|
||||
private Scoreboard scoreboard;
|
||||
private ScoreboardObjective obj;
|
||||
private int switcher;
|
||||
|
||||
public SWScoreboard_10(ScoreboardCallback callback) {
|
||||
this.callback = callback;
|
||||
this.switcher = 0;
|
||||
}
|
||||
|
||||
public void sendScoreboard(Player player) {
|
||||
//Komplett neues Scoreboard
|
||||
this.scoreboard = new Scoreboard();
|
||||
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||
obj.setDisplayName(this.callback.getTitle());
|
||||
switcher();
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(Player player) {
|
||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||
sendPacket(player, displayPacket);
|
||||
}
|
||||
|
||||
public void deleteScoreboard(Player player) {
|
||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
||||
sendPacket(player, removePacket);
|
||||
}
|
||||
|
||||
private void sendPacket(Player p, Packet<?> packet) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private void switcher() {
|
||||
switcher++;
|
||||
if(switcher > 1)
|
||||
switcher = 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.sql;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
class Schematic_10 {
|
||||
private Schematic_10(){}
|
||||
|
||||
static byte[] getPlayerClipboard(Player player) throws IOException, NoClipboardException {
|
||||
return Schematic_8.getPlayerClipboard(player);
|
||||
}
|
||||
|
||||
static void setPlayerClipboard(Player player, InputStream is, boolean schemVersion) throws IOException {
|
||||
Schematic_8.setPlayerClipboard(player, is, schemVersion);
|
||||
}
|
||||
|
||||
static Clipboard getClipboard(InputStream is, boolean schemVersion) throws IOException {
|
||||
return Schematic_8.getClipboard(is, schemVersion);
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
class SWItem_12 {
|
||||
private SWItem_12(){}
|
||||
|
||||
static Material getMaterial(String material){
|
||||
return SWItem_8.getMaterial(material);
|
||||
}
|
||||
|
||||
static Material getDye(){
|
||||
return SWItem_8.getDye();
|
||||
}
|
||||
|
||||
static ItemStack setSkullOwner(String player){
|
||||
return SWItem_8.setSkullOwner(player);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
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 {
|
||||
|
||||
ScoreboardCallback callback;
|
||||
private Scoreboard scoreboard;
|
||||
private ScoreboardObjective obj;
|
||||
private int switcher;
|
||||
|
||||
public SWScoreboard_12(ScoreboardCallback callback) {
|
||||
this.callback = callback;
|
||||
this.switcher = 0;
|
||||
}
|
||||
|
||||
public void sendScoreboard(Player player) {
|
||||
//Komplett neues Scoreboard
|
||||
this.scoreboard = new Scoreboard();
|
||||
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||
obj.setDisplayName(this.callback.getTitle());
|
||||
switcher();
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(Player player) {
|
||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||
sendPacket(player, displayPacket);
|
||||
}
|
||||
|
||||
public void deleteScoreboard(Player player) {
|
||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
||||
sendPacket(player, removePacket);
|
||||
}
|
||||
|
||||
private void sendPacket(Player p, Packet<?> packet) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private void switcher() {
|
||||
switcher++;
|
||||
if(switcher > 1)
|
||||
switcher = 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.sql;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
class Schematic_12 {
|
||||
private Schematic_12(){}
|
||||
|
||||
static byte[] getPlayerClipboard(Player player) throws IOException, NoClipboardException {
|
||||
return Schematic_8.getPlayerClipboard(player);
|
||||
}
|
||||
|
||||
static void setPlayerClipboard(Player player, InputStream is, boolean schemVersion) throws IOException {
|
||||
Schematic_8.setPlayerClipboard(player, is, schemVersion);
|
||||
}
|
||||
|
||||
static Clipboard getClipboard(InputStream is, boolean schemVersion) throws IOException {
|
||||
return Schematic_8.getClipboard(is, schemVersion);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
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 {
|
||||
|
||||
ScoreboardCallback callback;
|
||||
private Scoreboard scoreboard;
|
||||
private ScoreboardObjective obj;
|
||||
private int switcher;
|
||||
|
||||
public SWScoreboard_14(ScoreboardCallback callback) {
|
||||
this.callback = callback;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(Player player) {
|
||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||
sendPacket(player, displayPacket);
|
||||
}
|
||||
|
||||
public void deleteScoreboard(Player player) {
|
||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
||||
sendPacket(player, removePacket);
|
||||
}
|
||||
|
||||
private void sendPacket(Player p, Packet<?> packet) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private void switcher() {
|
||||
switcher++;
|
||||
if(switcher > 1)
|
||||
switcher = 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
class SWItem_15 {
|
||||
private SWItem_15(){}
|
||||
|
||||
static Material getMaterial(String material) {
|
||||
return SWItem_14.getMaterial(material);
|
||||
}
|
||||
|
||||
static Material getDye(int colorCode){
|
||||
return SWItem_14.getDye(colorCode);
|
||||
}
|
||||
|
||||
static ItemStack setSkullOwner(String player){
|
||||
return SWItem_14.setSkullOwner(player);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
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 {
|
||||
|
||||
ScoreboardCallback callback;
|
||||
private Scoreboard scoreboard;
|
||||
private ScoreboardObjective obj;
|
||||
private int switcher;
|
||||
|
||||
public SWScoreboard_15(ScoreboardCallback callback) {
|
||||
this.callback = callback;
|
||||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(Player player) {
|
||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||
sendPacket(player, displayPacket);
|
||||
}
|
||||
|
||||
public void deleteScoreboard(Player player) {
|
||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
||||
sendPacket(player, removePacket);
|
||||
}
|
||||
|
||||
private void sendPacket(Player p, Packet<?> packet) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private void switcher() {
|
||||
switcher++;
|
||||
if(switcher > 1)
|
||||
switcher = 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.sql;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
class Schematic_15 {
|
||||
private Schematic_15(){}
|
||||
|
||||
static byte[] getPlayerClipboard(Player player, boolean schemFormat) throws IOException, NoClipboardException {
|
||||
return Schematic_14.getPlayerClipboard(player, schemFormat);
|
||||
}
|
||||
|
||||
static void setPlayerClipboard(Player player, InputStream is, boolean schemFormat) throws IOException, NoClipboardException {
|
||||
Schematic_14.setPlayerClipboard(player, is, schemFormat);
|
||||
}
|
||||
|
||||
static Clipboard getClipboard(InputStream is, boolean schemFormat) throws IOException, NoClipboardException {
|
||||
return Schematic_14.getClipboard(is, schemFormat);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
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 {
|
||||
|
||||
ScoreboardCallback callback;
|
||||
private Scoreboard scoreboard;
|
||||
private ScoreboardObjective obj;
|
||||
private int switcher;
|
||||
|
||||
public SWScoreboard_8(ScoreboardCallback callback) {
|
||||
this.callback = callback;
|
||||
this.switcher = 0;
|
||||
}
|
||||
|
||||
public void sendScoreboard(Player player) {
|
||||
//Komplett neues Scoreboard
|
||||
this.scoreboard = new Scoreboard();
|
||||
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||
obj.setDisplayName(this.callback.getTitle());
|
||||
switcher();
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(Player player) {
|
||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||
sendPacket(player, displayPacket);
|
||||
}
|
||||
|
||||
public void deleteScoreboard(Player player) {
|
||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
||||
sendPacket(player, removePacket);
|
||||
}
|
||||
|
||||
private void sendPacket(Player p, Packet<?> packet) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private void switcher() {
|
||||
switcher++;
|
||||
if(switcher > 1)
|
||||
switcher = 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.inventory;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
class SWItem_9 {
|
||||
private SWItem_9(){}
|
||||
|
||||
static Material getMaterial(String material){
|
||||
return SWItem_8.getMaterial(material);
|
||||
}
|
||||
|
||||
static Material getDye(){
|
||||
return SWItem_8.getDye();
|
||||
}
|
||||
|
||||
static ItemStack setSkullOwner(String player){
|
||||
return SWItem_8.setSkullOwner(player);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
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 {
|
||||
|
||||
ScoreboardCallback callback;
|
||||
private Scoreboard scoreboard;
|
||||
private ScoreboardObjective obj;
|
||||
private int switcher;
|
||||
|
||||
public SWScoreboard_9(ScoreboardCallback callback) {
|
||||
this.callback = callback;
|
||||
this.switcher = 0;
|
||||
}
|
||||
|
||||
public void sendScoreboard(Player player) {
|
||||
//Komplett neues Scoreboard
|
||||
this.scoreboard = new Scoreboard();
|
||||
this.obj = this.scoreboard.registerObjective("MainBord" + switcher, IScoreboardCriteria.b);
|
||||
obj.setDisplayName(this.callback.getTitle());
|
||||
switcher();
|
||||
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
||||
public void display(Player player) {
|
||||
PacketPlayOutScoreboardDisplayObjective displayPacket = new PacketPlayOutScoreboardDisplayObjective(1, this.obj);
|
||||
sendPacket(player, displayPacket);
|
||||
}
|
||||
|
||||
public void deleteScoreboard(Player player) {
|
||||
PacketPlayOutScoreboardObjective removePacket = new PacketPlayOutScoreboardObjective(this.obj, 1);
|
||||
sendPacket(player, removePacket);
|
||||
}
|
||||
|
||||
private void sendPacket(Player p, Packet<?> packet) {
|
||||
((CraftPlayer)p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
private void switcher() {
|
||||
switcher++;
|
||||
if(switcher > 1)
|
||||
switcher = 0;
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
This file is a part of the SteamWar software.
|
||||
|
||||
Copyright (C) 2020 SteamWar.de-Serverteam
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package de.steamwar.sql;
|
||||
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
class Schematic_9 {
|
||||
private Schematic_9(){}
|
||||
|
||||
static byte[] getPlayerClipboard(Player player) throws IOException, NoClipboardException {
|
||||
return Schematic_8.getPlayerClipboard(player);
|
||||
}
|
||||
|
||||
static void setPlayerClipboard(Player player, InputStream is, boolean schemVersion) throws IOException {
|
||||
Schematic_8.setPlayerClipboard(player, is, schemVersion);
|
||||
}
|
||||
|
||||
static Clipboard getClipboard(InputStream is, boolean schemVersion) throws IOException {
|
||||
return Schematic_8.getClipboard(is, schemVersion);
|
||||
}
|
||||
}
|
@ -29,4 +29,14 @@
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>steamwar</groupId>
|
||||
<artifactId>Spigot</artifactId>
|
||||
<version>1.15</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${main.basedir}/lib/Spigot-1.15.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -47,22 +47,15 @@ public class SWItem {
|
||||
ItemStack head;
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 12:
|
||||
head = SWItem_8.setSkullOwner(playerName);
|
||||
break;
|
||||
case 9:
|
||||
head = SWItem_9.setSkullOwner(playerName);
|
||||
break;
|
||||
case 10:
|
||||
head = SWItem_10.setSkullOwner(playerName);
|
||||
break;
|
||||
case 14:
|
||||
head = SWItem_14.setSkullOwner(playerName);
|
||||
break;
|
||||
case 15:
|
||||
head = SWItem_15.setSkullOwner(playerName);
|
||||
break;
|
||||
default:
|
||||
head = SWItem_12.setSkullOwner(playerName);
|
||||
head = SWItem_14.setSkullOwner(playerName);
|
||||
}
|
||||
p.setItemStack(head);
|
||||
return p;
|
||||
@ -72,17 +65,14 @@ public class SWItem {
|
||||
try{
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
return SWItem_8.getMaterial(material);
|
||||
case 9:
|
||||
return SWItem_9.getMaterial(material);
|
||||
case 10:
|
||||
return SWItem_10.getMaterial(material);
|
||||
case 12:
|
||||
return SWItem_8.getMaterial(material);
|
||||
case 14:
|
||||
return SWItem_14.getMaterial(material);
|
||||
case 15:
|
||||
return SWItem_15.getMaterial(material);
|
||||
default:
|
||||
return SWItem_12.getMaterial(material);
|
||||
return SWItem_14.getMaterial(material);
|
||||
}
|
||||
}catch(IllegalArgumentException e){
|
||||
return Material.STONE;
|
||||
@ -92,17 +82,14 @@ public class SWItem {
|
||||
public static Material getDye(int colorCode){
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
return SWItem_8.getDye();
|
||||
case 9:
|
||||
return SWItem_9.getDye();
|
||||
case 10:
|
||||
return SWItem_10.getDye();
|
||||
case 12:
|
||||
return SWItem_8.getDye();
|
||||
case 14:
|
||||
return SWItem_14.getDye(colorCode);
|
||||
case 15:
|
||||
return SWItem_15.getDye(colorCode);
|
||||
default:
|
||||
return SWItem_12.getDye();
|
||||
return SWItem_14.getDye(colorCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,118 +19,106 @@
|
||||
|
||||
package de.steamwar.scoreboard;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
import de.steamwar.core.Core;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.RenderType;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SWScoreboard {
|
||||
private SWScoreboard() {}
|
||||
|
||||
private SWScoreboard() { }
|
||||
private static final HashMap<Player, ScoreboardCallback> playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map!
|
||||
private static int toggle = 0;
|
||||
|
||||
private static HashMap<Player, Object> playerBoards = new HashMap<>(); //Object -> Scoreboard | Alle Versionen in der Map!
|
||||
private static final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
private static final String SIDEBAR = "Sidebar";
|
||||
private static final PacketContainer[] DELETE_SCOREBOARD = new PacketContainer[2];
|
||||
private static final PacketContainer[] DISPLAY_SIDEBAR = new PacketContainer[2];
|
||||
|
||||
public static boolean createScoreboard(Player player, ScoreboardCallback callback) {
|
||||
Object swScoreboardObject;
|
||||
switch (Core.getVersion()) {
|
||||
case 8:
|
||||
swScoreboardObject = new SWScoreboard_8(callback);
|
||||
break;
|
||||
case 9:
|
||||
swScoreboardObject = new SWScoreboard_9(callback);
|
||||
break;
|
||||
case 10:
|
||||
swScoreboardObject = new SWScoreboard_10(callback);
|
||||
break;
|
||||
case 12:
|
||||
swScoreboardObject = new SWScoreboard_12(callback);
|
||||
break;
|
||||
case 14:
|
||||
swScoreboardObject = new SWScoreboard_14(callback);
|
||||
break;
|
||||
case 15:
|
||||
swScoreboardObject = new SWScoreboard_15(callback);
|
||||
break;
|
||||
default:
|
||||
return false; //Kein Scoreboard senden
|
||||
}
|
||||
playerBoards.put(player, swScoreboardObject);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void removeScoreboard(Player player) {
|
||||
if(!playerBoards.containsKey(player))
|
||||
return;
|
||||
|
||||
try{
|
||||
switch (Core.getVersion()) {
|
||||
case 8:
|
||||
((SWScoreboard_8) playerBoards.get(player)).deleteScoreboard(player);
|
||||
break;
|
||||
case 9:
|
||||
((SWScoreboard_9) playerBoards.get(player)).deleteScoreboard(player);
|
||||
break;
|
||||
case 10:
|
||||
((SWScoreboard_10) playerBoards.get(player)).deleteScoreboard(player);
|
||||
break;
|
||||
case 12:
|
||||
((SWScoreboard_12) playerBoards.get(player)).deleteScoreboard(player);
|
||||
break;
|
||||
case 14:
|
||||
((SWScoreboard_14) playerBoards.get(player)).deleteScoreboard(player);
|
||||
break;
|
||||
case 15:
|
||||
((SWScoreboard_15) playerBoards.get(player)).deleteScoreboard(player);
|
||||
break;
|
||||
}
|
||||
}catch(NullPointerException e){
|
||||
//ignored
|
||||
}
|
||||
playerBoards.remove(player);
|
||||
}
|
||||
|
||||
//Scoreboard Updater
|
||||
static {
|
||||
Bukkit.getScheduler().scheduleAsyncRepeatingTask(Core.getInstance(), () -> {
|
||||
synchronized (playerBoards) {
|
||||
for(Map.Entry<Player, Object> entry : playerBoards.entrySet()) {
|
||||
switch (Core.getVersion()) {
|
||||
case 8:
|
||||
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 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 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 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 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 swScoreboard_15 = (SWScoreboard_15) entry.getValue();
|
||||
swScoreboard_15.sendScoreboard(entry.getKey());
|
||||
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> swScoreboard_15.display(entry.getKey()), 2);
|
||||
break;
|
||||
setScoreboardConstants(0);
|
||||
setScoreboardConstants(1);
|
||||
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> {
|
||||
toggle ^= 1; // Toggle between 0 and 1
|
||||
Chaoscaot
hat
Was macht dieses toggle? Was macht dieses toggle?
|
||||
|
||||
for(Map.Entry<Player, ScoreboardCallback> scoreboard : playerBoards.entrySet()) {
|
||||
Player player = scoreboard.getKey();
|
||||
ScoreboardCallback callback = scoreboard.getValue();
|
||||
try {
|
||||
manager.sendServerPacket(player, DELETE_SCOREBOARD[toggle]);
|
||||
manager.sendServerPacket(player, createSidebarPacket(callback.getTitle()));
|
||||
for(Map.Entry<String, Integer> score : callback.getData().entrySet()){
|
||||
manager.sendServerPacket(player, createScorePacket(score.getKey(), score.getValue()));
|
||||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new SecurityException("Could not send scoreboard packets", e);
|
||||
}
|
||||
Bukkit.getScheduler().runTaskLater(Core.getInstance(), () -> {
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, DISPLAY_SIDEBAR[toggle]);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new SecurityException("Could not send DISPLAY_SIDEBAR", e);
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
}, 10, 5);
|
||||
}
|
||||
|
||||
public static boolean createScoreboard(Player player, ScoreboardCallback callback) {
|
||||
playerBoards.put(player, callback);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void removeScoreboard(Player player) {
|
||||
if(playerBoards.remove(player) == null)
|
||||
return;
|
||||
|
||||
try {
|
||||
ProtocolLibrary.getProtocolManager().sendServerPacket(player, DELETE_SCOREBOARD[toggle]);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new SecurityException("Could not send DELETE_PACKET", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static PacketContainer createSidebarPacket(String name){
|
||||
PacketContainer packet = manager.createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||
packet.getStrings().write(0, SIDEBAR + toggle);
|
||||
packet.getIntegers().write(0, 0); //0 to create
|
||||
packet.getChatComponents().write(0, WrappedChatComponent.fromText(name));
|
||||
packet.getEnumModifier(RenderType.class, 2).write(0, RenderType.INTEGER);
|
||||
return packet;
|
||||
}
|
||||
|
||||
private static PacketContainer createScorePacket(String name, int value){
|
||||
PacketContainer packet = manager.createPacket(PacketType.Play.Server.SCOREBOARD_SCORE);
|
||||
packet.getStrings().write(0, name);
|
||||
packet.getIntegers().write(0, value);
|
||||
packet.getStrings().write(1, SIDEBAR + toggle);
|
||||
packet.getEnumModifier(Action.class, 3).write(0, Action.CHANGE);
|
||||
return packet;
|
||||
}
|
||||
|
||||
private enum Action{
|
||||
CHANGE,
|
||||
REMOVE
|
||||
}
|
||||
|
||||
private static void setScoreboardConstants(int id){
|
||||
DELETE_SCOREBOARD[id] = manager.createPacket(PacketType.Play.Server.SCOREBOARD_OBJECTIVE);
|
||||
DELETE_SCOREBOARD[id].getStrings().write(0, SIDEBAR + id);
|
||||
DELETE_SCOREBOARD[id].getIntegers().write(0, 1); //1 to remove
|
||||
|
||||
DISPLAY_SIDEBAR[id] = manager.createPacket(PacketType.Play.Server.SCOREBOARD_DISPLAY_OBJECTIVE);
|
||||
DISPLAY_SIDEBAR[id].getStrings().write(0, SIDEBAR + id);
|
||||
DISPLAY_SIDEBAR[id].getIntegers().write(0, 1); // 1 = Sidebar
|
||||
}
|
||||
}
|
||||
|
@ -196,17 +196,14 @@ public class Schematic {
|
||||
InputStream is = schemData.getBinaryStream();
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
return Schematic_8.getClipboard(is, schemFormat);
|
||||
case 9:
|
||||
return Schematic_9.getClipboard(is, schemFormat);
|
||||
case 10:
|
||||
return Schematic_10.getClipboard(is, schemFormat);
|
||||
case 12:
|
||||
return Schematic_8.getClipboard(is, schemFormat);
|
||||
case 14:
|
||||
return Schematic_14.getClipboard(is, schemFormat);
|
||||
case 15:
|
||||
return Schematic_15.getClipboard(is, schemFormat);
|
||||
default:
|
||||
return Schematic_12.getClipboard(is, schemFormat);
|
||||
return Schematic_14.getClipboard(is, schemFormat);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new IOException(e);
|
||||
@ -224,22 +221,15 @@ public class Schematic {
|
||||
InputStream is = blob.getBinaryStream();
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 12:
|
||||
Schematic_8.setPlayerClipboard(player, is, schemFormat);
|
||||
break;
|
||||
case 9:
|
||||
Schematic_9.setPlayerClipboard(player, is, schemFormat);
|
||||
break;
|
||||
case 10:
|
||||
Schematic_10.setPlayerClipboard(player, is, schemFormat);
|
||||
break;
|
||||
case 14:
|
||||
Schematic_14.setPlayerClipboard(player, is, schemFormat);
|
||||
break;
|
||||
case 15:
|
||||
Schematic_15.setPlayerClipboard(player, is, schemFormat);
|
||||
break;
|
||||
default:
|
||||
Schematic_12.setPlayerClipboard(player, is, schemFormat);
|
||||
Schematic_14.setPlayerClipboard(player, is, schemFormat);
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new IOException(e);
|
||||
@ -259,26 +249,16 @@ public class Schematic {
|
||||
Blob blob = SQL.blob();
|
||||
switch(Core.getVersion()){
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 12:
|
||||
newFormat = false;
|
||||
blob.setBytes(1, Schematic_8.getPlayerClipboard(player));
|
||||
break;
|
||||
case 9:
|
||||
newFormat = false;
|
||||
blob.setBytes(1, Schematic_9.getPlayerClipboard(player));
|
||||
break;
|
||||
case 10:
|
||||
newFormat = false;
|
||||
blob.setBytes(1, Schematic_10.getPlayerClipboard(player));
|
||||
break;
|
||||
case 14:
|
||||
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
|
||||
break;
|
||||
case 15:
|
||||
blob.setBytes(1, Schematic_15.getPlayerClipboard(player, newFormat));
|
||||
break;
|
||||
default:
|
||||
newFormat = false;
|
||||
blob.setBytes(1, Schematic_12.getPlayerClipboard(player));
|
||||
blob.setBytes(1, Schematic_14.getPlayerClipboard(player, newFormat));
|
||||
}
|
||||
SQL.update("UPDATE Schematic SET SchemData = ?, SchemFormat = ? WHERE SchemID = ?", blob, newFormat, schemID);
|
||||
schemFormat = newFormat;
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren
Also entweder kleingeschrieben oder komplett groß bei den static final Variablen, und nicht das eine so und das andere so.
Konstanten GROß, anderes wie gewohnt camelCase.