Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
nicegamer7 committed Mar 24, 2020
1 parent afbeca7 commit 7203a82
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 25 deletions.
33 changes: 30 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@
</configuration>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>me.lucko:commodore</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>me.lucko.commodore</pattern>
<shadedPattern>xyz.ng7.rSpawn.commodore</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -54,9 +80,10 @@
<version>4.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.mojang</groupId>
<artifactId>brigadier</artifactId>
<version>1.0.17</version>
<groupId>me.lucko</groupId>
<artifactId>commodore</artifactId>
<version>1.7</version>
<scope>compile</scope>
</dependency>
</dependencies>

Expand Down
1 change: 1 addition & 0 deletions rSpawn.iml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.25" level="project" />
<orderEntry type="library" name="Maven: com.onarandombox.multiversecore:Multiverse-Core:4.1.1-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: com.onarandombox.multiverseinventories:Multiverse-Inventories:4.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: me.lucko:commodore:1.7" level="project" />
<orderEntry type="library" name="Maven: com.mojang:brigadier:1.0.17" level="project" />
</component>
</module>
10 changes: 5 additions & 5 deletions src/main/java/xyz/ng7/rSpawn/Listeners/OnJoin.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ public class OnJoin implements Listener {
private MultiverseInventories i;
private String g;

public OnJoin(rSpawn rS) {
c = rS.getConfigFile();
i = rS.getInventories();
public OnJoin(rSpawn r) {
this.c = r.getConfigFile();
this.i = r.getInventories();
}

@EventHandler
public void onJoin(PlayerChangedWorldEvent e) {
Player p = e.getPlayer();
List<WorldGroup> lwg = i.getGroupManager().getGroupsForWorld(p.getWorld().getName());
List<WorldGroup> lwg = this.i.getGroupManager().getGroupsForWorld(p.getWorld().getName());

for (WorldGroup fg: lwg) if (fg.isSharing(Sharables.SPAWN_LOCATION)) {
g = fg.getName();
break;
}

if (g != null && Sharables.getPlayerSpawnLocation(p) == null) {
Location sp = new SpawnLocation(c, p.getWorld()).gen();
Location sp = new SpawnLocation(this.c, p.getWorld()).gen();
Sharables.setPlayerSpawnLocation(p, sp);
p.teleport(sp);
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/xyz/ng7/rSpawn/Listeners/OnRespawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ public class OnRespawn implements Listener {
private MultiverseInventories i;
private String g;

public OnRespawn(rSpawn rS) {
c = rS.getConfigFile();
i = rS.getInventories();
public OnRespawn(rSpawn r) {
this.c = r.getConfigFile();
this.i = r.getInventories();
}

@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
Player p = e.getPlayer();
List<WorldGroup> lwg = i.getGroupManager().getGroupsForWorld(p.getWorld().getName());
List<WorldGroup> lwg = this.i.getGroupManager().getGroupsForWorld(p.getWorld().getName());

for (WorldGroup fg: lwg) if (fg.isSharing(Sharables.SPAWN_LOCATION)) {
g = fg.getName();
Expand All @@ -45,7 +45,7 @@ public void onRespawn(PlayerRespawnEvent e) {

e.setRespawnLocation(sp);
} else {
Sharables.setPlayerSpawnLocation(p, new SpawnLocation(c, p.getWorld()).gen());
Sharables.setPlayerSpawnLocation(p, new SpawnLocation(this.c, p.getWorld()).gen());
e.setRespawnLocation(Sharables.getPlayerSpawnLocation(p));
}
}
Expand Down
18 changes: 9 additions & 9 deletions src/main/java/xyz/ng7/rSpawn/Utils/ConfigFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
import xyz.ng7.rSpawn.rSpawn;

public class ConfigFile {
private rSpawn rS;
private rSpawn r;

public ConfigFile(rSpawn rSpawn) {
rS = rSpawn;
public ConfigFile(rSpawn r) {
this.r = r;
}

public FileConfiguration run() {
FileConfiguration c = null;

try {
if (!rS.getDataFolder().exists()) rS.getDataFolder().mkdirs();
if (!this.r.getDataFolder().exists()) this.r.getDataFolder().mkdirs();

File f = new File(rS.getDataFolder(), "config.yml");
File f = new File(this.r.getDataFolder(), "config.yml");

if(!f.exists()) rS.saveDefaultConfig();
if(!f.exists()) this.r.saveDefaultConfig();

c = rS.getConfig();
c = this.r.getConfig();
} catch (Exception e) {
rS.getLogger().severe("Cannot read data folder. Disabling plugin.");
rS.getPluginLoader().disablePlugin(rS);
this.r.getLogger().severe("Cannot read data folder. Disabling plugin.");
this.r.getPluginLoader().disablePlugin(this.r);
}

return c;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/xyz/ng7/rSpawn/Utils/SpawnLocation.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public Location gen() {

x = randomInt(true);
z = randomInt(false);
y = w.getHighestBlockYAt(x, z);
y = this.w.getHighestBlockYAt(x, z);

for (String b: this.disabledBiomes) if (w.getBiome(x, y, z) == Biome.valueOf(b)) {
for (String b: this.disabledBiomes) if (this.w.getBiome(x, y, z) == Biome.valueOf(b)) {
regen = true;
break;
}
} while (regen);

return new Location(w, x - 0.5, y, z - 0.5);
return new Location(this.w, x - 0.5, y, z - 0.5);
}
}

0 comments on commit 7203a82

Please sign in to comment.