mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-01-03 13:38:20 +00:00
Merge Pull Request #102 from Carbogen
This commit is contained in:
parent
30aa3a8606
commit
9f58aeda01
12 changed files with 455 additions and 261 deletions
18
.classpath
18
.classpath
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/bukkit-1.8-R0.1.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/Factions.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/GriefPrevention.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/KorraRPG.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/LWC.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/MassiveCore.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/PreciousStones.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/spigot1.8.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/Towny.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/WorldEdit.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/worldguard-6.0.0-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/Chris/Desktop/Plugins/Files/KorraDependables/NoCheatPlus.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
22
.gitattributes
vendored
22
.gitattributes
vendored
|
@ -1,22 +0,0 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
|
||||
# Custom for Visual Studio
|
||||
*.cs diff=csharp
|
||||
*.sln merge=union
|
||||
*.csproj merge=union
|
||||
*.vbproj merge=union
|
||||
*.fsproj merge=union
|
||||
*.dbproj merge=union
|
||||
|
||||
# Standard to msysgit
|
||||
*.doc diff=astextplain
|
||||
*.DOC diff=astextplain
|
||||
*.docx diff=astextplain
|
||||
*.DOCX diff=astextplain
|
||||
*.dot diff=astextplain
|
||||
*.DOT diff=astextplain
|
||||
*.pdf diff=astextplain
|
||||
*.PDF diff=astextplain
|
||||
*.rtf diff=astextplain
|
||||
*.RTF diff=astextplain
|
232
.gitignore
vendored
232
.gitignore
vendored
|
@ -1,3 +1,175 @@
|
|||
#################
|
||||
## Eclipse
|
||||
#################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/
|
||||
tmp/
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
||||
|
||||
|
||||
#################
|
||||
## Visual Studio
|
||||
#################
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
build/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# NCrunch
|
||||
*.ncrunch*
|
||||
.*crunch*.local.xml
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
#packages/
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
#############
|
||||
## Windows detritus
|
||||
#############
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
@ -8,39 +180,37 @@ Desktop.ini
|
|||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
# Mac crap
|
||||
.DS_Store
|
||||
|
||||
.classpath
|
||||
|
||||
# =========================
|
||||
# Operating System Files
|
||||
# =========================
|
||||
#############
|
||||
## Python
|
||||
#############
|
||||
|
||||
# OSX
|
||||
# =========================
|
||||
*.py[cod]
|
||||
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must ends with two \r.
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
# Packages
|
||||
*.egg
|
||||
*.egg-info
|
||||
dist/
|
||||
build/
|
||||
eggs/
|
||||
parts/
|
||||
var/
|
||||
sdist/
|
||||
develop-eggs/
|
||||
.installed.cfg
|
||||
|
||||
bin/
|
||||
*.classpath
|
||||
.idea/.name
|
||||
*.xml
|
||||
*.class
|
||||
*.class
|
||||
ProjectKorra.iml
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
|
||||
#Translations
|
||||
*.mo
|
||||
|
||||
#Mr Developer
|
||||
.mr.developer.cfg
|
||||
|
|
17
.project
17
.project
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>ProjectKorra</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -1,11 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
|
@ -1,156 +0,0 @@
|
|||
name: ProjectKorra
|
||||
author: ProjectKorra
|
||||
version: 1.6.0 BETA 14
|
||||
main: com.projectkorra.ProjectKorra.ProjectKorra
|
||||
softdepend: [PreciousStones, WorldGuard, WorldEdit, Factions, MassiveCore, GriefPrevention, Towny, NoCheatPlus, LWC]
|
||||
commands:
|
||||
projectkorra:
|
||||
aliases: [b,bending,mtla,tla,korra,pk,bend]
|
||||
usage: /<command>
|
||||
permissions:
|
||||
bending.admin:
|
||||
default: op
|
||||
description: Grants access to all commands and abilities.
|
||||
children:
|
||||
bending.player: true
|
||||
bending.command.reload: true
|
||||
bending.admin.permaremove: true
|
||||
bending.command.avatar: true
|
||||
bending.command.add.others: true
|
||||
bending.command.add: true
|
||||
bending.command.rechoose: true
|
||||
bending.admin.choose: true
|
||||
bending.ability.AvatarState: true
|
||||
bending.ability.Bloodbending: true
|
||||
bending.ability.Flight: true
|
||||
bending.command.import: true
|
||||
bending.command.toggle.all: true
|
||||
bending.command.give: true
|
||||
bending.command.invincible: true
|
||||
bending.admin.debug: true
|
||||
bending.admin.remove: true
|
||||
bending.player:
|
||||
default: true
|
||||
description: Grants access to most abilities and basic commands.
|
||||
children:
|
||||
bending.command.bind: true
|
||||
bending.command.display: true
|
||||
bending.command.toggle: true
|
||||
bending.command.choose: true
|
||||
bending.command.version: true
|
||||
bending.command.help: true
|
||||
bending.command.clear: true
|
||||
bending.command.who: true
|
||||
bending.command.preset.list: true
|
||||
bending.command.preset.create.2: true
|
||||
bending.command.preset.create: true
|
||||
bending.command.preset.bind: true
|
||||
bending.command.preset.delete: true
|
||||
bending.air: true
|
||||
bending.water: true
|
||||
bending.earth: true
|
||||
bending.fire: true
|
||||
bending.chi: true
|
||||
bending.air:
|
||||
default: true
|
||||
description: Grants access to all airbending abilities.
|
||||
children:
|
||||
bending.ability.AirBlast: true
|
||||
bending.ability.AirBubble: true
|
||||
bending.ability.AirBurst: true
|
||||
bending.ability.AirScooter: true
|
||||
bending.ability.AirShield: true
|
||||
bending.ability.AirSpout: true
|
||||
bending.ability.AirSuction: true
|
||||
bending.ability.AirSwipe: true
|
||||
bending.ability.Suffocate: true
|
||||
bending.ability.Tornado: true
|
||||
bending.ability.AirCombo: true
|
||||
bending.air.passive: true
|
||||
bending.air.flight: true
|
||||
bending.water:
|
||||
default: true
|
||||
description: Grants access to most waterbending abilities.
|
||||
children:
|
||||
bending.ability.HealingWaters: true
|
||||
bending.ability.IceBlast: true
|
||||
bending.ability.IceSpike: true
|
||||
bending.ability.OctopusForm: true
|
||||
bending.ability.PhaseChange: true
|
||||
bending.ability.Surge: true
|
||||
bending.ability.Torrent: true
|
||||
bending.ability.WaterBubble: true
|
||||
bending.ability.WaterManipulation: true
|
||||
bending.ability.WaterSpout: true
|
||||
bending.ability.WaterSpout.Wave: true
|
||||
bending.ability.WaterCombo: true
|
||||
bending.water.plantbending: true
|
||||
bending.message.nightmessage: true
|
||||
bending.water.passive: true
|
||||
bending.water.icebending: true
|
||||
bending.water.healing: true
|
||||
bending.earth:
|
||||
default: true
|
||||
description: Grants access to all Earthbending abilities.
|
||||
children:
|
||||
bending.ability.Catapult: true
|
||||
bending.ability.Collapse: true
|
||||
bending.ability.EarthArmor: true
|
||||
bending.ability.EarthBlast: true
|
||||
bending.ability.EarthGrab: true
|
||||
bending.ability.EarthTunnel: true
|
||||
bending.ability.RaiseEarth: true
|
||||
bending.ability.Shockwave: true
|
||||
bending.ability.Tremorsense: true
|
||||
bending.ability.Extraction: true
|
||||
bending.ability.MetalClips: true
|
||||
bending.ability.MetalClips.loot: false
|
||||
bending.ability.MetalClips.4clips: false
|
||||
bending.earth.passive: true
|
||||
bending.earth.metalbending: true
|
||||
bending.earth.lavabending: true
|
||||
bending.earth.sandbending: true
|
||||
bending.earth.grapplinghook: true
|
||||
bending.ability.LavaSurge: true
|
||||
bending.ability.LavaFlow: true
|
||||
bending.ability.EarthSmash: true
|
||||
bending.fire:
|
||||
default: true
|
||||
description: Grants access to all firebending abilities.
|
||||
children:
|
||||
bending.ability.Blaze: true
|
||||
bending.ability.FireBlast: true
|
||||
bending.ability.FireBurst: true
|
||||
bending.ability.FireJet: true
|
||||
bending.ability.FireShield: true
|
||||
bending.ability.HeatControl: true
|
||||
bending.ability.Illumination: true
|
||||
bending.ability.Lightning: true
|
||||
bending.ability.WallOfFire: true
|
||||
bending.ability.Combustion: true
|
||||
bending.ability.FireCombo: true
|
||||
bending.message.daymessage: true
|
||||
bending.fire.passive: true
|
||||
bending.fire.lightningbending: true
|
||||
bending.fire.combustionbending: true
|
||||
bending.chi:
|
||||
default: true
|
||||
description: Grants access to all ChiBlocking abilities.
|
||||
children:
|
||||
bending.ability.HighJump: true
|
||||
bending.ability.Paralyze: true
|
||||
bending.ability.RapidPunch: true
|
||||
bending.ability.Smokescreen: true
|
||||
bending.ability.WarriorStance: true
|
||||
bending.ability.AcrobatStance: true
|
||||
bending.ability.QuickStrike: true
|
||||
bending.ability.SwiftKick: true
|
||||
bending.ability.ChiCombo: true
|
||||
bending.chi.passive: true
|
||||
bending.chi.grapplinghook: true
|
||||
bending.avatar:
|
||||
default: false
|
||||
description: Grants the Avatar Color.
|
||||
bending.ability.MetalClips.loot:
|
||||
default: false
|
||||
description: Lets a Metalbender loot a player's inventory of its iron.
|
|
@ -645,6 +645,9 @@ public class ConfigManager {
|
|||
+ " will instead melt blocks in that area. Finally, sneaking with this ability will cook any food in your hand.");
|
||||
config.addDefault("Abilities.Fire.HeatControl.Extinguish.Range", 20);
|
||||
config.addDefault("Abilities.Fire.HeatControl.Extinguish.Radius", 7);
|
||||
config.addDefault("Abilities.Fire.HeatControl.Solidify.Range", 10);
|
||||
config.addDefault("Abilities.Fire.HeatControl.Solidify.Radius", 5);
|
||||
config.addDefault("Abilities.Fire.HeatControl.Solidify.RevertTime", 20000);
|
||||
config.addDefault("Abilities.Fire.HeatControl.Melt.Range", 15);
|
||||
config.addDefault("Abilities.Fire.HeatControl.Melt.Radius", 5);
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public class Methods {
|
|||
public static Integer[] transparentToEarthbending = {0, 6, 8, 9, 10, 11, 30, 31, 32, 37, 38, 39, 40, 50, 51, 59, 78, 83, 106, 175};
|
||||
|
||||
public static Integer[] nonOpaque = {0, 6, 8, 9, 10, 11, 27, 28, 30, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 68, 69, 70, 72,
|
||||
75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132};
|
||||
75, 76, 77, 78, 83, 90, 93, 94, 104, 105, 106, 111, 115, 119, 127, 131, 132, 175};
|
||||
|
||||
/**
|
||||
* Checks to see if an AbilityExists. Uses method {@link #getAbility(String)} to check if it exists.
|
||||
|
@ -2275,6 +2275,12 @@ public class Methods {
|
|||
for (AbilityModule ab: abilities) {
|
||||
ab.stop();
|
||||
}
|
||||
|
||||
ArrayList<ComboManager.ComboAbility> combos = ComboManager.comboAbilityList;
|
||||
for(ComboManager.ComboAbility c : combos)
|
||||
if(c.getComboType() instanceof ComboAbilityModule)
|
||||
((ComboAbilityModule) c.getComboType()).stop();
|
||||
|
||||
AirBlast.removeAll();
|
||||
AirBubble.removeAll();
|
||||
AirShield.instances.clear();
|
||||
|
|
|
@ -458,7 +458,7 @@ public class PKListener implements Listener {
|
|||
new Fireball(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("HeatControl")) {
|
||||
new Cook(player);
|
||||
new HeatControl(player);
|
||||
}
|
||||
if (abil.equalsIgnoreCase("FireBurst")) {
|
||||
new FireBurst(player);
|
||||
|
|
|
@ -35,8 +35,8 @@ public class Extinguish {
|
|||
|
||||
Material mat = block.getType();
|
||||
if(mat != Material.FIRE
|
||||
&& mat != Material.STATIONARY_LAVA
|
||||
&& mat != Material.LAVA)
|
||||
/*&& mat != Material.STATIONARY_LAVA
|
||||
&& mat != Material.LAVA*/)
|
||||
continue;
|
||||
if (Methods.isRegionProtectedFromBuild(player, "Blaze",
|
||||
block.getLocation()))
|
||||
|
@ -44,7 +44,7 @@ public class Extinguish {
|
|||
if (block.getType() == Material.FIRE) {
|
||||
block.setType(Material.AIR);
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
|
||||
} else if (block.getType() == Material.STATIONARY_LAVA) {
|
||||
} /*else if (block.getType() == Material.STATIONARY_LAVA) {
|
||||
block.setType(Material.OBSIDIAN);
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
|
||||
} else if (block.getType() == Material.LAVA) {
|
||||
|
@ -54,7 +54,7 @@ public class Extinguish {
|
|||
block.setType(Material.COBBLESTONE);
|
||||
}
|
||||
block.getWorld().playEffect(block.getLocation(), Effect.EXTINGUISH, 0);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
bPlayer.addCooldown("HeatControl", Methods.getGlobalCooldown());
|
||||
|
|
|
@ -31,6 +31,7 @@ public class FirebendingManager implements Runnable {
|
|||
FireStream.ignitedblocks.remove(block);
|
||||
}
|
||||
}
|
||||
HeatControl.progressAll();
|
||||
FireStream.dissipateAll();
|
||||
FireStream.progressAll();
|
||||
FireCombo.progressAll();
|
||||
|
|
238
src/com/projectkorra/ProjectKorra/firebending/HeatControl.java
Normal file
238
src/com/projectkorra/ProjectKorra/firebending/HeatControl.java
Normal file
|
@ -0,0 +1,238 @@
|
|||
package com.projectkorra.ProjectKorra.firebending;
|
||||
|
||||
import com.projectkorra.ProjectKorra.Methods;
|
||||
import com.projectkorra.ProjectKorra.ProjectKorra;
|
||||
import com.projectkorra.ProjectKorra.TempBlock;
|
||||
import com.projectkorra.ProjectKorra.Utilities.ParticleEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* Created by Carbogen on 11/02/15.
|
||||
*/
|
||||
public class HeatControl
|
||||
{
|
||||
public static ConcurrentHashMap<Integer, HeatControl> instances = new ConcurrentHashMap<Integer, HeatControl>();
|
||||
|
||||
public final double RANGE = ProjectKorra.plugin.getConfig().getDouble("Abilities.Fire.HeatControl.Solidify.Range");
|
||||
public final int RADIUS = ProjectKorra.plugin.getConfig().getInt("Abilities.Fire.HeatControl.Solidify.Radius");
|
||||
public final int REVERT_TIME = ProjectKorra.plugin.getConfig().getInt("Abilities.Fire.HeatControl.Solidify.RevertTime");
|
||||
|
||||
public static int ID = 1;
|
||||
|
||||
private Player player;
|
||||
private int id;
|
||||
private int currentRadius = 1;
|
||||
private long delay = 50;
|
||||
private long lastBlockTime = 0;
|
||||
private long lastParticleTime = 0;
|
||||
private Location center;
|
||||
private List<TempBlock> tblocks = new ArrayList<TempBlock>();
|
||||
|
||||
public double range = RANGE;
|
||||
public int radius = RADIUS;
|
||||
public long revertTime = REVERT_TIME;
|
||||
|
||||
public HeatControl(Player player)
|
||||
{
|
||||
|
||||
if (!isEligible(player))
|
||||
return;
|
||||
|
||||
|
||||
if(Methods.getLavaSourceBlock(player, getRange()) == null)
|
||||
{
|
||||
new Cook(player);
|
||||
return;
|
||||
}
|
||||
|
||||
this.player = player;
|
||||
|
||||
if(ID == Integer.MAX_VALUE - 1)
|
||||
ID = 0;
|
||||
|
||||
this.id = ID;
|
||||
|
||||
ID++;
|
||||
|
||||
lastBlockTime = System.currentTimeMillis();
|
||||
|
||||
instances.put(id, this);
|
||||
}
|
||||
|
||||
public boolean isEligible(Player player)
|
||||
{
|
||||
if (!Methods.canBend(player.getName(), "HeatControl"))
|
||||
return false;
|
||||
|
||||
if (Methods.getBoundAbility(player) == null)
|
||||
return false;
|
||||
|
||||
if (!Methods.getBoundAbility(player).equalsIgnoreCase("HeatControl"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void freeze(List<Location> area)
|
||||
{
|
||||
if(System.currentTimeMillis() < lastBlockTime + delay)
|
||||
return;
|
||||
|
||||
List<Block> lava = new ArrayList<Block>();
|
||||
|
||||
for(Location l : area)
|
||||
if(Methods.isLava(l.getBlock()))
|
||||
lava.add(l.getBlock());
|
||||
|
||||
lastBlockTime = System.currentTimeMillis();
|
||||
|
||||
if(lava.size() == 0)
|
||||
{
|
||||
currentRadius ++;
|
||||
return;
|
||||
}
|
||||
|
||||
Block b = lava.get(Methods.rand.nextInt(lava.size()));
|
||||
|
||||
TempBlock tb;
|
||||
|
||||
if(TempBlock.isTempBlock(b))
|
||||
{
|
||||
tb = TempBlock.get(b);
|
||||
tb.setType(Material.STONE);
|
||||
}
|
||||
|
||||
else tb = new TempBlock(b, Material.STONE, b.getData());
|
||||
|
||||
if(!tblocks.contains(tb))
|
||||
tblocks.add(tb);
|
||||
|
||||
}
|
||||
|
||||
public void particles(List<Location> area)
|
||||
{
|
||||
if(System.currentTimeMillis() < lastParticleTime + 300)
|
||||
return;
|
||||
|
||||
lastParticleTime = System.currentTimeMillis();
|
||||
|
||||
for(Location l : area)
|
||||
{
|
||||
if(Methods.isLava(l.getBlock()))
|
||||
ParticleEffect.SMOKE.display(l, 0, 0, 0, 0.1f, 2);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetLocation(Location loc)
|
||||
{
|
||||
if(center == null)
|
||||
{
|
||||
center = loc;
|
||||
return;
|
||||
}
|
||||
|
||||
if(!loc.equals(center))
|
||||
{
|
||||
currentRadius = 1;
|
||||
center = loc;
|
||||
}
|
||||
}
|
||||
|
||||
public void progress()
|
||||
{
|
||||
if(!player.isOnline() || player.isDead() || !isEligible(player) || !player.isSneaking())
|
||||
{
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
if(currentRadius >= getRadius())
|
||||
{
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
|
||||
Location targetlocation = Methods.getTargetedLocation(player, range);
|
||||
|
||||
resetLocation(targetlocation);
|
||||
|
||||
List<Location> area = Methods.getCircle(center, currentRadius, 3, true, true, 0);
|
||||
|
||||
particles(area);
|
||||
freeze(area);
|
||||
}
|
||||
|
||||
public static void progressAll()
|
||||
{
|
||||
for(Integer id : instances.keySet())
|
||||
{
|
||||
instances.get(id).progress();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
ProjectKorra.plugin.getServer().getScheduler().scheduleSyncDelayedTask(ProjectKorra.plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
revertAll();
|
||||
if(instances.containsKey(id))
|
||||
instances.remove(id);
|
||||
}
|
||||
}, getRevertTime());
|
||||
|
||||
}
|
||||
|
||||
public void revertAll()
|
||||
{
|
||||
for(TempBlock tb : tblocks)
|
||||
{
|
||||
tb.revertBlock();
|
||||
}
|
||||
|
||||
tblocks.clear();
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
public double getRange()
|
||||
{
|
||||
return range;
|
||||
}
|
||||
|
||||
public int getRadius()
|
||||
{
|
||||
return radius;
|
||||
}
|
||||
|
||||
public long getRevertTime()
|
||||
{
|
||||
return revertTime;
|
||||
}
|
||||
|
||||
public void setRange(double value)
|
||||
{
|
||||
range = value;
|
||||
}
|
||||
|
||||
public void setRadius(int value)
|
||||
{
|
||||
radius = value;
|
||||
}
|
||||
|
||||
public void setRevertTime(long value)
|
||||
{
|
||||
revertTime = value;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue