mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-18 22:24:35 +00:00
Merge remote-tracking branch 'origin/master'
Conflicts: .classpath src/com/projectkorra/ProjectKorra/RevertChecker.java
This commit is contained in:
commit
6737c255bf
5 changed files with 552 additions and 693 deletions
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/BukkitForPlugins1.8.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/Factions.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/GriefPrevention.jar"/>
|
||||
|
@ -13,6 +14,5 @@
|
|||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldEdit.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/Bending Plugins/WorldGuard.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/plugins/KorraRPG.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Shawn/Documents/LocalServer/BukkitForPlugins1.8.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -75,6 +75,9 @@ import com.palmergames.bukkit.towny.object.WorldCoord;
|
|||
import com.palmergames.bukkit.towny.utils.PlayerCacheUtil;
|
||||
import com.palmergames.bukkit.towny.war.flagwar.TownyWar;
|
||||
import com.palmergames.bukkit.towny.war.flagwar.TownyWarConfig;
|
||||
import com.projectkorra.ProjectKorra.Element;
|
||||
import com.projectkorra.ProjectKorra.Information;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
import com.projectkorra.ProjectKorra.Ability.AbilityModule;
|
||||
import com.projectkorra.ProjectKorra.Ability.AbilityModuleManager;
|
||||
import com.projectkorra.ProjectKorra.Ability.AvatarState;
|
||||
|
@ -1444,7 +1447,7 @@ public class Methods {
|
|||
if (gpp != null && respectGriefPrevention) {
|
||||
Material type = player.getWorld().getBlockAt(location).getType();
|
||||
if (type == null) type = Material.AIR;
|
||||
String reason = GriefPrevention.instance.allowBuild(player, location, type);
|
||||
String reason = GriefPrevention.instance.allowBuild(player, location, null);
|
||||
|
||||
if (ignite.contains(ability)) {
|
||||
|
||||
|
@ -1734,6 +1737,16 @@ public class Methods {
|
|||
return ParticleEffect.CLOUD;
|
||||
}
|
||||
|
||||
public static Collection<Player> getPlayersAroundPoint(Location location, double distance) {
|
||||
Collection<Player> players = new HashSet<Player>();
|
||||
for (Player player: Bukkit.getOnlinePlayers()) {
|
||||
if (player.getLocation().distance(location) <= distance) {
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
return players;
|
||||
}
|
||||
|
||||
public static void playAirbendingParticles(Location loc, int amount) {
|
||||
playAirbendingParticles(loc, amount, (float) Math.random(), (float) Math.random(), (float) Math.random());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.projectkorra.ProjectKorra;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
|
@ -43,43 +44,34 @@ public class RevertChecker implements Runnable {
|
|||
@Override
|
||||
public ArrayList<Chunk> call() throws Exception {
|
||||
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
|
||||
for (Player player : server.getOnlinePlayers()) {
|
||||
Chunk chunk = player.getLocation().getChunk();
|
||||
if (!chunks.contains(chunk))
|
||||
chunks.add(chunk);
|
||||
Collection<? extends Player> players = server.getOnlinePlayers();
|
||||
|
||||
for (Player player2 : players) {
|
||||
Chunk chunk = player2.getLocation().getChunk();
|
||||
if (!chunks.contains(chunk))
|
||||
chunks.add(chunk);
|
||||
}
|
||||
}
|
||||
|
||||
return chunks;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void run() {
|
||||
time = System.currentTimeMillis();
|
||||
|
||||
if (plugin.getConfig().getBoolean("Properties.Earth.RevertEarthbending")) {
|
||||
|
||||
// ArrayList<Chunk> chunks = new ArrayList<Chunk>();
|
||||
// Player[] players = plugin.getServer().getOnlinePlayers();
|
||||
//
|
||||
// for (Player player : players) {
|
||||
// Chunk chunk = player.getLocation().getChunk();
|
||||
// if (!chunks.contains(chunk))
|
||||
// chunks.add(chunk);
|
||||
// }
|
||||
|
||||
try {
|
||||
// Tools.verbose("Calling future at t="
|
||||
// + System.currentTimeMillis());
|
||||
returnFuture = plugin
|
||||
.getServer()
|
||||
.getScheduler()
|
||||
.callSyncMethod(plugin,
|
||||
new getOccupiedChunks(plugin.getServer()));
|
||||
ArrayList<Chunk> chunks = returnFuture.get();
|
||||
// Tools.verbose("Future called, t=" +
|
||||
// System.currentTimeMillis());
|
||||
|
||||
Map<Block, Information> earth = new HashMap<Block, Information>();
|
||||
earth.putAll(Methods.movedearth);
|
||||
|
@ -118,41 +110,6 @@ public class RevertChecker implements Runnable {
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
// for (Block block : Tools.tempearthblocks.keySet()) {
|
||||
// if (revertQueue.containsKey(block))
|
||||
// continue;
|
||||
// boolean remove = true;
|
||||
//
|
||||
// Block index = Tools.tempearthblocks.get(block);
|
||||
// if (Tools.movedearth.containsKey(index)) {
|
||||
// Information info = Tools.movedearth.get(index);
|
||||
// if (time < info.getTime() + ConfigManager.revertchecktime
|
||||
// || (chunks.contains(index.getChunk()) && safeRevert)) {
|
||||
// remove = false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (remove)
|
||||
// addToRevertQueue(block);
|
||||
//
|
||||
// }
|
||||
|
||||
// for (Block block : Tools.movedearth.keySet()) {
|
||||
// if (movedEarthQueue.containsKey(block))
|
||||
// continue;
|
||||
// Information info = Tools.movedearth.get(block);
|
||||
// if (time >= info.getTime() + ConfigManager.revertchecktime) {
|
||||
// // if (Tools.tempearthblocks.containsKey(info.getBlock()))
|
||||
// // Tools.verbose("PROBLEM!");
|
||||
// // block.setType(info.getType());
|
||||
// // Tools.movedearth.remove(block);
|
||||
// addToMovedEarthQueue(block, info.getType());
|
||||
// }
|
||||
// }
|
||||
|
||||
// Tools.writeToLog("Still " + Tools.tempearthblocks.size()
|
||||
// + " remaining.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -204,8 +204,14 @@ public class LavaFlow
|
|||
}
|
||||
else if(Math.random() < PARTICLE_DENSITY
|
||||
&& dSquared < Math.pow(currentRadius + PARTICLE_OFFSET, 2)
|
||||
&& currentRadius + PARTICLE_OFFSET < maxRadius)
|
||||
ParticleEffect.LAVA.display(loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1);
|
||||
&& currentRadius + PARTICLE_OFFSET < maxRadius) {
|
||||
try {
|
||||
ParticleEffect.LAVA.sendToPlayers(Methods.getPlayersAroundPoint(loc, 100), loc, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 1);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -245,17 +251,22 @@ public class LavaFlow
|
|||
{
|
||||
double radius = AvatarState.isAvatarState(player) ? AS_CLICK_RADIUS : CLICK_LAVA_RADIUS;
|
||||
for(double x = -radius; x <= radius; x++)
|
||||
for(double z = -radius; z <= radius; z++)
|
||||
{
|
||||
Location loc = origin.clone().add(x,0,z);
|
||||
Block tempBlock = getTopBlock(loc,UPWARD_FLOW,DOWNWARD_FLOW);
|
||||
if(tempBlock != null
|
||||
&& !isLava(tempBlock)
|
||||
&& Math.random() < PARTICLE_DENSITY
|
||||
&& tempBlock.getLocation().distanceSquared(origin) <= Math.pow(radius,2))
|
||||
ParticleEffect.LAVA.display(loc, 0, 0, 0, 0, 1);
|
||||
for(double z = -radius; z <= radius; z++)
|
||||
{
|
||||
Location loc = origin.clone().add(x,0,z);
|
||||
Block tempBlock = getTopBlock(loc,UPWARD_FLOW,DOWNWARD_FLOW);
|
||||
if(tempBlock != null
|
||||
&& !isLava(tempBlock)
|
||||
&& Math.random() < PARTICLE_DENSITY
|
||||
&& tempBlock.getLocation().distanceSquared(origin) <= Math.pow(radius,2))
|
||||
try {
|
||||
ParticleEffect.LAVA.sendToPlayers(Methods.getPlayersAroundPoint(loc, 100), loc, 0, 0, 0, 0, 1);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -285,7 +296,12 @@ public class LavaFlow
|
|||
if(Math.random() < LAVA_CREATE_SPEED)
|
||||
createLava(tempBlock);
|
||||
else
|
||||
ParticleEffect.LAVA.display(loc, 0, 0, 0, 0, 1);
|
||||
try {
|
||||
ParticleEffect.LAVA.sendToPlayers(Methods.getPlayersAroundPoint(loc, 100), loc, 0, 0, 0, 0, 1);
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
else if(!makeLava && isLava(tempBlock))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue