Merge branch 'master' into bungee-schemgui
# Conflicts: # SpigotCore_Main/src/de/steamwar/comms/BungeeReceiver.java
Dieser Commit ist enthalten in:
Commit
dc7775ece0
32
SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java
Normale Datei
32
SpigotCore_10/src/de/steamwar/core/SpigotTPS_10.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import net.minecraft.server.v1_10_R1.MinecraftServer;
|
||||
|
||||
public class SpigotTPS_10 {
|
||||
|
||||
private SpigotTPS_10(){}
|
||||
|
||||
static double[] getTps(){
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
}
|
32
SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java
Normale Datei
32
SpigotCore_12/src/de/steamwar/core/SpigotTPS_12.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import net.minecraft.server.v1_12_R1.MinecraftServer;
|
||||
|
||||
public class SpigotTPS_12 {
|
||||
|
||||
private SpigotTPS_12(){}
|
||||
|
||||
static double[] getTps(){
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
}
|
32
SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java
Normale Datei
32
SpigotCore_14/src/de/steamwar/core/SpigotTPS_14.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import net.minecraft.server.v1_14_R1.MinecraftServer;
|
||||
|
||||
public class SpigotTPS_14 {
|
||||
|
||||
private SpigotTPS_14(){}
|
||||
|
||||
static double[] getTps(){
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
}
|
32
SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java
Normale Datei
32
SpigotCore_15/src/de/steamwar/core/SpigotTPS_15.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.MinecraftServer;
|
||||
|
||||
public class SpigotTPS_15 {
|
||||
|
||||
private SpigotTPS_15(){}
|
||||
|
||||
static double[] getTps(){
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
}
|
30
SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java
Normale Datei
30
SpigotCore_8/src/de/steamwar/comms/BungeeReceiver_8.java
Normale Datei
@ -0,0 +1,30 @@
|
||||
/*
|
||||
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.comms;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BungeeReceiver_8 {
|
||||
|
||||
public static void playPling(Player player) {
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1);
|
||||
}
|
||||
}
|
32
SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java
Normale Datei
32
SpigotCore_8/src/de/steamwar/core/SpigotTPS_8.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.MinecraftServer;
|
||||
|
||||
public class SpigotTPS_8 {
|
||||
|
||||
private SpigotTPS_8(){}
|
||||
|
||||
static double[] getTps(){
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
}
|
30
SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java
Normale Datei
30
SpigotCore_9/src/de/steamwar/comms/BungeeReceiver_9.java
Normale Datei
@ -0,0 +1,30 @@
|
||||
/*
|
||||
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.comms;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BungeeReceiver_9 {
|
||||
|
||||
public static void playpling(Player player) {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||
}
|
||||
}
|
32
SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java
Normale Datei
32
SpigotCore_9/src/de/steamwar/core/SpigotTPS_9.java
Normale Datei
@ -0,0 +1,32 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import net.minecraft.server.v1_9_R2.MinecraftServer;
|
||||
|
||||
public class SpigotTPS_9 {
|
||||
|
||||
private SpigotTPS_9(){}
|
||||
|
||||
static double[] getTps(){
|
||||
return MinecraftServer.getServer().recentTps;
|
||||
}
|
||||
|
||||
}
|
@ -26,6 +26,8 @@ import de.steamwar.comms.handlers.InventoryHandler;
|
||||
import de.steamwar.inventory.SWItem;
|
||||
import de.steamwar.inventory.SWListInv;
|
||||
import de.steamwar.sql.*;
|
||||
import de.steamwar.core.Core;
|
||||
import de.steamwar.sql.SteamwarUser;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -49,7 +51,11 @@ public class BungeeReceiver implements PluginMessageListener {
|
||||
UUID uuid = SteamwarUser.get(byteArrayDataInput.readInt()).getUUID();
|
||||
if(Bukkit.getPlayer(uuid).isOnline()) {
|
||||
Player player = Bukkit.getPlayer(uuid);
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.MASTER, 1, 1);
|
||||
if (Core.getVersion() == 8) {
|
||||
BungeeReceiver_8.playPling(player);
|
||||
} else {
|
||||
BungeeReceiver_9.playpling(player);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -23,6 +23,7 @@ public class PacketIdManager {
|
||||
|
||||
//0x0(X) Standalone Packets
|
||||
public final static byte PING_PACKET = 0x01;
|
||||
public final static byte TABLIST_NAME = 0x02;
|
||||
//0x1(X) Bungee Inventory
|
||||
public final static byte INVENTORY_PACKET = 0x10;
|
||||
public final static byte INVENTORY_CALLBACK_PACKET = 0x11;
|
||||
|
26
SpigotCore_Main/src/de/steamwar/comms/packets/TablistNamePacket.java
Normale Datei
26
SpigotCore_Main/src/de/steamwar/comms/packets/TablistNamePacket.java
Normale Datei
@ -0,0 +1,26 @@
|
||||
package de.steamwar.comms.packets;
|
||||
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import de.steamwar.comms.PacketIdManager;
|
||||
|
||||
public class TablistNamePacket extends SpigotPacket {
|
||||
|
||||
final int swUserId;
|
||||
final String tablistName;
|
||||
|
||||
public TablistNamePacket(int swUserId, String tablistName){
|
||||
this.swUserId = swUserId;
|
||||
this.tablistName = tablistName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getName() {
|
||||
return PacketIdManager.TABLIST_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeVars(ByteArrayDataOutput byteArrayDataOutput) {
|
||||
byteArrayDataOutput.writeInt(swUserId);
|
||||
byteArrayDataOutput.writeUTF(tablistName);
|
||||
}
|
||||
}
|
@ -65,7 +65,6 @@ public class Core extends JavaPlugin{
|
||||
ErrorLogger.init();
|
||||
getServer().getMessenger().registerIncomingPluginChannel(this, "sw:bridge", new BungeeReceiver());
|
||||
getServer().getMessenger().registerOutgoingPluginChannel(this, "sw:bridge");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,11 +75,11 @@ public class Core extends JavaPlugin{
|
||||
public static Core getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static int getVersion(){
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
private static void setInstance(Core instance) {
|
||||
Core.instance = instance;
|
||||
}
|
||||
|
@ -20,14 +20,16 @@
|
||||
package de.steamwar.core;
|
||||
|
||||
import de.steamwar.sql.SWException;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.core.Appender;
|
||||
import org.apache.logging.log4j.core.Core;
|
||||
import org.apache.logging.log4j.core.*;
|
||||
import org.apache.logging.log4j.core.LogEvent;
|
||||
import org.apache.logging.log4j.core.LoggerContext;
|
||||
import org.apache.logging.log4j.core.appender.AbstractAppender;
|
||||
import org.apache.logging.log4j.core.config.plugins.Plugin;
|
||||
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
|
||||
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
|
||||
import org.apache.logging.log4j.spi.StandardLevel;
|
||||
|
||||
@Plugin(name = "ErrorLogger", category = Core.CATEGORY_NAME, elementType = Appender.ELEMENT_TYPE)
|
||||
public class ErrorLogger extends AbstractAppender {
|
||||
@ -53,7 +55,7 @@ public class ErrorLogger extends AbstractAppender {
|
||||
|
||||
@Override
|
||||
public void append(LogEvent logEvent) {
|
||||
if(logEvent.getLevel().isLessSpecificThan(Level.WARN))
|
||||
if(logEvent.getLevel().intLevel() > StandardLevel.WARN.intLevel())
|
||||
return;
|
||||
|
||||
SWException.log(logEvent);
|
||||
|
102
SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java
Normale Datei
102
SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java
Normale Datei
@ -0,0 +1,102 @@
|
||||
/*
|
||||
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.core;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
public class TPSWatcher {
|
||||
|
||||
private static final double TICK_DEFAULT = 20.0;
|
||||
|
||||
private static final TPSWatcher tps_OneSecond = new TPSWatcher(1000);
|
||||
private static final TPSWatcher tps_TenSecond = new TPSWatcher(10000);
|
||||
|
||||
private long lastTime = System.currentTimeMillis();
|
||||
private double tps = 20.0;
|
||||
|
||||
private TPSWatcher(long timeInterval) {
|
||||
Bukkit.getScheduler().runTaskTimer(Core.getInstance(), () -> {
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
if (currentTime > lastTime)
|
||||
tps = (timeInterval / (double) (currentTime - lastTime)) * TICK_DEFAULT;
|
||||
|
||||
lastTime = currentTime;
|
||||
}, timeInterval / 50, timeInterval / 50);
|
||||
}
|
||||
|
||||
public static double getTPS() {
|
||||
return getTPS(TPSType.ONE_SECOND);
|
||||
}
|
||||
|
||||
public static double getTPSUnlimited() {
|
||||
return getTPSUnlimited(TPSType.ONE_SECOND);
|
||||
}
|
||||
|
||||
public static double getTPS(TPSType tpsType) {
|
||||
return Math.min(getTPSUnlimited(tpsType), 20.0);
|
||||
}
|
||||
|
||||
public static double getTPSUnlimited(TPSType tpsType) {
|
||||
switch (tpsType) {
|
||||
case TEN_SECONDS:
|
||||
return round(tps_TenSecond.tps);
|
||||
case ONE_MINUTE:
|
||||
return round(getSpigotTPS()[0]);
|
||||
case FIVE_MINUTES:
|
||||
return round(getSpigotTPS()[1]);
|
||||
case TEN_MINUTES:
|
||||
return round(getSpigotTPS()[2]);
|
||||
case ONE_SECOND:
|
||||
default:
|
||||
return round(tps_OneSecond.tps);
|
||||
}
|
||||
}
|
||||
|
||||
private static double[] getSpigotTPS() {
|
||||
switch (Core.getVersion()) {
|
||||
case 8:
|
||||
return SpigotTPS_8.getTps();
|
||||
case 9:
|
||||
return SpigotTPS_9.getTps();
|
||||
case 10:
|
||||
return SpigotTPS_10.getTps();
|
||||
case 12:
|
||||
return SpigotTPS_12.getTps();
|
||||
case 14:
|
||||
return SpigotTPS_14.getTps();
|
||||
case 15:
|
||||
default:
|
||||
return SpigotTPS_15.getTps();
|
||||
}
|
||||
}
|
||||
|
||||
private static double round(double d) {
|
||||
return Math.round(d * 10) / 10.0;
|
||||
}
|
||||
|
||||
public enum TPSType {
|
||||
ONE_SECOND,
|
||||
TEN_SECONDS,
|
||||
ONE_MINUTE,
|
||||
FIVE_MINUTES,
|
||||
TEN_MINUTES
|
||||
}
|
||||
}
|
@ -34,6 +34,7 @@ public class Event {
|
||||
private final Timestamp end;
|
||||
private final int maximumTeamMembers;
|
||||
private final boolean publicSchemsOnly;
|
||||
private final boolean spectateSystem;
|
||||
|
||||
private Event(ResultSet rs) throws SQLException{
|
||||
this.eventID = rs.getInt("EventID");
|
||||
@ -42,6 +43,7 @@ public class Event {
|
||||
this.end = rs.getTimestamp("End");
|
||||
this.maximumTeamMembers = rs.getInt("MaximumTeamMembers");
|
||||
this.publicSchemsOnly = rs.getBoolean("PublicSchemsOnly");
|
||||
this.spectateSystem = rs.getBoolean("SpectateSystem");
|
||||
}
|
||||
|
||||
public static Event get(int eventID){
|
||||
@ -75,4 +77,7 @@ public class Event {
|
||||
public boolean publicSchemsOnly() {
|
||||
return publicSchemsOnly;
|
||||
}
|
||||
public boolean spectateSystem(){
|
||||
return spectateSystem;
|
||||
}
|
||||
}
|
||||
|
@ -23,21 +23,75 @@ import org.apache.logging.log4j.core.LogEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SWException {
|
||||
private SWException(){}
|
||||
|
||||
private static boolean logDisabled = false;
|
||||
private static final List<String> ignorereasons;
|
||||
|
||||
static {
|
||||
List<String> reasons = new ArrayList<>();
|
||||
reasons.add("Initializing Legacy Material Support.");
|
||||
reasons.add("Could not save the list after adding a user.");
|
||||
reasons.add("Failed to save operators list:");
|
||||
reasons.add("Block at");
|
||||
reasons.add("POI data mismatch");
|
||||
reasons.add("handleDisconnection() called twice");
|
||||
reasons.add("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
reasons.add("The server will make no attempt to authenticate usernames. Beware.");
|
||||
reasons.add("Whilst this makes it possible to use BungeeCord,");
|
||||
reasons.add("Please see http://www.spigotmc.org/wiki/firewall-guide/ for further information.");
|
||||
reasons.add("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
|
||||
reasons.add("This crash report has been saved to:");
|
||||
reasons.add("Could not pass event PlayerQuitEvent to WorldEditSUI");
|
||||
reasons.add("[ViaVersion] Failed to remove injection handler");
|
||||
reasons.add("[ViaBackwards] Metadata for entity id");
|
||||
reasons.add("Something went wrong upgrading!");
|
||||
reasons.add("Tried to load unrecognized recipe");
|
||||
reasons.add("Invalid BlockState in palette:");
|
||||
reasons.add("Could not register alias");
|
||||
reasons.add("Can't keep up! Is the server overloaded?");
|
||||
reasons.add("\tat ");
|
||||
reasons.add("java.lang.Exception");
|
||||
reasons.add("[ViaVersion] Ignoring");
|
||||
reasons.add("[ViaBackwards] Ignoring");
|
||||
ignorereasons = Collections.unmodifiableList(reasons);
|
||||
}
|
||||
|
||||
public static void log(LogEvent logEvent){
|
||||
if(logDisabled)
|
||||
return;
|
||||
|
||||
String server = Bukkit.getWorlds().get(0).getName();
|
||||
StringBuilder stacktrace = new StringBuilder(logEvent.getSource().toString());
|
||||
String message = logEvent.getMessage().getFormattedMessage();
|
||||
for(String reason : ignorereasons)
|
||||
if(message.startsWith(reason))
|
||||
return;
|
||||
|
||||
if(message.contains("moved too quickly!") || message.contains("moved wrongly!") || message.contains("was kicked for floating too long!"))
|
||||
return;
|
||||
|
||||
switch (message) {
|
||||
case "The server has stopped responding!":
|
||||
logDisabled = true;
|
||||
return;
|
||||
case "------------------------------":
|
||||
message = "Server stopped responding";
|
||||
logDisabled = true;
|
||||
break;
|
||||
case "Exception stopping the server":
|
||||
logDisabled = true;
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
StringBuilder stacktrace = new StringBuilder(logEvent.getSource().toString());
|
||||
Throwable throwable = logEvent.getThrown();
|
||||
while(throwable != null){
|
||||
stacktrace.append("\nCaused by ").append(throwable.getMessage());
|
||||
stacktrace.append("\nCaused by ").append(throwable.getClass().getName()).append(": ").append(throwable.getMessage());
|
||||
|
||||
for(StackTraceElement ste : throwable.getStackTrace())
|
||||
stacktrace.append("\n").append(ste.toString());
|
||||
@ -46,31 +100,19 @@ public class SWException {
|
||||
}
|
||||
|
||||
String st = stacktrace.toString();
|
||||
|
||||
String message = logEvent.getMessage().getFormattedMessage();
|
||||
if(message.startsWith("Block at") || message.startsWith("POI data mismatch") || st.contains("POI data mismatch"))
|
||||
return;
|
||||
else if(message.equals("The server has stopped responding!")){
|
||||
logDisabled = true;
|
||||
return;
|
||||
}else if(message.equals("------------------------------")){
|
||||
message = "Server stopped responding";
|
||||
logDisabled = true;
|
||||
}else if(message.equals("Exception stopping the server")){
|
||||
logDisabled = true;
|
||||
}else if(message.startsWith("This crash report has been saved to:") || message.startsWith("Could not pass event PlayerQuitEvent to WorldEditSUI")){
|
||||
return;
|
||||
}else if(message.startsWith("[ViaVersion] Failed to remove injection handler") || message.startsWith("Something went wrong upgrading!"))
|
||||
return;
|
||||
else if(message.startsWith("Tried to load unrecognized recipe"))
|
||||
if(st.contains("POI data mismatch"))
|
||||
return;
|
||||
|
||||
|
||||
message += "\n\n";
|
||||
|
||||
message += "\n";
|
||||
for(Player player : Bukkit.getOnlinePlayers())
|
||||
message += player.getName() + " ";
|
||||
|
||||
String server;
|
||||
if(Bukkit.getWorlds().isEmpty())
|
||||
server = Bukkit.getName();
|
||||
else
|
||||
server = Bukkit.getWorlds().get(0).getName();
|
||||
|
||||
SQL.update("INSERT INTO Exception (server, message, stacktrace) VALUES (?, ?, ?)",
|
||||
server, message, st);
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren