Skip to content

Commit

Permalink
Bstats Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ShakeforProtein committed Dec 30, 2019
1 parent 77314f2 commit 29d6522
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 9 deletions.
38 changes: 36 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.ShakeforProtein</groupId>
<artifactId>TreeboTimed</artifactId>
<version>0.1.1</version>
<version>0.1.2</version>
<packaging>jar</packaging>

<name>TreeboTimed</name>
Expand Down Expand Up @@ -43,6 +43,29 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<!-- Do not include the <configuration>...</configuration> part if you are using Sponge! -->
<configuration>
<relocations>
<relocation>
<pattern>org.bstats</pattern>
<!-- Replace this with your package! -->
<shadedPattern>me.shakeforprotein.treebotimed</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
Expand All @@ -65,7 +88,10 @@
<id>enginehub-maven</id>
<url>http://maven.enginehub.org/repo/</url>
</repository>

<repository>
<id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -86,5 +112,13 @@
<artifactId>worldedit-bukkit</artifactId>
<version>7.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>1.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>


16 changes: 12 additions & 4 deletions src/main/java/me/shakeforprotein/treebotimed/TreeboTimed.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.sk89q.worldedit.WorldEdit;
import me.shakeforprotein.treebotimed.Commands.*;
import me.shakeforprotein.treebotimed.Listeners.PlaceSchem;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
Expand Down Expand Up @@ -44,11 +45,17 @@ public void onEnable() {
this.getCommand("giveblueprint").setExecutor(new GiveBlueprint(this));
this.getCommand("copyStone").setExecutor(new CopyStone());
Bukkit.getPluginManager().registerEvents(new PlaceSchem(this), this);
setStoneQue();
if(getConfig().getBoolean("allowGenerateOres")) {
setStoneQue();
}
if (getConfig().getBoolean("automaticPasting")) {
setSchedule();
}

if(getConfig().get("bstatsIntegration") != null) {
if (getConfig().getBoolean("bstatsIntegration")) {
Metrics metrics = new Metrics(this);
}
}
}

@Override
Expand Down Expand Up @@ -77,7 +84,8 @@ public boolean accept(File dir, String name) {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pasteatorigin " + schematic.getAbsolutePath().replace(".scm", ""));
//System.out.println(schematic.getAbsolutePath().replace(".scm", ""));
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "pasteatorigin " + schematic.getName().replace(".scm", ""));
}
}, (interval * count), timespan);
count++;
Expand All @@ -94,7 +102,7 @@ public void run() {
if (p.getLocation().getBlockX() > (x - 50) && p.getLocation().getBlockX() < (x + 50)) {
if (p.getLocation().getBlockZ() > (z - 50) && p.getLocation().getBlockZ() < (z + 50)) {
if (p.getLocation().getBlockY() > (y - 15) && p.getLocation().getBlockY() < (y + 50)) {
p.sendMessage(badge + " Resetting farm " + ChatColor.GOLD + schematic.getName().replace(".scm", "") + ChatColor.RESET + " in " + ChatColor.RED + ChatColor.BOLD + "ONE" + ChatColor.RESET + " Minute");
//p.sendMessage(badge + " Resetting farm " + ChatColor.GOLD + schematic.getName().replace(".scm", "") + ChatColor.RESET + " in " + ChatColor.RED + ChatColor.BOLD + "ONE" + ChatColor.RESET + " Minute");
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
automaticPasting: true
allowGenerateOres: false
totalInterval: 30
stoneRegenModifier: 40
bstatsIntegration: true
badge: '&3&l[&2Treebo Timed&3&l]&r'
oreWeights:
EMERALD_ORE: 100
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/plugin.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: TreeboTimed
version: ${project.version}
main: me.shakeforprotein.treebotimed.TreeboTimed
api-version: 1.15
api-version: 1.13
authors: [ShakeforProtein]
depend: [WorldEdit, WorldGuard]

permissions:
treebotimed.doit:
default: op
treebotimed.admin:
default: false
default: op
treebotimed.giveblueprint:
description: Allows the use of giveBluprint command
default: false
default: op

commands:
giveblueprint:
Expand Down

0 comments on commit 29d6522

Please sign in to comment.