Finished ConflictRTP code

This commit is contained in:
alisolarflare 2016-08-31 08:05:56 -04:00
parent 7bb679042a
commit 2b4ba7f8eb

View file

@ -10,7 +10,6 @@ public class RandomTP{
private int conflictX; private int conflictX;
private int conflictZ; private int conflictZ;
private int conflictCycle;
private int conflictRadius = 70; private int conflictRadius = 70;
private boolean northUsed; private boolean northUsed;
private boolean southUsed; private boolean southUsed;
@ -63,32 +62,32 @@ public class RandomTP{
} }
} }
int dir = 0; String dir = "north";
//CHOOSES A RANDOM DIRECTION //CHOOSES A RANDOM DIRECTION
for(int i = 0; i < 1000; i++){ for(int i = 0; i < 1000; i++){
double randomDirection = Math.random(); double randomDirection = Math.random();
if (randomDirection < 0.25){ if (randomDirection < 0.25){
if(northUsed){ if(northUsed){
northUsed = true; northUsed = true;
dir = 0; dir = "north";
break; break;
} }
}else if(randomDirection < 0.50){ }else if(randomDirection < 0.50){
if(eastUsed){ if(eastUsed){
eastUsed = true; eastUsed = true;
dir = 1; dir = "east";
break; break;
} }
}else if(randomDirection < 0.75){ }else if(randomDirection < 0.75){
if(southUsed){ if(southUsed){
southUsed = true; southUsed = true;
dir = 2; dir = "south";
break; break;
} }
}else{ }else{
if(westUsed){ if(westUsed){
westUsed = true; westUsed = true;
dir = 3; dir = "west";
break; break;
} }
@ -96,12 +95,28 @@ public class RandomTP{
} }
//TELEPORT - teleports player to the conflict point
switch(dir){
case "north":
//INCREMENT - shift cycle northUsed = false;
conflictCycle++; player.teleport(world.getHighestBlockAt(conflictX, conflictZ - conflictRadius).getLocation());
//conflict cycle - 0:N, 1:E, 2:S, 3:W break;
case "east":
eastUsed = false;
player.teleport(world.getHighestBlockAt(conflictX + conflictRadius, conflictZ).getLocation());
break;
case "south":
southUsed = false;
player.teleport(world.getHighestBlockAt(conflictX, conflictZ + conflictRadius).getLocation());
break;
case "west":
westUsed = false;
player.teleport(world.getHighestBlockAt(conflictX - conflictRadius, conflictZ).getLocation());
break;
default:
player.teleport(world.getHighestBlockAt(conflictX, conflictZ).getLocation());
break;
}
} }
//Randomly teleports a player, into the hardcore world //Randomly teleports a player, into the hardcore world