-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ea sports
- Loading branch information
0 parents
commit a02a731
Showing
23 changed files
with
1,845 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="FacetManager"> | ||
<facet type="minecraft" name="Minecraft"> | ||
<configuration> | ||
<autoDetectTypes> | ||
<platformType>SPIGOT</platformType> | ||
</autoDetectTypes> | ||
</configuration> | ||
</facet> | ||
</component> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" scope="PROVIDED" name="worldedit-bukkit-6.1.2" level="project" /> | ||
<orderEntry type="library" name="Maven: fr.mrmicky:fastboard:1.2.0-SNAPSHOT" level="project" /> | ||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.7" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot-api:1.8.8-R0.1-SNAPSHOT" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: commons-lang:commons-lang:2.6" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.10" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.guava:guava:17.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.2.4" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.avaje:ebean:2.8.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.persistence:persistence-api:1.0" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.yaml:snakeyaml:1.15" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.md-5:bungeecord-chat:1.8-SNAPSHOT" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.github.thethingyee</groupId> | ||
<artifactId>BridgingPractice</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>BridgingPractice</name> | ||
|
||
<properties> | ||
<java.version>1.8</java.version> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>com.github.thethingyee.bridgingpractice.BridgingPractice</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
<configuration> | ||
<source>${java.version}</source> | ||
<target>${java.version}</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.2.4</version> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
<configuration> | ||
<createDependencyReducedPom>false</createDependencyReducedPom> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
</build> | ||
|
||
<repositories> | ||
<repository> | ||
<id>sonatype-oss</id> | ||
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url> | ||
</repository> | ||
<repository> | ||
<id>spigotmc-repo</id> | ||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url> | ||
</repository> | ||
<repository> | ||
<id>sonatype</id> | ||
<url>https://oss.sonatype.org/content/groups/public/</url> | ||
</repository> | ||
</repositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>fr.mrmicky</groupId> | ||
<artifactId>fastboard</artifactId> | ||
<version>1.2.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.7</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.spigotmc</groupId> | ||
<artifactId>spigot-api</artifactId> | ||
<version>1.8.8-R0.1-SNAPSHOT</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
139 changes: 139 additions & 0 deletions
139
src/main/java/com/github/thethingyee/bridgingpractice/BridgingPractice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
package com.github.thethingyee.bridgingpractice; | ||
|
||
import com.github.thethingyee.bridgingpractice.listeners.*; | ||
import com.github.thethingyee.bridgingpractice.utils.ConfigExists; | ||
import com.github.thethingyee.bridgingpractice.utils.HMaps; | ||
import com.github.thethingyee.bridgingpractice.utils.Offsets; | ||
import com.sk89q.worldedit.CuboidClipboard; | ||
import com.sk89q.worldedit.EditSession; | ||
import com.sk89q.worldedit.MaxChangedBlocksException; | ||
import com.sk89q.worldedit.Vector; | ||
import com.sk89q.worldedit.bukkit.BukkitWorld; | ||
import com.sk89q.worldedit.bukkit.WorldEditPlugin; | ||
import com.sk89q.worldedit.data.DataException; | ||
import com.sk89q.worldedit.schematic.MCEditSchematicFormat; | ||
import org.apache.commons.io.FileUtils; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.ChatColor; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.event.Listener; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
|
||
@SuppressWarnings("ALL") | ||
public final class BridgingPractice extends JavaPlugin implements Listener { | ||
|
||
private final ArrayList<String> worldArray = new ArrayList<>(); | ||
public String prefix = ChatColor.translateAlternateColorCodes('&', "&7[&6&lBridgingPractice&7] &f"); | ||
|
||
private GUIManager guiManager; | ||
private ScoreboardManager scoreboardManager; | ||
|
||
private PlayerSpeed playerSpeed; | ||
private HMaps hMaps; | ||
private ConfigExists configExists; | ||
|
||
@Override | ||
public void onEnable() { | ||
Bukkit.getConsoleSender().sendMessage(prefix + ChatColor.YELLOW + "Enabling BridgingPractice plugin.."); | ||
|
||
guiManager = new GUIManager(this); | ||
scoreboardManager = new ScoreboardManager(this); | ||
|
||
new Offsets(this); | ||
|
||
playerSpeed = new PlayerSpeed(this); | ||
hMaps = new HMaps(); | ||
configExists = new ConfigExists(this); | ||
|
||
if (getWorldEditPlugin() == null) { | ||
Bukkit.getConsoleSender().sendMessage(prefix + ChatColor.RED + "WorldEdit not found. Disabling.."); | ||
|
||
this.getServer().getPluginManager().disablePlugin(this); | ||
return; | ||
} | ||
this.getServer().getPluginManager().registerEvents(new BlockBreak(this), this); | ||
this.getServer().getPluginManager().registerEvents(new BlockPlace(this), this); | ||
this.getServer().getPluginManager().registerEvents(new ChangeWorld(this), this); | ||
this.getServer().getPluginManager().registerEvents(new EntityDamage(this), this); | ||
this.getServer().getPluginManager().registerEvents(new InvClick(this), this); | ||
this.getServer().getPluginManager().registerEvents(new PlayerInteract(this), this); | ||
this.getServer().getPluginManager().registerEvents(new PlayerLeave(this), this); | ||
this.getServer().getPluginManager().registerEvents(new PlayerMove(this), this); | ||
|
||
this.getCommand("bridge").setExecutor(new Commands(this)); | ||
|
||
saveDefaultConfig(); | ||
if (Bukkit.getWorld(this.getConfig().getString("defaults.world")) == null) { | ||
Bukkit.getConsoleSender().sendMessage(prefix + ChatColor.RED + "The default world doesn't exist. Disabling..."); | ||
this.getServer().getPluginManager().disablePlugin(this); | ||
} | ||
|
||
this.getScoreboardManager().init(); | ||
|
||
Bukkit.getConsoleSender().sendMessage(prefix + ChatColor.GREEN + "Successfully enabled BridgingPractice plugin!"); | ||
} | ||
|
||
@Override | ||
public void onDisable() { | ||
Bukkit.getConsoleSender().sendMessage(prefix + ChatColor.RED + "Plugin disabling. Kicking all players."); | ||
for(Player player : Bukkit.getOnlinePlayers()) { | ||
player.getInventory().clear(); | ||
player.teleport(Bukkit.getWorld(this.getConfig().getString("defaults.world")).getSpawnLocation()); | ||
player.kickPlayer(prefix + ChatColor.RED + "Plugin disabled. Sorry for the inconvenience."); | ||
} | ||
for (String s : getWorldArray()) { | ||
if (!getWorldArray().isEmpty()) { | ||
try { | ||
File f = new File(Bukkit.getWorldContainer() + File.separator + "/" + s); | ||
if(f.exists()) { | ||
Bukkit.unloadWorld(Bukkit.getWorld(s), false); | ||
FileUtils.deleteDirectory(f); | ||
} | ||
getWorldArray().remove(s); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public void loadSchem(File file, Location loc, int rotation) throws IOException, MaxChangedBlocksException, DataException { | ||
EditSession session = this.getWorldEditPlugin().getWorldEdit().getEditSessionFactory().getEditSession(new BukkitWorld(loc.getWorld()), 1000); | ||
CuboidClipboard clipboard = MCEditSchematicFormat.getFormat(file).load(file); | ||
clipboard.rotate2D(rotation); | ||
clipboard.paste(session, new Vector(loc.getX(), loc.getY(), loc.getZ()), false); | ||
} | ||
|
||
public PlayerSpeed getPlayerSpeed() { | ||
return playerSpeed; | ||
} | ||
|
||
public HMaps gethMaps() { | ||
return hMaps; | ||
} | ||
|
||
public GUIManager getGuiManager() { | ||
return guiManager; | ||
} | ||
|
||
public ScoreboardManager getScoreboardManager() { | ||
return scoreboardManager; | ||
} | ||
|
||
public ArrayList<String> getWorldArray() { | ||
return worldArray; | ||
} | ||
|
||
public ConfigExists getConfigExists() { | ||
return configExists; | ||
} | ||
|
||
private WorldEditPlugin getWorldEditPlugin() { | ||
return (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit"); | ||
} | ||
} |
Oops, something went wrong.