Skip to content

Commit

Permalink
[E] 1.2.0-dev11
Browse files Browse the repository at this point in the history
  • Loading branch information
ClayCoffee committed Jun 25, 2020
1 parent a4aa66f commit cf13de4
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/main/java/club/claycoffee/ClayTech/ClayTech.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public void run() {
public void run() {
updater.tryUpdate();
}

}.runTaskTimerAsynchronously(ClayTech.getInstance(), 72000, 7200);
} else {
Bukkit.getLogger().info(ChatColor.YELLOW + Lang.readGeneralText("Info_1"));
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/club/claycoffee/ClayTech/api/Planet.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ public void register() {
}
}
ClayTech.getPlanets().add(this);

WorldCreator newWorld = new WorldCreator(this.planetName);
if (Bukkit.getWorld(this.planetName) == null) {
newWorld.environment(this.environment);
long seed = new Random().nextLong();
newWorld = newWorld.seed(seed);
newWorld = newWorld.type(WorldType.CUSTOMIZED);
newWorld = newWorld.generateStructures(false);
newWorld = newWorld.generator("ClayTech:"+this.planetName);
newWorld = newWorld.generator("ClayTech:" + this.planetName);
World w = newWorld.createWorld();
if (this.cold) {
// 如果冷就不会下雨
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,30 +58,30 @@ public void InventoryMoveItemEvent(InventoryClickEvent e) {
Planet current = PlanetUtils.getPlanet(b.getWorld());
// 排列星球
List<Planet> pl = new ArrayList<Planet>();
for(Planet p1 : ClayTech.getPlanets()) {
for (Planet p1 : ClayTech.getPlanets()) {
pl.add(p1);
}
Planet[] pl2 = pl.toArray(new Planet[pl.size()]);
List<Integer> d = new ArrayList<Integer>();
for(Planet p1 : pl2) {
for (Planet p1 : pl2) {
d.add((Integer) PlanetUtils.getDistance(current, p1));
}
Integer[] distance = d.toArray(new Integer[d.size()]);
for (int i = 0; i < distance.length; i++) {
for (int j = 0; j < distance.length - i - 1; j++) {
if (distance[j].intValue() > distance[j + 1].intValue()) {
int temp = distance[j + 1];
distance[j + 1] = distance[j];
distance[j] = temp;
Planet temp2 = pl2[j + 1];
pl2[j + 1] = pl2[j];
pl2[j] = temp2;
}
}
}
pl = Arrays.asList(pl2);
Integer[] distance = d.toArray(new Integer[d.size()]);
for (int i = 0; i < distance.length; i++) {
for (int j = 0; j < distance.length - i - 1; j++) {
if (distance[j].intValue() > distance[j + 1].intValue()) {
int temp = distance[j + 1];
distance[j + 1] = distance[j];
distance[j] = temp;

Planet temp2 = pl2[j + 1];
pl2[j + 1] = pl2[j];
pl2[j] = temp2;
}
}
}
pl = Arrays.asList(pl2);

Planet target = pl.get(index);
if (!target.getPlanetWorldName().equalsIgnoreCase(current.getPlanetWorldName())) {
if (PlanetUtils.getFuel(current, target) <= RocketUtils.getFuel(handItem)) {
Expand Down
41 changes: 20 additions & 21 deletions src/main/java/club/claycoffee/ClayTech/utils/PlanetUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,35 +107,34 @@ public static int getTotalPage() {
public static Inventory renderLauncherMenu(Planet current, Inventory Preset, int currentPage) {
int v = 0;
int c = 0;

// 排列星球
List<Planet> pl = new ArrayList<Planet>();
for(Planet p : ClayTech.getPlanets()) {
for (Planet p : ClayTech.getPlanets()) {
pl.add(p);
}
Planet[] pl2 = pl.toArray(new Planet[pl.size()]);
List<Integer> d = new ArrayList<Integer>();
for(Planet p : pl2) {
for (Planet p : pl2) {
d.add((Integer) PlanetUtils.getDistance(current, p));
}
Integer[] distance = d.toArray(new Integer[d.size()]);
for (int i = 0; i < distance.length; i++) {
for (int j = 0; j < distance.length - i - 1; j++) {
if (distance[j].intValue() > distance[j + 1].intValue()) {
int temp = distance[j + 1];
distance[j + 1] = distance[j];
distance[j] = temp;

Planet temp2 = pl2[j + 1];
pl2[j + 1] = pl2[j];
pl2[j] = temp2;
}
}
}
pl = Arrays.asList(pl2);


for (Planet each : pl) {
Integer[] distance = d.toArray(new Integer[d.size()]);
for (int i = 0; i < distance.length; i++) {
for (int j = 0; j < distance.length - i - 1; j++) {
if (distance[j].intValue() > distance[j + 1].intValue()) {
int temp = distance[j + 1];
distance[j + 1] = distance[j];
distance[j] = temp;

Planet temp2 = pl2[j + 1];
pl2[j + 1] = pl2[j];
pl2[j] = temp2;
}
}
}
pl = Arrays.asList(pl2);

for (Planet each : pl) {
c++;
if (c > (currentPage - 1) * 21 && c <= currentPage * 21) {
v++;
Expand Down

0 comments on commit cf13de4

Please sign in to comment.