forked from RypoFalem/ArmorStandEditor
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CORE] Ground Work for PlayerEditor and PlayerEditorManager. Make sur…
…e that MetricsHandler uses the ASE Instance. Signed-off-by: Wolfieheart <[email protected]>
- Loading branch information
1 parent
3c6fa6e
commit c2b2855
Showing
4 changed files
with
98 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package io.github.rypofalem.armorstandeditor; | ||
|
||
import io.github.rypofalem.armorstandeditor.devtools.Debug; | ||
import io.github.rypofalem.armorstandeditor.modes.AdjustmentMode; | ||
import io.github.rypofalem.armorstandeditor.modes.Axis; | ||
import io.github.rypofalem.armorstandeditor.modes.CopySlots; | ||
import io.github.rypofalem.armorstandeditor.modes.EditMode; | ||
import lombok.Getter; | ||
import org.bukkit.entity.ArmorStand; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.util.ArrayList; | ||
import java.util.UUID; | ||
|
||
public class PlayerEditor { | ||
public ArmorStandEditorPlugin plugin; | ||
private Debug debug; | ||
private UUID uuid; | ||
private long lastOpened = Integer.MIN_VALUE; | ||
|
||
@Getter EditMode eMode; | ||
@Getter AdjustmentMode adjMode; | ||
CopySlots copySlots; | ||
@Getter Axis axis; | ||
double eulerAngleChange; | ||
double degreeAngleChange; | ||
double movChange; | ||
//TODO: Add Menu Here once that is reimplemented | ||
ArmorStand targeted; | ||
ArrayList<ArmorStand> targetList = null; | ||
int targetIndex = 0; | ||
long lastCancelled = 0; | ||
|
||
public PlayerEditor(UUID uuid, ArmorStandEditorPlugin plugin){ | ||
this.uuid = uuid; | ||
this.plugin = plugin; | ||
eMode = EditMode.NONE; | ||
adjMode = AdjustmentMode.COARSE; | ||
axis = Axis.X; | ||
copySlots = new CopySlots(); | ||
eulerAngleChange = getManager().coarseAdj; | ||
degreeAngleChange = eulerAngleChange / Math.PI * 180; | ||
movChange = getManager().coarseMov; | ||
} | ||
|
||
public PlayerEditorManager getManager() { | ||
return plugin.editorManager; | ||
} | ||
|
||
} |
43 changes: 43 additions & 0 deletions
43
src/main/java/io/github/rypofalem/armorstandeditor/PlayerEditorManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package io.github.rypofalem.armorstandeditor; | ||
|
||
import org.bukkit.Bukkit; | ||
import org.bukkit.event.Listener; | ||
import io.github.rypofalem.armorstandeditor.util.Util; | ||
|
||
import java.util.HashMap; | ||
import java.util.UUID; | ||
|
||
public class PlayerEditorManager implements Listener { | ||
private ArmorStandEditorPlugin plugin; | ||
private HashMap<UUID, PlayerEditor> players; | ||
double coarseAdj; | ||
double fineAdj; | ||
double coarseMov; | ||
double fineMov; | ||
private boolean ignoreNextInteract = false; | ||
private TickCounter counter; | ||
|
||
PlayerEditorManager(final ArmorStandEditorPlugin plugin) { | ||
this.plugin = plugin; | ||
players = new HashMap<>(); | ||
coarseAdj = Util.FULL_CIRCLE / plugin.getCoarseConfig(); | ||
fineAdj = Util.FULL_CIRCLE / plugin.getFineConfig(); | ||
coarseMov = 1; | ||
fineMov = .03125; // 1/32 | ||
counter = new TickCounter(); | ||
Bukkit.getServer().getScheduler().runTaskTimer(plugin, counter, 0, 1); | ||
} | ||
|
||
class TickCounter implements Runnable { | ||
long ticks = 0; //I am optimistic | ||
|
||
@Override | ||
public void run() { | ||
ticks++; | ||
} | ||
|
||
public long getTime() { | ||
return ticks; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters