Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nmo-football
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AWang05
nmo-football
Merge requests
!2
补充
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
补充
master
into
select_map
Overview
0
Commits
9
Pipelines
0
Changes
7
Merged
AWang05
requested to merge
master
into
select_map
5 months ago
Overview
0
Commits
9
Pipelines
0
Changes
7
Expand
0
0
Merge request reports
Compare
select_map
select_map (base)
and
latest version
latest version
30f69d65
9 commits,
5 months ago
7 files
+
245
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
7
Search (e.g. *.vue) (Ctrl+P)
src/main/java/org/awang05/nmoFootball/controller/ChargeController.java
0 → 100644
+
95
−
0
Options
package
org.awang05.nmoFootball.controller
;
import
org.bukkit.entity.Player
;
import
org.bukkit.plugin.Plugin
;
import
org.bukkit.scheduler.BukkitRunnable
;
public
class
ChargeController
{
private
static
float
min
=
0.6
F
;
private
static
float
max
=
3.6
F
;
private
static
float
dx
=
0.1
F
;
private
static
int
pause
=
10
;
public
static
void
setMin
(
float
min
){
ChargeController
.
min
=
min
;
}
public
static
void
setMax
(
float
max
){
ChargeController
.
max
=
max
;
}
public
static
void
setDx
(
float
dx
){
ChargeController
.
dx
=
dx
;
}
public
static
void
setPause
(
int
pause
){
ChargeController
.
pause
=
pause
;
}
private
float
ad
=-
dx
;
private
float
x
=-
1
F
;
private
final
Player
player
;
private
int
time
=-
1
,
time1
=-
1
;
public
ChargeController
(
Player
p
,
Plugin
plugin
){
player
=
p
;
new
BukkitRunnable
()
{
//adder
@Override
public
void
run
()
{
if
(!
player
.
isOnline
()){
this
.
cancel
();
return
;
}
if
(
x
<
0
)
return
;
x
+=
ad
;
if
(
x
<
0
){
player
.
setExp
(
0
);
x
=-
1
;
}
else
if
(
x
>=
1
){
x
=
1
;
player
.
setExp
(
1
);
}
else
{
player
.
setExp
(
x
);
}
}
}.
runTaskTimer
(
plugin
,
0
,
2
);
new
BukkitRunnable
(){
//timer
@Override
public
void
run
()
{
if
(
time
<=
0
)
return
;
--
time
;
if
(
time
==
0
){
ad
=
0
;
time1
=
pause
;
}
}
}.
runTaskTimer
(
plugin
,
0
,
2
);
new
BukkitRunnable
()
{
//pause timer
@Override
public
void
run
()
{
if
(
ad
!=
0
)
return
;
if
(
time1
>
0
){
time1
-=
2
;
return
;
}
ad
=-
dx
;
}
}.
runTaskTimer
(
plugin
,
2
,
2
);
}
public
float
getSpeed
(){
if
(
x
<=
0
)
return
min
;
return
min
+
x
*(
max
-
min
);
}
public
void
press
(){
ad
=
dx
;
time
=
2
;
if
(
x
<
0
)
x
=
0
;
}
public
void
clear
(){
x
=-
1
;
player
.
setExp
(
0
);
}
}
Loading