mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Add bStats support, seeing as mcstats has been down for ages
This commit is contained in:
parent
3c48488c61
commit
23b9eca4ab
@ -2,6 +2,7 @@ repositories {
|
||||
maven { url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/" }
|
||||
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
|
||||
maven { url "http://nexus.hc.to/content/repositories/pub_releases" }
|
||||
maven { url = "https://repo.codemc.org/repository/maven-public" }
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
@ -10,6 +11,7 @@ dependencies {
|
||||
testCompile project(':Core')
|
||||
compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT'
|
||||
compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT')
|
||||
compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4')
|
||||
compile("net.milkbowl.vault:VaultAPI:1.7") {
|
||||
exclude module: 'bukkit'
|
||||
}
|
||||
@ -34,8 +36,9 @@ jar.enabled = false
|
||||
shadowJar {
|
||||
dependencies {
|
||||
include(dependency(':Core'))
|
||||
include(dependency('org.bstats:bstats-bukkit:1.4'))
|
||||
}
|
||||
relocate('org.mcstats', 'com.plotsquared.stats')
|
||||
// relocate('org.mcstats', 'com.plotsquared.stats')
|
||||
archiveName = "${parent.name}-${project.name}-${parent.version}.jar"
|
||||
destinationDir = file '../target'
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
@Getter private SingleWorldListener singleWorldListener;
|
||||
private Method methodUnloadChunk0;
|
||||
private boolean methodUnloadSetup = false;
|
||||
private boolean metricsStarted;
|
||||
|
||||
@Override public int[] getServerVersion() {
|
||||
if (this.version == null) {
|
||||
@ -146,17 +147,14 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
new PlotSquared(this, "Bukkit");
|
||||
if (Settings.Enabled_Components.METRICS) {
|
||||
new Metrics(this).start();
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
// new Metrics(this).start();
|
||||
// PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
this.startMetrics();
|
||||
} else {
|
||||
PlotSquared.log(C.CONSOLE_PLEASE_ENABLE_METRICS.f(getPluginName()));
|
||||
}
|
||||
if (Settings.Enabled_Components.WORLDS) {
|
||||
TaskManager.IMP.taskRepeat(new Runnable() {
|
||||
@Override public void run() {
|
||||
unload();
|
||||
}
|
||||
}, 20);
|
||||
TaskManager.IMP.taskRepeat(this::unload, 20);
|
||||
try {
|
||||
singleWorldListener = new SingleWorldListener(this);
|
||||
} catch (Exception e) {
|
||||
@ -165,7 +163,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
}
|
||||
|
||||
public void unload() {
|
||||
private void unload() {
|
||||
if (!this.methodUnloadSetup) {
|
||||
this.methodUnloadSetup = true;
|
||||
try {
|
||||
@ -298,9 +296,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
|
||||
@Override @SuppressWarnings("deprecation") public void runEntityTask() {
|
||||
PlotSquared.log(C.PREFIX + "KillAllEntities started.");
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override public void run() {
|
||||
PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
TaskManager.runTaskRepeat(() -> PlotSquared.get().foreachPlotArea(new RunnableVal<PlotArea>() {
|
||||
@Override public void run(PlotArea plotArea) {
|
||||
final World world = Bukkit.getWorld(plotArea.worldname);
|
||||
try {
|
||||
@ -543,9 +539,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 20);
|
||||
}), 20);
|
||||
}
|
||||
|
||||
@Override @Nullable
|
||||
@ -740,8 +734,13 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
}
|
||||
|
||||
@Override public void startMetrics() {
|
||||
new Metrics(this).start();
|
||||
if (this.metricsStarted) {
|
||||
return;
|
||||
}
|
||||
// new Metrics(this).start(); mcstats
|
||||
new org.bstats.bukkit.Metrics(this); // bstats
|
||||
PlotSquared.log(C.PREFIX + "&6Metrics enabled.");
|
||||
this.metricsStarted = true;
|
||||
}
|
||||
|
||||
@Override public void setGenerator(@NonNull final String worldName) {
|
||||
@ -765,8 +764,8 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (!PlotSquared.get().hasPlotArea(worldName)) {
|
||||
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
PlotSquared.log("Failed to reload world: " + world + " | " + ignored.getMessage());
|
||||
} catch (Exception e) {
|
||||
PlotSquared.log("Failed to reload world: " + world + " | " + e.getMessage());
|
||||
Bukkit.getServer().unloadWorld(world, false);
|
||||
return;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import java.util.stream.Collectors;
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
public class BukkitLegacyMappings extends LegacyMappings {
|
||||
public final class BukkitLegacyMappings extends LegacyMappings {
|
||||
|
||||
private static final LegacyBlock[] BLOCKS =
|
||||
new LegacyBlock[] {new LegacyBlock(0, "air"), new LegacyBlock(1, "stone"),
|
||||
@ -731,6 +731,9 @@ public class BukkitLegacyMappings extends LegacyMappings {
|
||||
* @return LegacyBlock if found, else null
|
||||
*/
|
||||
public PlotBlock fromAny(@NonNull final String string) {
|
||||
if (string.isEmpty()) {
|
||||
return StringPlotBlock.EVERYTHING;
|
||||
}
|
||||
String workingString = string;
|
||||
String[] parts = null;
|
||||
if (string.contains(":")) {
|
||||
|
Loading…
Reference in New Issue
Block a user