Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

3
Plugins/Old/Scoreboard/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@@ -0,0 +1,8 @@
<component name="ArtifactManager">
<artifact type="jar" name="Scoreboard">
<output-path>$PROJECT_DIR$/../../../Plugins</output-path>
<root id="archive" name="Scoreboard.jar">
<element id="module-output" name="Scoreboard" />
</root>
</artifact>
</component>

View File

@@ -0,0 +1,11 @@
<component name="libraryTable">
<library name="spigot 1.8.8">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../Spigot Versions/spigot 1.8.8.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/../Spigot Versions/spigot 1.8.8.jar!/" />
</SOURCES>
</library>
</component>

6
Plugins/Old/Scoreboard/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Scoreboard.iml" filepath="$PROJECT_DIR$/Scoreboard.iml" />
</modules>
</component>
</project>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="spigot 1.8.8" level="project" />
</component>
</module>

View File

@@ -0,0 +1,4 @@
main: de.craftix.scoreboard.Main
name: Scoreboard
version: 1.0
author: CraftixLP

View File

@@ -0,0 +1,55 @@
package de.craftix.scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.ArrayList;
public class Main extends JavaPlugin {
private static Main instance;
@Override
public void onEnable() {
instance = this;
ScoreboardAnimation.stopAllAnimations();
Bukkit.getPluginManager().registerEvents(new onJoin(), this);
for (Player p : Bukkit.getOnlinePlayers()){
ScoreboardAnimation.removeAnimation(p);
new ScoreboardAnimation(p, Main.getAnimation());
}
}
@Override
public void onDisable() {
ScoreboardAnimation.stopAllAnimations();
}
public static Main getInstance() {
return instance;
}
public static ArrayList<ScoreboardTiles> getAnimation(){
ArrayList<ScoreboardTiles> tiles = new ArrayList<>();
ScoreboardTiles tile = new ScoreboardTiles();
tile.title = "Scoreboard";
tile.setLine(1, "Test");
tile.setLine(2, "lol");
tiles.add(tile);
tile = new ScoreboardTiles();
tile.title = "Scoreboard";
tile.setLine(1, "lol");
tile.setLine(2, "Test");
tiles.add(tile);
tile = new ScoreboardTiles();
tile.title = "Scoreboard";
tile.setLine(1, "lol1");
tile.setLine(2, "Test2");
tiles.add(tile);
return tiles;
}
}

View File

@@ -0,0 +1,27 @@
package de.craftix.scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import org.bukkit.scoreboard.Scoreboard;
public class ScoreboardAPI {
public static Scoreboard createScoreboard(ScoreboardTiles tiles){
Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
Objective ob = board.registerNewObjective("abc", "abc");
ob.setDisplaySlot(DisplaySlot.SIDEBAR);
ob.setDisplayName(tiles.title);
for (int i = 0; i < 15; i++){
if (tiles.lines.get(i) == null) continue;
ob.getScore(tiles.lines.get(i)).setScore(i);
}
return board;
}
public static void showScoreboard(Scoreboard board, Player p){
p.setScoreboard(board);
}
}

View File

@@ -0,0 +1,49 @@
package de.craftix.scoreboard;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class ScoreboardAnimation {
public static ArrayList<ScoreboardAnimation> animations = new ArrayList<>();
public static void stopAllAnimations(){
for (ScoreboardAnimation an : animations){
Bukkit.getScheduler().cancelTask(an.animationID);
}
}
public static void removeAnimation(Player p){
ScoreboardAnimation animation = null;
for (ScoreboardAnimation an : animations){
if (an.p == p) {
Bukkit.getScheduler().cancelTask(an.animationID);
animation = an;
}
}
animations.remove(animation);
}
public int animationID;
private Player p;
public ScoreboardAnimation(Player p, ArrayList<ScoreboardTiles> tiles){
this.p = p;
startAnimation(tiles);
removeAnimation(p);
animations.add(this);
}
private void startAnimation(ArrayList<ScoreboardTiles> tiles){
animationID = Bukkit.getScheduler().scheduleSyncRepeatingTask(Main.getInstance(), new Runnable() {
int state = 0;
@Override
public void run() {
if (state >= tiles.size()) state = 0;
ScoreboardAPI.showScoreboard(ScoreboardAPI.createScoreboard(tiles.get(state)), p);
state++;
}
}, 10, 10);
}
}

View File

@@ -0,0 +1,19 @@
package de.craftix.scoreboard;
import java.util.HashMap;
public class ScoreboardTiles {
public HashMap<Integer, String> lines = new HashMap<>();
public String title;
public void setLine(int line, String content){
lines.remove(lines.get(line));
lines.put(line, content);
}
public void setTitle(String title){
this.title = title;
}
}

View File

@@ -0,0 +1,20 @@
package de.craftix.scoreboard;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
public class onJoin implements Listener {
@EventHandler
public void onJoinEvent(PlayerJoinEvent event){
new ScoreboardAnimation(event.getPlayer(), Main.getAnimation());
}
@EventHandler
public void onQuitEvent(PlayerQuitEvent event){
ScoreboardAnimation.removeAnimation(event.getPlayer());
}
}

View File

@@ -0,0 +1,4 @@
main: de.craftix.scoreboard.Main
name: Scoreboard
version: 1.0
author: CraftixLP